91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 11KB
    文件類型: .7z
    金幣: 1
    下載: 0 次
    發布日期: 2021-06-09
  • 語言: 其他
  • 標簽: Kinect??

資源簡介

《Kinect for Windows SDK v2 0 開發筆記 二 彩色幀獲取》附加資源

資源截圖

代碼片段和文件信息

#include?“stdafx.h“
#include?“included.h“
#include?


//?ImageRender類構造函數
ImageRenderer::ImageRenderer(){
//?創建資源
m_hrInit?=?CreateDeviceIndependentResources();
????//?創建緩沖區
????m_pColorRGBX?=?new?RGBQUAD[IMAGE_WIDTH*IMAGE_HEIGHT];
????if?(!m_pColorRGBX)?m_hrInit?=?E_OUTOFMEMORY;
????m_timer.Start();
}


//?創建設備無關資源
HRESULT?ImageRenderer::CreateDeviceIndependentResources(){
HRESULT?hr?=?S_OK;

//?創建?Direct2D?工廠.
hr?=?D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED?&m_pD2DFactory);

if?(SUCCEEDED(hr))
{
//?創建?WIC?工廠.
hr?=?CoCreateInstance(
CLSID_WICImagingFactory
NULL
CLSCTX_INPROC_SERVER
IID_IWICImagingFactory
reinterpret_cast(&m_pWICFactory)
);
}

if?(SUCCEEDED(hr))
{
//?創建?DirectWrite?工廠.
hr?=?DWriteCreateFactory(
DWRITE_FACTORY_TYPE_SHARED
__uuidof(m_pDWriteFactory)
reinterpret_cast(&m_pDWriteFactory)
);
}

if?(SUCCEEDED(hr))
{
//?創建正文文本格式.
hr?=?m_pDWriteFactory->CreateTextFormat(
L“Microsoft?YaHei“
nullptr
DWRITE_FONT_WEIGHT_NORMAL
DWRITE_FONT_style_NORMAL
DWRITE_FONT_STRETCH_NORMAL
60.f
L““?//locale
&m_pTextFormatMain
);
}

return?hr;
}

//?從文件讀取位圖
HRESULT?ImageRenderer::LoadBitmapFromFile(
ID2D1RenderTarget?*pRenderTarget
IWICImagingFactory?*pIWICFactory
PCWSTR?uri
UINT?destinationWidth
UINT?destinationHeight
ID2D1Bitmap?**ppBitmap

{
IWICBitmapDecoder?*pDecoder?=?NULL;
IWICBitmapframeDecode?*pSource?=?NULL;
IWICStream?*pStream?=?NULL;
IWICFormatConverter?*pConverter?=?NULL;
IWICBitmapScaler?*pScaler?=?NULL;

HRESULT?hr?=?pIWICFactory->CreateDecoderFromFilename(
uri
NULL
GENERIC_READ
WICDecodemetadataCacheonload
&pDecoder
);

if?(SUCCEEDED(hr))
{
hr?=?pDecoder->Getframe(0?&pSource);
}
if?(SUCCEEDED(hr))
{
hr?=?pIWICFactory->CreateFormatConverter(&pConverter);
}


if?(SUCCEEDED(hr))
{
if?(destinationWidth?!=?0?||?destinationHeight?!=?0)
{
UINT?originalWidth?originalHeight;
hr?=?pSource->GetSize(&originalWidth?&originalHeight);
if?(SUCCEEDED(hr))
{
if?(destinationWidth?==?0)
{
FLOAT?scalar?=?static_cast(destinationHeight)?/?static_cast(originalHeight);
destinationWidth?=?static_cast(scalar?*?static_cast(originalWidth));
}
else?if?(destinationHeight?==?0)
{
FLOAT?scalar?=?static_cast(destinationWidth)?/?static_cast(originalWidth);
destinationHeight?=?static_cast(scalar?*?static_cast(originalHeight));
}

hr?=?pIWICFactory->CreateBitmapScaler(&pScaler);
if?(SUCCEEDED(hr))
{
hr?=?pScaler->Initialize(
pSource
destinationWidth
destinationHeight
WICBitmapInterpolationModeCubic
);
}
if?(SUCCEEDED(hr))
{
hr?=?pConverter->Initialize(
pScaler
GUID_WICPixel

評論

共有 條評論