• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            brent's hut

            Use Skia in MFC or Win32 application

            What is Skia

            Skia is an open source 2D graphics library which provides common APIs that work across a variety of hardware and software platforms. It serves as the graphics engine for Google Chrome and Chrome OS, Android, Mozilla Firefox and Firefox OS, and many other products.

            How to download and build Skia

            Just follow https://skia.org/user/download, and do it step by step, we will need a static build for use lately.

            How to use Skia in a MFC application

            1. Create your MFC application

            2. Add Skia path to "VC++ Directories" of the project



            3. Add Skia library paths to "Additional Library Directories"



            4. Add "uafxcw.lib;LIBCMT.lib;opengl32.lib;glu32.lib;skia.lib;sk_app.GLWindowContext.obj;sk_app.GLWindowContext_win.obj" to "Additional Dependencies". Add "uafxcw.lib;LIBCMT.lib;" to "Ignore Specific Default Libraries."



            5. In XXXDlg.h:
            #include "tools\sk_app\DisplayParams.h"
            #include "tools\sk_app\WindowContext.h"

            protected:
            HICON m_hIcon;
            sk_app::DisplayParams m_paras;
            std::unique_ptr<sk_app::WindowContext> m_skaContext;

            6. In XXXDlg.cpp:

            #include "include\core\SkPoint.h"
            #include "include\core\SkFont.h"
            #include "include\core\SkCanvas.h"
            #include "include\core\SkSurface.h"
            #include "tools\sk_app\win\WindowContextFactory_win.h"
            using namespace sk_app;

            BOOL XXXDlg::OnInitDialog()
            {
            m_skaContext = window_context_factory::MakeGLForWin(m_hWnd, m_paras);
            return TRUE;
            }

            void XXXDlg::OnSize(UINT nType, int cx, int cy)
            {
            if(m_skaContext)
            m_skaContext->resize(cx, cy);
            }

            void XXXDlg::OnPaint()
            {
            sk_sp<SkSurface> backbuffer = m_skaContext->getBackbufferSurface();
            if (backbuffer) {
            SkCanvas* c = backbuffer->getCanvas();
            c->clear(SK_ColorWHITE);
            SkPaint p(SkColors::kBlack);
            c->drawLine(SkPoint::Make(0, 0), SkPoint::Make(m_skaContext->width(), m_skaContext->height()), p);

            static const char message[] = "Hello World";

            SkFont font;
            font.setSubpixel(true);
            font.setSize(20);
            c->drawSimpleText(message, strlen(message), SkTextEncoding::kUTF8, 0, m_skaContext->height() -2, font, p);
            backbuffer->flush();

            m_skaContext->swapBuffers();
            }
            }

            7. If everything is OK, the result will be:


            posted on 2020-02-07 07:53 brent 閱讀(2874) 評論(0)  編輯 收藏 引用 所屬分類: C++

            久久精品免费观看| 天堂无码久久综合东京热| 国产99精品久久| 久久av高潮av无码av喷吹| 97香蕉久久夜色精品国产| 久久影院综合精品| 久久亚洲国产精品五月天婷| 欧美精品久久久久久久自慰| 久久AAAA片一区二区| 无码人妻久久一区二区三区| 久久国产福利免费| 日韩久久久久久中文人妻| 久久久久国产亚洲AV麻豆| 久久精品无码午夜福利理论片| 久久久精品久久久久特色影视| 麻豆成人久久精品二区三区免费| 国产视频久久| 精品国产福利久久久| 中文字幕久久精品无码| 久久久久99精品成人片三人毛片| 国产成人精品久久一区二区三区 | 久久亚洲春色中文字幕久久久| 久久久噜噜噜久久| 久久精品国内一区二区三区| 亚洲人成精品久久久久| 青草久久久国产线免观| 久久精品一区二区影院| 久久美女网站免费| 97久久久精品综合88久久| 性高湖久久久久久久久| 2021国产精品久久精品| 久久亚洲AV无码精品色午夜 | 精品久久久久久亚洲| 久久久久99精品成人片试看| 久久国产精品成人影院| 精品国产VA久久久久久久冰 | 亚洲精品无码久久久| 亚洲人成无码www久久久| 伊人色综合久久天天网| 中文字幕人妻色偷偷久久| 99精品国产99久久久久久97 |