• <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 閱讀(2842) 評論(0)  編輯 收藏 引用 所屬分類: C++

            欧美伊人久久大香线蕉综合| 久久99九九国产免费看小说| 精品久久人人爽天天玩人人妻| 99久久99这里只有免费的精品| 久久婷婷五月综合97色直播| 欧美丰满熟妇BBB久久久| 久久国产精品一区| 精品久久久久久中文字幕| 久久久久久精品久久久久| 国产一区二区精品久久凹凸 | 久久精品国产色蜜蜜麻豆| 亚洲AV无码久久精品色欲| 亚洲国产成人精品久久久国产成人一区二区三区综 | 久久亚洲AV无码精品色午夜麻豆| 久久偷看各类wc女厕嘘嘘| 精品久久久久中文字幕一区| 久久精品无码专区免费青青| 狠狠综合久久AV一区二区三区| 午夜精品久久久内射近拍高清| 久久国产亚洲精品无码| 久久亚洲日韩看片无码| 精品久久人人妻人人做精品| 99精品久久精品| 久久久久久人妻无码| 久久久久久久久波多野高潮| 欧美伊人久久大香线蕉综合69 | 久久中文精品无码中文字幕| 国产精品久久久久jk制服| 久久婷婷综合中文字幕| 99热热久久这里只有精品68| 久久电影网一区| 精品熟女少妇a∨免费久久| 精品久久人人爽天天玩人人妻| 日日狠狠久久偷偷色综合96蜜桃| 国内精品久久久久久久coent| 国产精品久久波多野结衣| 久久丫精品国产亚洲av| 久久精品国产99久久久| 国内精品九九久久久精品| www性久久久com| 久久精品无码一区二区三区|