这篇教程C++ D2D1CreateFactory函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中D2D1CreateFactory函数的典型用法代码示例。如果您正苦于以下问题:C++ D2D1CreateFactory函数的具体用法?C++ D2D1CreateFactory怎么用?C++ D2D1CreateFactory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了D2D1CreateFactory函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: UNREFERENCED_PARAMETER/// <summary>/// Handle windows messages for the class instance/// </summary>/// <param name="hWnd">window message is for</param>/// <param name="uMsg">message</param>/// <param name="wParam">message data</param>/// <param name="lParam">additional message data</param>/// <returns>result of message processing</returns>LRESULT CALLBACK CBodyBasics::DlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){ UNREFERENCED_PARAMETER(wParam); UNREFERENCED_PARAMETER(lParam); switch (message) { case WM_INITDIALOG: { // Bind application window handle m_hWnd = hWnd; // Init Direct2D D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_pD2DFactory); // Get and initialize the default Kinect sensor InitializeDefaultSensor(); } break; // If the titlebar X is clicked, destroy app case WM_CLOSE: DestroyWindow(hWnd); break; case WM_DESTROY: // Quit the main message pump PostQuitMessage(0); break; } return FALSE;}
开发者ID:starwada,项目名称:K4W_Sample,代码行数:41,
示例2: D2D1CreateFactoryBOOL DrawTimeFrequencyGrid::Initialize( float aFontSize ){ static const WCHAR msc_fontName[] = L"Verdana"; fontSize = aFontSize; // Added code for factory here--odd place to put it. HRESULT hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &pFactory); if ( FAILED(hr)) return FALSE; // Create a DirectWrite factory. hr = DWriteCreateFactory( DWRITE_FACTORY_TYPE_SHARED, __uuidof(pDWriteFactory), reinterpret_cast<IUnknown **>(&pDWriteFactory) ); if ( FAILED(hr)) return FALSE; // Create a DirectWrite text format object. hr = pDWriteFactory->CreateTextFormat( msc_fontName, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, fontSize, L"", //locale &pTextFormat ); if ( FAILED(hr)) return FALSE; // Center the text horizontally and vertically. pTextFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER); pTextFormat->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER); return TRUE;}
开发者ID:johnkroeker,项目名称:ResonanceCore0,代码行数:29,
示例3: nf_system_infonf_system_info_t nf_system_info(){ float ppi_x = 0.0f, ppi_y = 0.0f; // instead of doing full initialization, let's just create a d2d1 factory if(!ctx.reference_counter) { HRESULT hr = 0; if(FAILED(hr = D2D1CreateFactory( D2D1_FACTORY_TYPE_SINGLE_THREADED, __uuidof(ID2D1Factory1), NULL, (void**)&ctx.d2d_factory))) { NF_ERROR("can't create d2d1 factory/n"); ctx.d2d_factory = NULL; } } ctx.d2d_factory->GetDesktopDpi(&ppi_x, &ppi_y); if(!ctx.reference_counter && ctx.d2d_factory) { ctx.d2d_factory->Release(); ctx.d2d_factory = NULL; } nf_system_info_t ret; ret.bitmap = NF_BITMAP_B8G8R8A8_UNORM_PMA; ret.max_width = NF_MAX_WIDTH; ret.max_height = NF_MAX_HEIGHT; ret.ppi_x = ppi_x; ret.ppi_y = ppi_y; return ret;}
开发者ID:UIKit0,项目名称:nativefonts,代码行数:33,
示例4: switchLRESULT MainWindow::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam){ switch (uMsg) { case WM_CREATE: if (FAILED(D2D1CreateFactory( D2D1_FACTORY_TYPE_SINGLE_THREADED, &pFactory))) { return -1; // Fail CreateWindowEx. } return 0; case WM_DESTROY: DiscardGraphicsResources(); SafeRelease(&pFactory); PostQuitMessage(0); return 0; case WM_PAINT: OnPaint(); return 0; case WM_SIZE: Resize(); return 0; } return DefWindowProc(m_hwnd, uMsg, wParam, lParam);}
开发者ID:nstoker,项目名称:LearnWindowsGUI1,代码行数:29,
示例5: assertvoid CDirect2D::init(){ std::cout << "Direct2D initialization: /n"; assert(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_pDirect2dFactory) == S_OK); std::cout << "d2d1 factory created /n"; assert(m_hwnd); RECT rc; GetClientRect(m_hwnd, &rc); HRESULT hr = m_pDirect2dFactory->CreateHwndRenderTarget( D2D1::RenderTargetProperties(), D2D1::HwndRenderTargetProperties(m_hwnd, D2D1::SizeU(rc.right - rc.left, rc.bottom - rc.top)), &pRenderTarget); //pRenderTarget->CreateSolidColorBrush( // D2D1::ColorF(D2D1::ColorF::Black), // &m_pBlackBrush); //renderObj = new CRenderObject(L"test.png"); //renderObjectsList = new std::vector<CRenderObject *>; //renderObjectsList.push_back(new CRenderObject(L"test.png")); }
开发者ID:kap1ec,项目名称:d2d1,代码行数:26,
示例6: D2D1CreateFactorybool NND2DRenderer::Init(){ HRESULT hr; hr = D2D1CreateFactory( D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_ipD2DFactory ); if ( hr != S_OK ) { return false; } HWND hwnd = NNApplication::GetInstance()->GetHWND(); RECT rt; GetClientRect( hwnd, &rt ); D2D1_SIZE_U size = D2D1::SizeU( rt.right-rt.left, rt.bottom-rt.top ); hr = m_ipD2DFactory->CreateHwndRenderTarget( D2D1::RenderTargetProperties(), D2D1::HwndRenderTargetProperties( hwnd, size ), &m_ipRenderTarget ); if ( hr != S_OK ) { return false; } return true;}
开发者ID:agebreak,项目名称:Sample_2DFighter,代码行数:25,
示例7: main//// Program starts here//int main( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow ){ HRESULT hr = D2D1CreateFactory( D2D1_FACTORY_TYPE_SINGLE_THREADED, &g_pD2DFactory ); hr = DWriteCreateFactory( DWRITE_FACTORY_TYPE_SHARED, __uuidof( IDWriteFactory ), reinterpret_cast<IUnknown**>( &g_pDWriteFactory ) ); hr = CoInitialize( NULL ); hr = CoCreateInstance( CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_IWICImagingFactory, reinterpret_cast<void**>( &g_pWICFactory ) ); g_pHWND = CreateGameWindow(); createDeviceResources(); // // Create a GWEN Direct2D renderer // g_pRenderer = new gwen::Renderer::Direct2D( g_pRT, g_pDWriteFactory, g_pWICFactory ); runSample(); delete g_pRenderer; g_pRenderer = NULL; if ( g_pRT != NULL ) { g_pRT->Release(); g_pRT = NULL; }}
开发者ID:MegaThorx,项目名称:GWEN,代码行数:38,
示例8: Direct2DRendererPrivate Direct2DRendererPrivate(): VideoRendererPrivate() , d2d_factory(0) , render_target(0) , bitmap(0) , bitmap_width(0) , bitmap_height(0) , interpolation(D2D1_BITMAP_INTERPOLATION_MODE_LINEAR) { dll.setFileName(QStringLiteral("d2d1")); if (!dll.load()) { available = false; qWarning("Direct2D is disabled. Failed to load 'd2d1.dll': %s", dll.errorString().toUtf8().constData()); return; } typedef HRESULT (WINAPI *D2D1CreateFactory_t)(D2D1_FACTORY_TYPE, REFIID, const D2D1_FACTORY_OPTIONS *, void **ppIFactory); D2D1CreateFactory_t D2D1CreateFactory; D2D1CreateFactory = (D2D1CreateFactory_t)dll.resolve("D2D1CreateFactory"); if (!D2D1CreateFactory) { available = false; qWarning("Direct2D is disabled. Failed to resolve symble 'D2D1CreateFactory': %s", dll.errorString().toUtf8().constData()); return; } D2D1_FACTORY_OPTIONS factory_opt = { D2D1_DEBUG_LEVEL_NONE }; /* * d2d is accessed by AVThread and GUI thread, so we use D2D1_FACTORY_TYPE_MULTI_THREADED * and let d2d to deal with the thread safe problems. otherwise, if we use * D2D1_FACTORY_TYPE_SINGLE_THREADED, we must use lock when copying ID2D1Bitmap and calling EndDraw. */ /// http://msdn.microsoft.com/en-us/library/windows/desktop/dd368104%28v=vs.85%29.aspx HRESULT hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_MULTI_THREADED , (REFIID)IID_ID2D1Factory , &factory_opt , (void**)&d2d_factory); if (FAILED(hr)) { available = false; qWarning("Direct2D is disabled. Create d2d factory failed"); return; } FLOAT dpiX, dpiY; d2d_factory->GetDesktopDpi(&dpiX, &dpiY); //gcc: extended initializer lists only available with -std=c++11 or -std=gnu++11 //vc: http://msdn.microsoft.com/zh-cn/library/t8xe60cf(v=vs.80).aspx /*pixel_format = { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE };*/ pixel_format.format = DXGI_FORMAT_B8G8R8A8_UNORM; pixel_format.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;//D2D1_ALPHA_MODE_IGNORE; /*bitmap_properties = { pixel_format, dpiX, dpiY };*/ bitmap_properties.pixelFormat = pixel_format; bitmap_properties.dpiX = dpiX; bitmap_properties.dpiY = dpiY; }
开发者ID:Andytianya,项目名称:QtAV,代码行数:59,
示例9: D2D1CreateFactoryHRESULT CRMrender::CreateFactory(){ HRESULT hr = S_FALSE; hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_pDisplayFactory); return hr;}
开发者ID:superhakgoman,项目名称:oldboy,代码行数:8,
示例10: D2D1CreateFactoryHRESULT MainApp::CreateDeviceIndependentResources(){ HRESULT hr = S_OK; hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &pDirect2dFactory); return hr;}
开发者ID:zorkzorkus,项目名称:zorkmonsters,代码行数:8,
示例11: D2D1CreateFactory// Creates resources that are not bound to a particular device.// Their lifetime effectively extends for the duration of the// application.HRESULT DemoApp::CreateDeviceIndependentResources(){ HRESULT hr = S_OK; // Create a Direct2D factory. hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_pDirect2dFactory); return hr;}
开发者ID:MarkoFilipovic,项目名称:Playground,代码行数:12,
示例12: defined void seq_tab_dialog::create_device_independent_resources() { // Direct2DFactory の生成 if(!d2d_factory_){#if defined(DEBUG) || defined(_DEBUG) D2D1_FACTORY_OPTIONS options; options.debugLevel = D2D1_DEBUG_LEVEL_INFORMATION ; THROW_IFERR(D2D1CreateFactory( D2D1_FACTORY_TYPE_SINGLE_THREADED, options, d2d_factory_.GetAddressOf() ));#else THROW_IFERR(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &d2d_factory_));#endif } if(!write_factory_){ THROW_IFERR(::DWriteCreateFactory( DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), reinterpret_cast<IUnknown**>(write_factory_.GetAddressOf()) )); } //wic_imaging_factory_.CreateInstance(CLSID_WICImagingFactory); //thunk_proc_ = (WNDPROC)thunk_.getCode(); layout_rect_ = D2D1::RectF(0.0f,100.0f,400.0f,100.0f); // Text Formatの作成 THROW_IFERR(write_factory_->CreateTextFormat( L"MS GOTHIC", // Font family name. NULL, // Font collection (NULL sets it to use the system font collection). DWRITE_FONT_WEIGHT_BOLD, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 12.0f, L"ja-jp", &write_text_format_ )); }
开发者ID:sfpgmr,项目名称:seqx,代码行数:44,
示例13: switch/// <summary>/// Handle windows messages for the class instance/// </summary>/// <param name="hWnd">window message is for</param>/// <param name="uMsg">message</param>/// <param name="wParam">message data</param>/// <param name="lParam">additional message data</param>/// <returns>result of message processing</returns>LRESULT CALLBACK Direct2DWindow::DlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){ switch (message) { case WM_INITDIALOG: { // Bind application window handle m_hWnd = hWnd; // Init Direct2D D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_pD2DFactory); // Create and initialize a new Direct2D image renderer (take a look at ImageRenderer.h) // We'll use this to draw the data we receive from the Kinect to the screen m_pDrawDepth = new ImageRenderer(); HRESULT hr = m_pDrawDepth->Initialize(GetDlgItem(m_hWnd, IDC_VIDEOVIEW), m_pD2DFactory, m_cdmap->GetFieldWidth(), m_cdmap->GetFieldHeight(), m_cdmap->GetFieldWidth() * sizeof(long)); if (FAILED(hr)) { SetStatusMessage(L"Failed to initialize the Direct2D draw device."); } } break; // If the titlebar X is clicked, destroy app case WM_CLOSE: DestroyWindow(hWnd); break; case WM_DESTROY: // Quit the main message pump PostQuitMessage(0); break; // Handle button press case WM_COMMAND: // If it was for the near mode control and a clicked event, change near mode if (IDC_CHECK_NEARMODE == LOWORD(wParam) && BN_CLICKED == HIWORD(wParam)) { // Toggle out internal state for near mode //m_bNearMode = !m_bNearMode; //if (NULL != m_pNuiSensor) //{ // // Set near mode based on our internal state // m_pNuiSensor->NuiImageStreamSetImageFrameFlags(m_pDepthStreamHandle, m_bNearMode ? NUI_IMAGE_STREAM_FLAG_ENABLE_NEAR_MODE : 0); //} } break; } return FALSE;}
开发者ID:vernonrj,项目名称:robotics-kinect,代码行数:64,
示例14: SharedD2DFactory SharedD2DFactory() { jassertfalse; //xxx Direct2D support isn't ready for use yet! D2D1CreateFactory (D2D1_FACTORY_TYPE_SINGLE_THREADED, d2dFactory.resetAndGetPointerAddress()); DWriteCreateFactory (DWRITE_FACTORY_TYPE_SHARED, __uuidof (IDWriteFactory), (IUnknown**) directWriteFactory.resetAndGetPointerAddress()); if (directWriteFactory != nullptr) directWriteFactory->GetSystemFontCollection (systemFonts.resetAndGetPointerAddress()); }
开发者ID:adscum,项目名称:MoogLadders,代码行数:10,
示例15: definedHRESULT App::CreateDeviceIndependentResources(){ HRESULT hr; // Create a Direct2D factory.#if defined(DEBUG) || defined(_DEBUG) D2D1_FACTORY_OPTIONS options; options.debugLevel = D2D1_DEBUG_LEVEL_INFORMATION; hr = D2D1CreateFactory( D2D1_FACTORY_TYPE_SINGLE_THREADED, options, &D2D_Factory );#else hr = D2D1CreateFactory( D2D1_FACTORY_TYPE_MULTI_THREADED, &D2D_Factory );#endif if (SUCCEEDED(hr)) { // Create WIC factory. hr = CoCreateInstance( CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&WIC_Factory) ); } if (SUCCEEDED(hr)) { // Create a DirectWrite factory. hr = DWriteCreateFactory( DWRITE_FACTORY_TYPE_SHARED, __uuidof(DW_Factory), reinterpret_cast<IUnknown **>(&DW_Factory) ); } return hr;}
开发者ID:Three141,项目名称:PectoStudioNFC,代码行数:43,
示例16: CreateD2DResourceVOID CreateD2DResource(HWND hWnd){ if (!g_pRenderTarget) { HRESULT hr ; hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &g_pD2DFactory) ; if (FAILED(hr)) { MessageBox(hWnd, "Create D2D factory failed!", "Error", 0) ; return ; } // Obtain the size of the drawing area RECT rc ; GetClientRect(hWnd, &rc) ; // Create a Direct2D render target hr = g_pD2DFactory->CreateHwndRenderTarget( D2D1::RenderTargetProperties(), D2D1::HwndRenderTargetProperties( hWnd, D2D1::SizeU(rc.right - rc.left,rc.bottom - rc.top) ), &g_pRenderTarget ) ; if (FAILED(hr)) { MessageBox(hWnd, "Create render target failed!", "Error", 0) ; return ; } // Create a brush hr = g_pRenderTarget->CreateSolidColorBrush( D2D1::ColorF(D2D1::ColorF::Black), &g_pBlackBrush ) ; if (FAILED(hr)) { MessageBox(hWnd, "Create brush failed!", "Error", 0) ; return ; } // Create a rectangle hr = g_pD2DFactory->CreateRectangleGeometry( D2D1::RectF(10, 10, 50, 50), &g_pRectangleGeometry ); if (FAILED(hr)) { MessageBox(hWnd, "Create rectangle geometry failed!", "Error", 0); return; } }}
开发者ID:BillyKim,项目名称:directxcode,代码行数:55,
示例17: D2D1CreateFactoryHRESULT CMainWindow::CreateDeviceIndependentResources(){ // Create a Direct2D factory HRESULT hr = D2D1CreateFactory( D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_pD2DFactory ); return hr;}
开发者ID:dbremner,项目名称:Win7_SDK_Samples,代码行数:11,
示例18: Init void Factory::Init( FactoryType factoryType, DebugLevel debugLevel ) { ID2D1Factory *factory = NULL; D2D1_FACTORY_OPTIONS options; options.debugLevel = static_cast<D2D1_DEBUG_LEVEL>( debugLevel ); if( RECORD_D2D( D2D1CreateFactory( static_cast<D2D1_FACTORY_TYPE>( factoryType ), IID_ID2D1Factory, &options, (void**) &factory ) ).IsFailure ) throw gcnew Direct2DException( Result::Last ); Construct( factory ); }
开发者ID:0x53A,项目名称:slimdx,代码行数:12,
示例19: initDrawHRESULT initDraw(void){ D2D1_FACTORY_OPTIONS opts; ZeroMemory(&opts, sizeof (D2D1_FACTORY_OPTIONS)); // TODO make this an option opts.debugLevel = D2D1_DEBUG_LEVEL_NONE; return D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory, &opts, (void **) (&d2dfactory));}
开发者ID:trigrass2,项目名称:libui,代码行数:12,
示例20: D2D1CreateFactorybool Graphics::InitGraphics(HWND hwnd){ HRESULT res = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &factory); if (res != S_OK) return false; RECT rect; GetClientRect(hwnd, &rect); res = factory->CreateHwndRenderTarget(D2D1::RenderTargetProperties(), D2D1::HwndRenderTargetProperties(hwnd, D2D1::SizeU(rect.right, rect.bottom)), &renderTarget); if (res != S_OK) return false; return true;}
开发者ID:garrick91,项目名称:Tutorial,代码行数:12,
示例21: D2D1CreateFactoryHRESULT FirstTry::CreateDeviceIndependentResources(){ HRESULT hr = S_OK; // Create a Direct2D factory. hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_pD2DFactory); if (SUCCEEDED(hr)) hr = CoCreateInstance(CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&m_pWICFactory)); return hr;}
开发者ID:yanhua2002,项目名称:Direct2DSample,代码行数:12,
示例22: EnsureIndependentResourcesCreated/// <summary>/// Ensure the independent Direct2D resources have been created/// </summary>void EnsureIndependentResourcesCreated(){ if (nullptr == g_pD2DFactory) { D2D1CreateFactory(D2D1_FACTORY_TYPE_MULTI_THREADED, &g_pD2DFactory); } if (nullptr == g_pDWriteFactory) { DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), reinterpret_cast<IUnknown**>(&g_pDWriteFactory)); }}
开发者ID:dcastro9,项目名称:emory_kinect_project,代码行数:15,
示例23: CreateD2D1FactorySTplx::ComPtr<ID2D1Factory2> CreateD2D1FactoryST(D2D1_DEBUG_LEVEL debug_level) { D2D1_FACTORY_OPTIONS options = {}; options.debugLevel = debug_level; plx::ComPtr<ID2D1Factory2> factory; auto hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, options, factory.GetAddressOf()); if (hr != S_OK) throw plx::ComException(__LINE__, hr); return factory;}
开发者ID:cpizano,项目名称:CamCenter,代码行数:12,
示例24: CreateD2DFactoryinline ComPtr<ID2D1Factory1> CreateD2DFactory(){ D2D1_FACTORY_OPTIONS fo{};#ifdef DEBUG fo.debugLevel = D2D1_DEBUG_LEVEL_INFORMATION;#endif ComPtr<ID2D1Factory1> d2dFactory; HR(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, fo, d2dFactory.GetAddressOf())); return d2dFactory;}
开发者ID:TraGicCode,项目名称:TicTacToe,代码行数:12,
示例25: UNREFERENCED_PARAMETER/// <summary>/// Handle windows messages for the class instance/// </summary>/// <param name="hWnd">window message is for</param>/// <param name="uMsg">message</param>/// <param name="wParam">message data</param>/// <param name="lParam">additional message data</param>/// <returns>result of message processing</returns>LRESULT CALLBACK CCoordinateMappingBasics::DlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){ UNREFERENCED_PARAMETER(wParam); UNREFERENCED_PARAMETER(lParam); switch (message) { case WM_INITDIALOG: { // Bind application window handle m_hWnd = hWnd; // Init Direct2D D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_pD2DFactory); // Create and initialize a new Direct2D image renderer (take a look at ImageRenderer.h) // We'll use this to draw the data we receive from the Kinect to the screen m_pDrawCoordinateMapping = new ImageRenderer(); HRESULT hr = m_pDrawCoordinateMapping->Initialize(GetDlgItem(m_hWnd, IDC_VIDEOVIEW), m_pD2DFactory, cDepthWidth, cDepthHeight, cDepthWidth * sizeof(RGBQUAD)); if (FAILED(hr)) { SetStatusMessage(L"Failed to initialize the Direct2D draw device.", 10000, true); } // Get and initialize the default Kinect sensor InitializeDefaultSensor(); } break; // If the titlebar X is clicked, destroy app case WM_CLOSE: DestroyWindow(hWnd); break; case WM_DESTROY: // Quit the main message pump PostQuitMessage(0); break; // Handle button press case WM_COMMAND: // If it was for the screenshot control and a button clicked event, save a screenshot next frame if (IDC_BUTTON_SCREENSHOT == LOWORD(wParam) && BN_CLICKED == HIWORD(wParam)) { m_bSaveScreenshot = true; } break; } return FALSE;}
开发者ID:starwada,项目名称:K4W_Sample,代码行数:59,
示例26: D2D1CreateFactoryHRESULT ClixRenderer::CreateDIR(){ HRESULT hr = S_OK; hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &D2Factory); if (SUCCEEDED(hr)) { hr = DWriteCreateFactory( DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), reinterpret_cast<IUnknown**>(&pDWriteFactory) ); } if (SUCCEEDED(hr)) { hr = pDWriteFactory->CreateTextFormat( L"Microsoft Sans Serif Regular", // Font family name. NULL, // Font collection (NULL sets it to use the system font collection). DWRITE_FONT_WEIGHT_REGULAR, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 15.0f, L"en-us", &pTextFormat ); } // Center align (horizontally) the text. if (SUCCEEDED(hr)) { hr = pTextFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING); } if (SUCCEEDED(hr)) { hr = pTextFormat->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER); }#ifdef CONSOLE if (SUCCEEDED(hr)) std::wcout << "DeviceIndependendResources Succesfully created!" << std::endl; else std::wcout << "DeviceIndependedResources Error: " << std::hex << hr << std::endl;#endif return hr;}
开发者ID:CLiSTi,项目名称:CurveForever,代码行数:48,
示例27: CoInitializeExHRESULT CAshaD2D::CreateFactory(void){ HRESULT hr=S_OK; //Initialize com CoInitializeEx(NULL,COINIT_MULTITHREADED); //Create WIC factory hr=CoCreateInstance(CLSID_WICImagingFactory1,NULL,CLSCTX_INPROC_SERVER,IID_PPV_ARGS(&m_pWICImgFactory)); //Create D2D factory if(SUCCEEDED(hr)) hr=D2D1CreateFactory(D2D1_FACTORY_TYPE_MULTI_THREADED,&m_pD2D1Facatory); //Create DWrite factory if(SUCCEEDED(hr)) hr=DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED,__uuidof(IDWriteFactory),reinterpret_cast<IUnknown**>(&m_pDWriteFactory)); return hr;}
开发者ID:lazyrohan,项目名称:Asha,代码行数:16,
示例28: D2D1CreateFactoryBOOL ResonanceStudioDraw::PreCreateWindow(CREATESTRUCT& cs){ // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs // Added code for factory here--odd place to put it. HRESULT hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &pFactory); if ( FAILED(hr)) return FALSE; ptheDrawTimeFrequencyGrid = new DrawTimeFrequencyGrid(); if ( !ptheDrawTimeFrequencyGrid->Initialize( 10.0 ) ) return FALSE; return TRUE;}
开发者ID:johnkroeker,项目名称:ResonanceCore0,代码行数:16,
示例29: native_window opengl_window::opengl_window(i_rendering_engine& aRenderingEngine, i_surface_manager& aSurfaceManager, i_native_window_event_handler& aEventHandler) : native_window(aRenderingEngine, aSurfaceManager), iEventHandler(aEventHandler), iLogicalCoordinateSystem(neogfx::logical_coordinate_system::AutomaticGui), iFrameRate(60), iFrameCounter(0), iLastFrameTime(0), iRendering(false) {#ifdef _WIN32 ID2D1Factory* m_pDirect2dFactory; D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_pDirect2dFactory); FLOAT dpiX, dpiY; m_pDirect2dFactory->GetDesktopDpi(&dpiX, &dpiY); iPixelDensityDpi = size(static_cast<size::dimension_type>(dpiX), static_cast<size::dimension_type>(dpiY));#endif }
开发者ID:FlibbleMr,项目名称:neogfx,代码行数:17,
示例30: switch/// <summary>/// Handle windows messages for the class instance/// </summary>/// <param name="hWnd">window message is for</param>/// <param name="uMsg">message</param>/// <param name="wParam">message data</param>/// <param name="lParam">additional message data</param>/// <returns>result of message processing</returns>LRESULT CALLBACK CSkeletonBasics::DlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){ switch (message) { case WM_INITDIALOG: { // Bind application window handle m_hWnd = hWnd; // Init Direct2D D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_pD2DFactory); // Look for a connected Kinect, and create it if found CreateFirstConnected(); } break; // If the titlebar X is clicked, destroy app case WM_CLOSE: DestroyWindow(hWnd); break; case WM_DESTROY: // Quit the main message pump PostQuitMessage(0); break; // Handle button press case WM_COMMAND: // If it was for the near mode control and a clicked event, change near mode if (IDC_CHECK_SEATED == LOWORD(wParam) && BN_CLICKED == HIWORD(wParam)) { // Toggle out internal state for near mode m_bSeatedMode = !m_bSeatedMode; if (NULL != m_pNuiSensor) { // Set near mode for sensor based on our internal state m_pNuiSensor->NuiSkeletonTrackingEnable(m_hNextSkeletonEvent, m_bSeatedMode ? NUI_SKELETON_TRACKING_FLAG_ENABLE_SEATED_SUPPORT : 0); } } break; } return FALSE;}
开发者ID:Sammino,项目名称:OF_Kinect_Tutorials,代码行数:54,
注:本文中的D2D1CreateFactory函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ D2I函数代码示例 C++ D1函数代码示例 |