{"id":852,"date":"2015-12-23T21:53:24","date_gmt":"2015-12-23T12:53:24","guid":{"rendered":"http:\/\/dev.activebasic.com\/egtra\/?p=852"},"modified":"2016-01-06T00:02:31","modified_gmt":"2016-01-05T15:02:31","slug":"d2d%e3%83%87%e3%83%90%e3%82%a4%e3%82%b9%e3%82%b3%e3%83%b3%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%82%92%e4%bd%bf%e3%81%86%e6%9c%80%e5%b0%8f%e3%82%b5%e3%83%b3%e3%83%97%e3%83%ab","status":"publish","type":"post","link":"https:\/\/dev.activebasic.com\/egtra\/2015\/12\/23\/852\/","title":{"rendered":"D2D\u30c7\u30d0\u30a4\u30b9\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3092\u4f7f\u3046\u6700\u5c0f\u30b5\u30f3\u30d7\u30eb"},"content":{"rendered":"<p>Windows 8\u3067\u8ffd\u52a0\u3055\u308c\u305fID2D1DeviceContext\u306b\u3088\u308bDirect2D\u63cf\u753b\u3092\u8a66\u3057\u3066\u307f\u305f\u304f\u3066\u3001\u6700\u5c0f\u306e\u30b3\u30fc\u30c9\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u30a6\u30a3\u30f3\u30c9\u30a6\u4f5c\u6210\u306bATL\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002\u521d\u3081\u306fWTL\u3082\u4f7f\u3063\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u307b\u3093\u306e\u5c11\u3057\u3060\u3063\u305f\u306e\u3067\u3001\u4f7f\u308f\u306a\u3044\u3088\u3046\u306b\u4fee\u6b63\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre lang=\"cpp\">\r\n#define UNICODE\r\n#define _UNICODE\r\n\r\n#include <cstdlib>\r\n\r\n#include <windows.h>\r\n#include <d3d11_1.h>\r\n#include <dxgi1_2.h>\r\n#include <d2d1_2.h>\r\n#include <wrl\/client.h>\r\n\r\n#include <atlbase.h>\r\n#include <atlwin.h>\r\n#include <atltypes.h>\r\n\r\n#pragma comment(lib, \"d3d11.lib\")\r\n#pragma comment(lib, \"d2d1.lib\")\r\n\r\nusing Microsoft::WRL::ComPtr;\r\n\r\nclass TestWindow : public ATL::CWindowImpl<TestWindow>\r\n{\r\npublic:\r\n  \/\/ WM_ERASEBKGND\u3067\u306e\u3061\u3089\u3064\u304d\u3092\u6291\u3048\u308b\u305f\u3081\u3001-1\u3068\u3057\u3066\u3044\u308b\u3002\r\n  DECLARE_WND_CLASS_EX(L\"Test Window Class\", 0, -1);\r\n\r\n  \/\/ WTL\u3067\u306f\u3001\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3057\u305f\u307b\u3046\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u30af\u30e9\u30c3\u30ab\u30fc\u304c\u4f7f\u3048\u308b\u3002\r\n  BEGIN_MSG_MAP(TestWindow)\r\n    MESSAGE_HANDLER(WM_SIZE, OnSize) \/\/MSG_WM_SIZE(OnSize)\r\n    MESSAGE_HANDLER(WM_PAINT, OnPaint) \/\/MSG_WM_PAINT(OnPaint)\r\n    MESSAGE_HANDLER(WM_CREATE, OnCreate) \/\/MSG_WM_CREATE(OnCreate)\r\n    MESSAGE_HANDLER(WM_DESTROY, OnDestroy) \/\/MSG_WM_DESTROY(OnDestroy)\r\n  END_MSG_MAP()\r\n\r\nprivate:\r\n  \/\/void OnSize(UINT type, SIZE size)\r\n  LRESULT OnSize(UINT, WPARAM type, LPARAM lp, BOOL&)\r\n  {\r\n    SIZE size{ GET_X_LPARAM(lp), GET_Y_LPARAM(lp) };\r\n    if (type == SIZE_MINIMIZED || type == SIZE_MAXHIDE)\r\n      return 0;\r\n\r\n    DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {};\r\n    auto hr = resource.m_dxgiSwapChain->GetDesc1(&swapChainDesc);\r\n    if (SUCCEEDED(hr)\r\n      && swapChainDesc.Width == size.cx && swapChainDesc.Height == size.cy)\r\n    {\r\n      return 0;\r\n    }\r\n    resource.m_d2dDeviceContext->SetTarget(nullptr);\r\n\r\n    hr = resource.m_dxgiSwapChain->ResizeBuffers(\r\n      swapChainDesc.BufferCount, 0, 0, DXGI_FORMAT_UNKNOWN, 0);\r\n    if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET)\r\n    {\r\n      HandleDeviceLost();\r\n    }\r\n    InitializeRenderTarget();\r\n\r\n    BOOL b{};\r\n    OnPaint(0, 0, 0, b); \/\/ WTL\u4f7f\u7528\u6642\u306fOnPaint(nullptr);\r\n    return 0;\r\n  }\r\n\r\n  \/\/void OnPaint(HDC)\r\n  LRESULT OnPaint(UINT, WPARAM, LPARAM, BOOL&)\r\n  {\r\n    OnRender();\r\n    ValidateRect(nullptr);\r\n    return 0;\r\n  }\r\n\r\n  void OnRender()\r\n  {\r\n    resource.m_d2dDeviceContext->BeginDraw();\r\n    resource.m_d2dDeviceContext->Clear(D2D1::ColorF(D2D1::ColorF::Black));\r\n\r\n    \/\/ \u5b9f\u969b\u306b\u306f\u3001\u3053\u306e\u30d6\u30e9\u30b7\u3082\u3001\u6bce\u56de\u4f5c\u6210\u305b\u305a\u30e1\u30f3\u30d0\u5909\u6570\u306b\u3057\u305f\u307b\u3046\u304c\u826f\u3044\u3002\r\n    \/\/ \u5fc5\u9808\u306e\u51e6\u7406\u3067\u306f\u306a\u3044\u3053\u3068\u3092\u306f\u3063\u304d\u308a\u3068\u793a\u3059\u305f\u3081\u3001\u308f\u3056\u3068\u30e1\u30f3\u30d0\u5909\u6570\u306b\u3057\u306a\u304b\u3063\u305f\u3002\r\n    ComPtr<ID2D1SolidColorBrush> brush;\r\n    resource.m_d2dDeviceContext->CreateSolidColorBrush(\r\n      D2D1::ColorF(D2D1::ColorF::White), &brush);\r\n\r\n    \/\/ \u8a66\u3057\u306b\u5186\u3092\u63cf\u3044\u3066\u307f\u308b\u3002\r\n    RECT rc;\r\n    GetClientRect(&rc);\r\n    D2D1_ELLIPSE ellipse{\r\n      {rc.right * 0.5f, rc.bottom * 0.5f},\r\n      rc.right * 0.5f,\r\n      rc.bottom * 0.5f\r\n    };\r\n    resource.m_d2dDeviceContext->DrawEllipse(ellipse, brush.Get(), 10.f);\r\n\r\n    auto hr = resource.m_d2dDeviceContext->EndDraw();\r\n    if (hr == D2DERR_RECREATE_TARGET)\r\n    {\r\n      HandleDeviceLost();\r\n    }\r\n    else if (SUCCEEDED(hr))\r\n    {\r\n      hr = resource.m_dxgiSwapChain->Present(1, 0);\r\n      if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET)\r\n      {\r\n        HandleDeviceLost();\r\n      }\r\n    }\r\n  }\r\n\r\n  \/\/LRESULT OnCreate(const CREATESTRUCT*)\r\n  LRESULT OnCreate(UINT, WPARAM, LPARAM, BOOL&)\r\n  {\r\n    if (FAILED(CreateDeviceIndependentResources()))\r\n      return -1;\r\n    if (FAILED(CreateDeviceResources()))\r\n      return -1;\r\n    return 0;\r\n  }\r\n\r\n  void HandleDeviceLost()\r\n  {\r\n    MessageBox(L\"\u30c7\u30d0\u30a4\u30b9\u30ed\u30b9\u30c8\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002\");\r\n\r\n    ReleaseDeviceResources();\r\n    CreateDeviceResources();\r\n    \/\/ \u3044\u3063\u305f\u3093\u30e1\u30c3\u30bb\u30fc\u30b8\u30eb\u30fc\u30d7\u306b\u623b\u3057\u305f\u304f\u3066\u3001OnRender\u3092\u76f4\u63a5\u547c\u3070\u305a\u3001\u3053\u3046\u3057\u3066\u3044\u308b\u3002\r\n    Invalidate();\r\n  }\r\n\r\n  \/\/void OnDestroy()\r\n  LRESULT OnDestroy(UINT, WPARAM, LPARAM, BOOL&)\r\n  {\r\n    PostQuitMessage(0);\r\n    ReleaseDeviceResources();\r\n    return 0;\r\n  }\r\n\r\n  void ReleaseDeviceResources()\r\n  {\r\n    resource = {};\r\n  }\r\n\r\n  HRESULT Direct3DCreateDevice(\r\n    D3D_DRIVER_TYPE driverType, _COM_Outptr_ ID3D11Device** ppDevice)\r\n  {\r\n    UINT flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT\r\n      | D3D11_CREATE_DEVICE_SINGLETHREADED;\r\n#ifdef _DEBUG\r\n    \/\/flags |= D3D11_CREATE_DEVICE_DEBUG;\r\n#endif\r\n\r\n    const D3D_FEATURE_LEVEL featureLevels[] =\r\n    {\r\n      D3D_FEATURE_LEVEL_11_1,\r\n      D3D_FEATURE_LEVEL_11_0,\r\n      D3D_FEATURE_LEVEL_10_1,\r\n      D3D_FEATURE_LEVEL_10_0,\r\n      D3D_FEATURE_LEVEL_9_3,\r\n      D3D_FEATURE_LEVEL_9_2,\r\n      D3D_FEATURE_LEVEL_9_1,\r\n    };\r\n    return D3D11CreateDevice(nullptr,\r\n      driverType,\r\n      nullptr,\r\n      flags,\r\n      featureLevels,\r\n      ARRAYSIZE(featureLevels),\r\n      D3D11_SDK_VERSION,\r\n      ppDevice,\r\n      nullptr,\r\n      nullptr);\r\n  }\r\n\r\n  HRESULT Direct3DCreateDevice(_COM_Outptr_ ID3D11Device** ppDevice)\r\n  {\r\n    auto hr = Direct3DCreateDevice(D3D_DRIVER_TYPE_HARDWARE, ppDevice);\r\n    if (SUCCEEDED(hr)) return hr;\r\n    return Direct3DCreateDevice(D3D_DRIVER_TYPE_WARP, ppDevice);\r\n  }\r\n\r\n  HRESULT CreateDeviceResources()\r\n  {\r\n    ComPtr<ID3D11Device> device;\r\n\r\n    auto hr = Direct3DCreateDevice(&device);\r\n    if (FAILED(hr)) return hr;\r\n    ComPtr<IDXGIDevice2> dxgiDevice;\r\n    hr = device.As(&dxgiDevice);\r\n    if (FAILED(hr)) return hr;\r\n\r\n    ComPtr<ID2D1Device> d2d1Device;\r\n    hr = m_d2dFactory->CreateDevice(dxgiDevice.Get(), &d2d1Device);\r\n    if (FAILED(hr)) return hr;\r\n\r\n    hr = d2d1Device->CreateDeviceContext(\r\n      D2D1_DEVICE_CONTEXT_OPTIONS_NONE,\r\n      &resource.m_d2dDeviceContext);\r\n    if (FAILED(hr)) return hr;\r\n    ComPtr<IDXGIAdapter> dxgiAdapter;\r\n    hr = dxgiDevice->GetAdapter(&dxgiAdapter);\r\n    if (FAILED(hr)) return hr;\r\n    ComPtr<IDXGIFactory2> dxgiFactory;\r\n    hr = dxgiAdapter->GetParent(IID_PPV_ARGS(&dxgiFactory));\r\n    if (FAILED(hr)) return hr;\r\n\r\n    DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {};\r\n    swapChainDesc.Width = 0;\r\n    swapChainDesc.Height = 0;\r\n    swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;\r\n    swapChainDesc.Stereo = FALSE;\r\n    swapChainDesc.SampleDesc.Count = 1;\r\n    swapChainDesc.SampleDesc.Quality = 0;\r\n    swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;\r\n    swapChainDesc.BufferCount = 2;\r\n    \/\/swapChainDesc.Scaling = DXGI_SCALING_NONE;\r\n    swapChainDesc.Scaling = DXGI_SCALING_STRETCH;\r\n    \/\/swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;\r\n    swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;\r\n    swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED;\r\n    hr = dxgiFactory->CreateSwapChainForHwnd(\r\n      device.Get(),\r\n      m_hWnd,\r\n      &swapChainDesc,\r\n      nullptr,\r\n      nullptr,\r\n      &resource.m_dxgiSwapChain);\r\n    if (FAILED(hr)) return hr;\r\n    (void)dxgiDevice->SetMaximumFrameLatency(1);\r\n    hr = InitializeRenderTarget();\r\n    if (FAILED(hr)) return hr;\r\n    return S_OK;\r\n  }\r\n\r\n  HRESULT InitializeRenderTarget()\r\n  {\r\n    ComPtr<ID2D1Bitmap1> d2d1RenderTarget;\r\n    ComPtr<IDXGISurface2> dxgiSurface;\r\n    auto hr = resource.m_dxgiSwapChain->GetBuffer(\r\n      0, IID_PPV_ARGS(&dxgiSurface));\r\n    if (FAILED(hr)) return hr;\r\n    hr = resource.m_d2dDeviceContext->CreateBitmapFromDxgiSurface(\r\n      dxgiSurface.Get(),\r\n      D2D1::BitmapProperties1(\r\n        D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW,\r\n        D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE)),\r\n      &d2d1RenderTarget);\r\n    if (FAILED(hr)) return hr;\r\n    resource.m_d2dDeviceContext->SetTarget(d2d1RenderTarget.Get());\r\n    return S_OK;\r\n  }\r\n\r\n  HRESULT CreateDeviceIndependentResources()\r\n  {\r\n    D2D1_FACTORY_OPTIONS options = {};\r\n#ifdef _DEBUG\r\n    options.debugLevel = D2D1_DEBUG_LEVEL_INFORMATION;\r\n#endif\r\n    auto hr = D2D1CreateFactory(\r\n      D2D1_FACTORY_TYPE_SINGLE_THREADED,\r\n      options,\r\n      m_d2dFactory.GetAddressOf());\r\n    if (FAILED(hr)) return hr;\r\n    return S_OK;\r\n  }\r\n\r\n  \/\/ \u30c7\u30d0\u30a4\u30b9\u975e\u4f9d\u5b58\u30ea\u30bd\u30fc\u30b9\r\n  ComPtr<ID2D1Factory1> m_d2dFactory;\r\n  \/\/ \u30c7\u30d0\u30a4\u30b9\u4f9d\u5b58\u30ea\u30bd\u30fc\u30b9\r\n  struct DeviceResources\r\n  {\r\n    ComPtr<IDXGISwapChain1> m_dxgiSwapChain;\r\n    ComPtr<ID2D1DeviceContext> m_d2dDeviceContext;\r\n  } resource;\r\n};\r\n\r\nint WINAPI wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int cmdShow)\r\n{\r\n  CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);\r\n\r\n  TestWindow wnd;\r\n  if (!wnd.Create(nullptr, ATL::CWindow::rcDefault,\r\n    TEXT(\"Hello, world\"), WS_OVERLAPPEDWINDOW))\r\n  {\r\n    std::quick_exit(-1);\r\n  }\r\n\r\n  wnd.ShowWindow(cmdShow);\r\n  wnd.UpdateWindow();\r\n\r\n  MSG msg;\r\n  while (GetMessage(&msg, nullptr, 0, 0))\r\n  {\r\n    TranslateMessage(&msg);\r\n    DispatchMessage(&msg);\r\n  }\r\n  std::quick_exit(static_cast<int>(msg.wParam));\r\n}\r\n<\/pre>\n<p>\u4f8b\u3068\u3057\u3066\u3001\u5186\u3092\u63cf\u304f\u51e6\u7406\u3092\u5165\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3057\u3066\u3044\u308bDXGI_SCALING_NONE\u3068DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL\u306f\u3001Windows 8\u3067\u8ffd\u52a0\u3055\u308c\u305f\u3082\u306e\u3067\u3059\u3002\u6700\u521d\u306f\u305d\u3061\u3089\u3092\u4f7f\u3063\u3066\u3044\u307e\u3057\u305f\u304c\u3001Windows 7\u3067\u52d5\u304b\u3057\u3066\u307f\u305f\u969b\u306b\u5909\u66f4\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u30b7\u30b9\u30c6\u30e0DPI\u3092\u60f3\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002manifest\u30d5\u30a1\u30a4\u30eb\u3092\u8ffd\u52a0\u3057\u305f\u4e0a\u3067\u3001\u6587\u5b57\u306e\u5927\u304d\u3055150% (144 DPI)\u3067\u3082\u52d5\u304b\u3057\u3066\u307f\u3066\u3042\u308a\u307e\u3059\u3002Per-monitor DPI\u5bfe\u5fdc\u307e\u3067\u306f\u3084\u3063\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<p>\u30c7\u30d0\u30a4\u30b9\u30ed\u30b9\u30c8\u306e\u51e6\u7406\u306f\u8a66\u305b\u3066\u3044\u307e\u305b\u3093\u3002\u30c7\u30d0\u30a4\u30b9\u30ed\u30b9\u30c8\u306e\u767a\u751f\u65b9\u6cd5\u304c\u5206\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u30d3\u30c7\u30aa\u30ab\u30fc\u30c9\u306e\u30c7\u30d0\u30a4\u30b9\u30c9\u30e9\u30a4\u30d0\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3084\u5909\u66f4\u306f\u8a66\u3057\u305f\u306e\u3067\u3059\u304c\u2026\u2026\u3002<\/p>\n<p>\u4ee5\u4e0b\u3001\u4e3b\u306b\u53c2\u8003\u306b\u3057\u305f\u30a6\u30a7\u30d6\u30da\u30fc\u30b8\u3067\u3059\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/hh780339.aspx\">How to render by using a Direct2D device context<\/a> (MSDN Library)<\/li>\n<li><a href=\"https:\/\/msdn.microsoft.com\/en-us\/magazine\/dn198239.aspx\">Windows with C++ &#8211; Introducing Direct2D 1.1<\/a> (MSDN Magazine)<\/li>\n<li><a href=\"http:\/\/yutorina.hatenablog.jp\/entry\/2014\/11\/12\/181426\">\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u30a2\u30d7\u30ea\u3067Direct3D11+Direct2D\u306e\u521d\u671f\u5316\u307e\u3068\u3081 &#8211; \u3086\u3068\u308a\u30fc\u306a\u306e\u65e5\u8a18<\/a><\/li>\n<li><a href=\"http:\/\/d.hatena.ne.jp\/sugarontop\/20150217\">ID2D1HwndRenderTarget\u3068ID2D1DeviceContext &#8211; sugarontop\u306e\u65e5\u8a18<\/a><\/li>\n<li><a href=\"http:\/\/wlog.flatlib.jp\/item\/1009\">\u30db\u30a4\u30fc\u30eb\u6b32\u3057\u3044 \u30cf\u30f3\u30c9\u30eb\u6b32\u3057\u3044 \u226b Direct3D 10 \u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u30ea\u30b5\u30a4\u30ba (ResizeBuffers)<\/a><\/li>\n<\/ul>\n<p>\u3042\u3068\u3001\u4e3b\u306aAPI\u306eMSDN\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u5b58\u5728\u3059\u308b\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u306e\u30da\u30fc\u30b8\u3067\u3059\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/msdn.microsoft.com\/ja-jp\/library\/ee416031.aspx\">D3D11CreateDevice<\/a>\uff08\u65e5\u672c\u8a9e\uff09<\/li>\n<li><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/ff476082.aspx\">D3D11CreateDevice function<\/a><\/li>\n<li><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/hh404599.aspx\">ID2D1Factory1::CreateDevice method<\/a><\/li>\n<li><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/hh404545.aspx\">ID2D1Device::CreateDeviceContext method<\/a><\/li>\n<li><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/hh404528.aspx\">DXGI_SWAP_CHAIN_DESC1 structure<\/a><\/li>\n<li><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/hh404557.aspx\">IDXGIFactory2::CreateSwapChainForHwnd method<\/a><\/li>\n<li><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/jj841134.aspx\">ID2D1DeviceContext::CreateBitmapFromDxgiSurface method<\/a><\/li>\n<\/ul>\n<p>\u3088\u308a\u77ed\u3044\u30b3\u30fc\u30c9\u3092\u76ee\u6307\u3059\u306a\u3089<a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/hh404273.aspx\">D2D1CreateDeviceContext function<\/a>\u3082\u3042\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u4f7f\u3044\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u30d5\u30a1\u30af\u30c8\u30ea(ID2D1Factory1)\u3092\u6bce\u56de\u751f\u6210\u3059\u308b\u70b9\u3092\u6c17\u306b\u3057\u305f\u305f\u3081\u3067\u3059\u3002<\/p>\n<p><ins>2015\u5e7412\u670825\u65e5\u4fee\u6b63\uff1a\u30c7\u30d0\u30a4\u30b9\u30ed\u30b9\u30c8\u306e\u52d5\u4f5c\u78ba\u8a8d\u304c\u3067\u304d\u307e\u3057\u305f\u3002\u305d\u308c\u306b\u3088\u308a\u3001OnRender\u30e1\u30f3\u30d0\u30fc\u95a2\u6570\u3092\u4fee\u6b63\u3057\u307e\u3057\u305f\u3002Present\u95a2\u6570\u306e\u547c\u3073\u51fa\u3057\u3092EndDraw\u95a2\u6570\u304c\u6210\u529f\u3057\u305f\u5834\u5408\u306e\u307f\u306b\u884c\u3046\u3088\u3046\u5909\u66f4\u3057\u307e\u3057\u305f\u3002<\/ins><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Direct2D\u30c7\u30d0\u30a4\u30b9\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8(ID2D1DeviceContext)\u3067\u63cf\u753b\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u6700\u5c0f\u30b5\u30f3\u30d7\u30eb\u3092\u4f5c\u308a\u307e\u3057\u305f\u3002\u30c7\u30d0\u30a4\u30b9\u30ed\u30b9\u30c8\u3084\u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u30b5\u30a4\u30ba\u5909\u66f4\u306b\u3082\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[5,29,12],"tags":[142,37,57,176,273],"class_list":["post-852","post","type-post","status-publish","format-standard","hentry","category-cpp","category-directx","category-vc","tag-atl","tag-direct2d","tag-windows-7","tag-windows-8","tag-skeleton-program"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>D2D\u30c7\u30d0\u30a4\u30b9\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3092\u4f7f\u3046\u6700\u5c0f\u30b5\u30f3\u30d7\u30eb - \u30a4\u30b0\u30c8\u30e9\u30f3\u30b9\u306e\u982d\u306e\u4e2d<\/title>\n<meta name=\"description\" content=\"Direct2D\u30c7\u30d0\u30a4\u30b9\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8(ID2D1DeviceContext)\u3067\u63cf\u753b\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u6700\u5c0f\u30b5\u30f3\u30d7\u30eb\u3092\u4f5c\u308a\u307e\u3057\u305f\u3002\u30c7\u30d0\u30a4\u30b9\u30ed\u30b9\u30c8\u3084\u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u30b5\u30a4\u30ba\u5909\u66f4\u306b\u3082\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/dev.activebasic.com\/egtra\/2015\/12\/23\/852\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"D2D\u30c7\u30d0\u30a4\u30b9\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3092\u4f7f\u3046\u6700\u5c0f\u30b5\u30f3\u30d7\u30eb - \u30a4\u30b0\u30c8\u30e9\u30f3\u30b9\u306e\u982d\u306e\u4e2d\" \/>\n<meta property=\"og:description\" content=\"Direct2D\u30c7\u30d0\u30a4\u30b9\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8(ID2D1DeviceContext)\u3067\u63cf\u753b\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u6700\u5c0f\u30b5\u30f3\u30d7\u30eb\u3092\u4f5c\u308a\u307e\u3057\u305f\u3002\u30c7\u30d0\u30a4\u30b9\u30ed\u30b9\u30c8\u3084\u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u30b5\u30a4\u30ba\u5909\u66f4\u306b\u3082\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dev.activebasic.com\/egtra\/2015\/12\/23\/852\/\" \/>\n<meta property=\"og:site_name\" content=\"\u30a4\u30b0\u30c8\u30e9\u30f3\u30b9\u306e\u982d\u306e\u4e2d\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ysk.noh\" \/>\n<meta property=\"article:published_time\" content=\"2015-12-23T12:53:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-01-05T15:02:31+00:00\" \/>\n<meta name=\"author\" content=\"egtra\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@egtra\" \/>\n<meta name=\"twitter:site\" content=\"@egtra\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"egtra\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"5\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dev.activebasic.com\/egtra\/2015\/12\/23\/852\/\",\"url\":\"https:\/\/dev.activebasic.com\/egtra\/2015\/12\/23\/852\/\",\"name\":\"D2D\u30c7\u30d0\u30a4\u30b9\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3092\u4f7f\u3046\u6700\u5c0f\u30b5\u30f3\u30d7\u30eb - \u30a4\u30b0\u30c8\u30e9\u30f3\u30b9\u306e\u982d\u306e\u4e2d\",\"isPartOf\":{\"@id\":\"https:\/\/dev.activebasic.com\/egtra\/#website\"},\"datePublished\":\"2015-12-23T12:53:24+00:00\",\"dateModified\":\"2016-01-05T15:02:31+00:00\",\"author\":{\"@id\":\"https:\/\/dev.activebasic.com\/egtra\/#\/schema\/person\/8de756b2ff20b964f64594dfe8f18164\"},\"description\":\"Direct2D\u30c7\u30d0\u30a4\u30b9\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8(ID2D1DeviceContext)\u3067\u63cf\u753b\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u6700\u5c0f\u30b5\u30f3\u30d7\u30eb\u3092\u4f5c\u308a\u307e\u3057\u305f\u3002\u30c7\u30d0\u30a4\u30b9\u30ed\u30b9\u30c8\u3084\u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u30b5\u30a4\u30ba\u5909\u66f4\u306b\u3082\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/dev.activebasic.com\/egtra\/2015\/12\/23\/852\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dev.activebasic.com\/egtra\/2015\/12\/23\/852\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dev.activebasic.com\/egtra\/2015\/12\/23\/852\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u30db\u30fc\u30e0\",\"item\":\"https:\/\/dev.activebasic.com\/egtra\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"D2D\u30c7\u30d0\u30a4\u30b9\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3092\u4f7f\u3046\u6700\u5c0f\u30b5\u30f3\u30d7\u30eb\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dev.activebasic.com\/egtra\/#website\",\"url\":\"https:\/\/dev.activebasic.com\/egtra\/\",\"name\":\"\u30a4\u30b0\u30c8\u30e9\u30f3\u30b9\u306e\u982d\u306e\u4e2d\",\"description\":\"\u982d\u306e\u4e2d\u306e\u304b\u3051\u3089\u3002ActiveBasic\u3092\u4e2d\u5fc3\u306b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u8a71\u3092\u307c\u3061\u307c\u3061\u3068\u3002\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dev.activebasic.com\/egtra\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/dev.activebasic.com\/egtra\/#\/schema\/person\/8de756b2ff20b964f64594dfe8f18164\",\"name\":\"egtra\",\"sameAs\":[\"https:\/\/x.com\/egtra\"],\"url\":\"https:\/\/dev.activebasic.com\/egtra\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"D2D\u30c7\u30d0\u30a4\u30b9\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3092\u4f7f\u3046\u6700\u5c0f\u30b5\u30f3\u30d7\u30eb - \u30a4\u30b0\u30c8\u30e9\u30f3\u30b9\u306e\u982d\u306e\u4e2d","description":"Direct2D\u30c7\u30d0\u30a4\u30b9\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8(ID2D1DeviceContext)\u3067\u63cf\u753b\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u6700\u5c0f\u30b5\u30f3\u30d7\u30eb\u3092\u4f5c\u308a\u307e\u3057\u305f\u3002\u30c7\u30d0\u30a4\u30b9\u30ed\u30b9\u30c8\u3084\u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u30b5\u30a4\u30ba\u5909\u66f4\u306b\u3082\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dev.activebasic.com\/egtra\/2015\/12\/23\/852\/","og_locale":"ja_JP","og_type":"article","og_title":"D2D\u30c7\u30d0\u30a4\u30b9\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3092\u4f7f\u3046\u6700\u5c0f\u30b5\u30f3\u30d7\u30eb - \u30a4\u30b0\u30c8\u30e9\u30f3\u30b9\u306e\u982d\u306e\u4e2d","og_description":"Direct2D\u30c7\u30d0\u30a4\u30b9\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8(ID2D1DeviceContext)\u3067\u63cf\u753b\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u6700\u5c0f\u30b5\u30f3\u30d7\u30eb\u3092\u4f5c\u308a\u307e\u3057\u305f\u3002\u30c7\u30d0\u30a4\u30b9\u30ed\u30b9\u30c8\u3084\u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u30b5\u30a4\u30ba\u5909\u66f4\u306b\u3082\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002","og_url":"https:\/\/dev.activebasic.com\/egtra\/2015\/12\/23\/852\/","og_site_name":"\u30a4\u30b0\u30c8\u30e9\u30f3\u30b9\u306e\u982d\u306e\u4e2d","article_publisher":"https:\/\/www.facebook.com\/ysk.noh","article_published_time":"2015-12-23T12:53:24+00:00","article_modified_time":"2016-01-05T15:02:31+00:00","author":"egtra","twitter_card":"summary_large_image","twitter_creator":"@egtra","twitter_site":"@egtra","twitter_misc":{"\u57f7\u7b46\u8005":"egtra","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"5\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/dev.activebasic.com\/egtra\/2015\/12\/23\/852\/","url":"https:\/\/dev.activebasic.com\/egtra\/2015\/12\/23\/852\/","name":"D2D\u30c7\u30d0\u30a4\u30b9\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3092\u4f7f\u3046\u6700\u5c0f\u30b5\u30f3\u30d7\u30eb - \u30a4\u30b0\u30c8\u30e9\u30f3\u30b9\u306e\u982d\u306e\u4e2d","isPartOf":{"@id":"https:\/\/dev.activebasic.com\/egtra\/#website"},"datePublished":"2015-12-23T12:53:24+00:00","dateModified":"2016-01-05T15:02:31+00:00","author":{"@id":"https:\/\/dev.activebasic.com\/egtra\/#\/schema\/person\/8de756b2ff20b964f64594dfe8f18164"},"description":"Direct2D\u30c7\u30d0\u30a4\u30b9\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8(ID2D1DeviceContext)\u3067\u63cf\u753b\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u6700\u5c0f\u30b5\u30f3\u30d7\u30eb\u3092\u4f5c\u308a\u307e\u3057\u305f\u3002\u30c7\u30d0\u30a4\u30b9\u30ed\u30b9\u30c8\u3084\u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u30b5\u30a4\u30ba\u5909\u66f4\u306b\u3082\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002","breadcrumb":{"@id":"https:\/\/dev.activebasic.com\/egtra\/2015\/12\/23\/852\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dev.activebasic.com\/egtra\/2015\/12\/23\/852\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/dev.activebasic.com\/egtra\/2015\/12\/23\/852\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u30db\u30fc\u30e0","item":"https:\/\/dev.activebasic.com\/egtra\/"},{"@type":"ListItem","position":2,"name":"D2D\u30c7\u30d0\u30a4\u30b9\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3092\u4f7f\u3046\u6700\u5c0f\u30b5\u30f3\u30d7\u30eb"}]},{"@type":"WebSite","@id":"https:\/\/dev.activebasic.com\/egtra\/#website","url":"https:\/\/dev.activebasic.com\/egtra\/","name":"\u30a4\u30b0\u30c8\u30e9\u30f3\u30b9\u306e\u982d\u306e\u4e2d","description":"\u982d\u306e\u4e2d\u306e\u304b\u3051\u3089\u3002ActiveBasic\u3092\u4e2d\u5fc3\u306b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u8a71\u3092\u307c\u3061\u307c\u3061\u3068\u3002","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dev.activebasic.com\/egtra\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/dev.activebasic.com\/egtra\/#\/schema\/person\/8de756b2ff20b964f64594dfe8f18164","name":"egtra","sameAs":["https:\/\/x.com\/egtra"],"url":"https:\/\/dev.activebasic.com\/egtra\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/dev.activebasic.com\/egtra\/wp-json\/wp\/v2\/posts\/852"}],"collection":[{"href":"https:\/\/dev.activebasic.com\/egtra\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.activebasic.com\/egtra\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.activebasic.com\/egtra\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.activebasic.com\/egtra\/wp-json\/wp\/v2\/comments?post=852"}],"version-history":[{"count":0,"href":"https:\/\/dev.activebasic.com\/egtra\/wp-json\/wp\/v2\/posts\/852\/revisions"}],"wp:attachment":[{"href":"https:\/\/dev.activebasic.com\/egtra\/wp-json\/wp\/v2\/media?parent=852"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.activebasic.com\/egtra\/wp-json\/wp\/v2\/categories?post=852"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.activebasic.com\/egtra\/wp-json\/wp\/v2\/tags?post=852"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}