• <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精品| 精品人妻伦九区久久AAA片69| 武侠古典久久婷婷狼人伊人| 一本综合久久国产二区| 亚洲va中文字幕无码久久不卡| 精品久久久久久无码专区不卡| 久久精品国产亚洲精品| 99久久国产亚洲综合精品| 麻豆AV一区二区三区久久| 99久久精品国产一区二区| 久久精品国产亚洲av麻豆蜜芽 | 久久精品国产亚洲精品| 亚洲国产精品成人久久蜜臀| 久久精品www人人爽人人| 综合久久一区二区三区 | 久久精品九九亚洲精品| 国产成人香蕉久久久久| 久久久久99精品成人片欧美| 久久久久久亚洲精品不卡| 久久精品国产亚洲av麻豆色欲| 日日狠狠久久偷偷色综合96蜜桃| 久久国产精品久久精品国产| 久久精品国产亚洲AV久 | 97热久久免费频精品99| 伊人久久成人成综合网222| 国产99久久久久久免费看| 国内精品久久久久| 亚洲va国产va天堂va久久| 日本五月天婷久久网站| 久久夜色撩人精品国产| 99久久精品免费看国产免费| 久久国产高清字幕中文| 久久成人国产精品| 亚洲AV无码1区2区久久| 久久久久久久精品妇女99| 青青草原综合久久大伊人| 久久天天躁狠狠躁夜夜躁2014| 久久频这里精品99香蕉久| 久久91精品国产91久| 国产精品亚洲综合久久| 亚洲AV无码久久精品蜜桃|