public static D2D_SIZE_U SizeU([NativeTypeName("UINT32")] uint width = 0, [NativeTypeName("UINT32")] uint height = 0) { D2D_SIZE_U size = new D2D_SIZE_U { width = width, height = height, }; return(size); }
/// <summary> /// Creates an <see cref="ID2D1Bitmap1"/> instance and copies data from a source bitmap. /// </summary> /// <param name="d2D1DeviceContext">The input <see cref="ID2D1DeviceContext"/> instance to use to create the bitmap.</param> /// <param name="d2D1Bitmap">The input <see cref="ID2D1Bitmap1"/> to read data from.</param> /// <param name="d2D1MappedRect">The resulting <see cref="D2D1_MAPPED_RECT"/> for the bitmap.</param> /// <returns>A new <see cref="ID2D1Bitmap1"/> instance.</returns> public static unsafe ComPtr <ID2D1Bitmap1> CreateD2D1Bitmap1Buffer(ID2D1DeviceContext *d2D1DeviceContext, ID2D1Bitmap *d2D1Bitmap, out D2D1_MAPPED_RECT d2D1MappedRect) { D2D_SIZE_U d2DSize = d2D1Bitmap->GetPixelSize(); D2D1_BITMAP_PROPERTIES1 d2DBitmapProperties1Buffer = default; d2DBitmapProperties1Buffer.pixelFormat.format = DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM; d2DBitmapProperties1Buffer.pixelFormat.alphaMode = D2D1_ALPHA_MODE.D2D1_ALPHA_MODE_PREMULTIPLIED; d2DBitmapProperties1Buffer.bitmapOptions = D2D1_BITMAP_OPTIONS.D2D1_BITMAP_OPTIONS_CPU_READ | D2D1_BITMAP_OPTIONS.D2D1_BITMAP_OPTIONS_CANNOT_DRAW; using ComPtr <ID2D1Bitmap1> d2D1Bitmap1Buffer = default; // Create a buffer D2D1 bitmap d2D1DeviceContext->CreateBitmap( size: d2DSize, sourceData: null, pitch: 0, bitmapProperties: &d2DBitmapProperties1Buffer, bitmap: d2D1Bitmap1Buffer.GetAddressOf()).Assert(); D2D_POINT_2U d2DPointDestination = default; D2D_RECT_U d2DRectSource = new(0, 0, d2DSize.width, d2DSize.height); // Copy the image from the target to the readback bitmap d2D1Bitmap1Buffer.Get()->CopyFromBitmap( destPoint: &d2DPointDestination, bitmap: d2D1Bitmap, srcRect: &d2DRectSource); fixed(D2D1_MAPPED_RECT *d2D1MappedRectPtr = &d2D1MappedRect) { // Map the buffer bitmap d2D1Bitmap1Buffer.Get()->Map( options: D2D1_MAP_OPTIONS.D2D1_MAP_OPTIONS_READ, mappedRect: d2D1MappedRectPtr).Assert(); } return(d2D1Bitmap1Buffer.Move()); }
public HRESULT CreateCompatibleRenderTarget([NativeTypeName("D2D1_SIZE_F")] D2D_SIZE_F desiredSize, [NativeTypeName("D2D1_SIZE_U")] D2D_SIZE_U desiredPixelSize, D2D1_PIXEL_FORMAT desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, ID2D1BitmapRenderTarget **bitmapRenderTarget) { return(CreateCompatibleRenderTarget(&desiredSize, &desiredPixelSize, &desiredFormat, options, bitmapRenderTarget)); }
public HRESULT CreateCompatibleRenderTarget([NativeTypeName("D2D1_SIZE_F")] D2D_SIZE_F desiredSize, [NativeTypeName("D2D1_SIZE_U")] D2D_SIZE_U desiredPixelSize, ID2D1BitmapRenderTarget **bitmapRenderTarget) { return(CreateCompatibleRenderTarget(&desiredSize, &desiredPixelSize, null, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, bitmapRenderTarget)); }
public HRESULT CreateBitmap([NativeTypeName("D2D1_SIZE_U")] D2D_SIZE_U size, [NativeTypeName("const D2D1_BITMAP_PROPERTIES &")] D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap **bitmap) { return(CreateBitmap(size, null, 0, bitmapProperties, bitmap)); }
public HRESULT CreateBitmap([NativeTypeName("D2D1_SIZE_U")] D2D_SIZE_U size, [NativeTypeName("const void *")] void *srcData, [NativeTypeName("UINT32")] uint pitch, [NativeTypeName("const D2D1_BITMAP_PROPERTIES *")] D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap **bitmap) { return(((delegate * unmanaged <ID2D1BitmapRenderTarget *, D2D_SIZE_U, void *, uint, D2D1_BITMAP_PROPERTIES *, ID2D1Bitmap **, int>)(lpVtbl[4]))((ID2D1BitmapRenderTarget *)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap)); }
public D2D1_HWND_RENDER_TARGET_PROPERTIES(HWND hwnd, [NativeTypeName("D2D1_SIZE_U")] D2D_SIZE_U pixelSize = default, D2D1_PRESENT_OPTIONS presentOptions = D2D1_PRESENT_OPTIONS_NONE) { this = HwndRenderTargetProperties(hwnd, pixelSize, presentOptions); }
public static void Resize(D2D_SIZE_U usize) => Direct2D_Resize(usize);
public D2D1_RENDERING_CONTROLS(D2D1_BUFFER_PRECISION bufferPrecision, [NativeTypeName("D2D1_SIZE_U")] D2D_SIZE_U tileSize) { this = RenderingControls(bufferPrecision, tileSize); }
public static extern void Direct2D_Resize(D2D_SIZE_U dsize);
public static extern int Direct2D_CreateDynamicBitmap(D2D_SIZE_U bsize, ref IntPtr ppBitmap);