Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

DynaPDF Manual - Page 494

Previous Page 493   Index   Next Page 495

Function Reference
Page 494 of 750
InsertRawImage
Syntax:
SI32 pdfInsertRawImage(
const PPDF* IPDF,
// Instance pointer
const void* Buffer, // Image buffer
UI32 BitsPerPixel,
// Color depth in bits per pixel
UI32 ColorCount,
// Number of colors in color table if any
SI32 ImgWidth,
// Image width
SI32 ImgHeight,
// Image height (negative values mirror the image)
double PosX,
// X-Coordinate of destination rectangle
double PosY,
// Y-Coordinate of destination rectangle
double ScaleWidth,
// Scaled width of destination rectangle
double ScaleHeight) // Scaled height of destination rectangle
typedef enum
{
rifByteAligned
= 0x1000, // Scanlines are byte aligned
rifRGBData
= 0x2000, // RGB data format, instead of BGR
rifCMYKData
= 0x4000
// CMYK image data or color table
}TRawImageFlags;
The function inserts an image from a raw image buffer that contains no image header. The parameter
Buffer must be a valid pointer to the image data.
The scanlines of the image must be double word aligned by default. This is the default format for
Device Independent Bitmaps (DIBs).
The scanline length can be calculated as follows:
scanLineLen = ((Width * BitsPerPixel + 31) / 32) * 4;
Or more efficient in C notation:
scanLineLen = ((Width * BitsPerPixel + 31) & ~31) >> 3;
DynaPDF 2.5 introduced several extensions which affect the data alignment, supported pixel
formats, and color spaces.
Flag
Description
rifByteAligned
Scanlines are byte aligned. If this flag is set, the scanline length is calculated as
follows:
scanLineLen = (Width * BitsPerPixel + 7) / 8;
rifRGBData
The image data is defined in RGB format instead of BGR. If BitsPerPixel is less
than 16 a color table in RGB format must precede the image data.
rifCMYKData
The image data is defined in CMYK. BitsPerPixel must be 1, 2, 4, 8, or 32 in
this case. If BitsPerPixel is less than 32 a color table in CMYK format must
precede the image data.
 

Previous topic: InsertMetafileFromHandleEx

Next topic: How to calculate the image size?