Class PdfBitmap
The PdfBitmap class represents a bitmap image in the PDFium library. It provides methods to create and manipulate bitmap images from PDF pages.
public class PdfBitmap : PdfObject, IDisposable
- Inheritance
-
PdfBitmap
- Implements
- Inherited Members
Properties
Buffer
Gets a pointer to the memory buffer containing the raw image data of the PDF bitmap.
public nint Buffer { get; }
Property Value
Remarks
The buffer is managed by the underlying PDF rendering library and should not be modified or freed by the caller. The caller is responsible for ensuring the associated bitmap handle remains valid while accessing the buffer.
Format
Gets the format of the bitmap, which indicates the color depth and pixel format.
public PdfBitmapFormat Format { get; }
Property Value
Height
Returns the height of the bitmap in pixels.
public int Height { get; }
Property Value
Stride
Gets the stride of the bitmap, which is the number of bytes in a row of pixel data.
public int Stride { get; }
Property Value
Width
Returns the width of the bitmap in pixels.
public int Width { get; }
Property Value
Methods
Create(int, int, bool)
Creates a new bitmap with the specified width, height, and alpha channel support.
public static PdfBitmap Create(int width, int height, bool alpha = true)
Parameters
width
intThe width of the bitmap in pixels
height
intThe height of the bitmap in pixels
alpha
boolWhether or not the bitmap should support an alpha channel (transparency)
Returns
- PdfBitmap
a new PdfBitmap
Exceptions
- dotPDFiumException
Throws on PDFium library error
CreateEx(int, int, PdfBitmapFormat, nint, int)
Create a bitmap with the specified width, height, format, buffer, and stride.
public static PdfBitmap CreateEx(int width, int height, PdfBitmapFormat format, nint buffer, int stride)
Parameters
width
intThe width of the bitmap in pixels
height
intThe height of the bitmap in pixels
format
PdfBitmapFormatThe format of the bitmap
buffer
nintThe buffer for the newly created bitmap
stride
intThe stride of the new bitmap (width of a row)
Returns
- PdfBitmap
a new PdfBitmap object whose buffer is user-controlled
Exceptions
Dispose(bool)
Dispose method. This method is protected and should not be used directly.
protected override void Dispose(bool disposing)
Parameters
disposing
bool
FillRect(int, int, int, int, uint)
Fills a rectangle in the bitmap with the specified color.
public void FillRect(int left, int top, int width, int height, uint color)