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

DynaPDF Manual - Page 496

Previous Page 495   Index   Next Page 497

Function Reference
Page 496 of 750
If ScaleWidth or ScaleHeight is -1 the function uses the original width or height from the image.
If both parameters are -1 the image will be inserted with a resolution of 72 DPI.
If ScaleWidth or ScaleHeight is 0, the missing value is calculated in relation to the given value
of ScaleHeight or ScaleWidth to preserve the image's aspect ratio. The resulting output is an
image with exact proportions relative to its original size.
If ScaleWidth and ScaleHeight are 0, the original size is used (same effect as -1).
A negative value of Width or Height mirrors the image on the x- or y-axis.
The function contains no parameter to define the buffer length. However, the required length is
calculated from the parameters of the function.
The pixel data must be uncompressed. Raw images are handled in the same way as other image
formats; they are downscaled if necessary, converted to the current color space and compressed with
the defined compression filter. Note that 1 bit images are treated as image mask if transparency is
enabled (see SetUseTransparency()), see InsertImage() for further information.
Remarks:
InsertRawImageEx() is more flexible regarding the number of color components, specific scanline
lengths and alpha channels in multi-channel images.
It is possible to use one image on several pages or positions. To insert an image multiple times use
the function PlaceImage(). However, once an image was inserted, the physical dimension cannot be
changed; it can only be scaled to different sizes. If an image should be used with different
dimensions, insert the largest version first.
Return values:
If the function succeeds the return value is the image handle, a value greater or equal zero. If the
function fails the return value is a negative error code.
InsertRawImageEx
Syntax:
SI32 pdfInsertRawImageEx(
const PPDF* IPDF,
// Instance pointer
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
struct TPDFRawImage* Image) // see below
struct TPDFRawImage
{
UI32
StructSize;
// Must be set to sizeof(TPDFRawImage)
const void*
Buffer;
// Image buffer
UI32
BufSize;
// Buffer size
UI32
BitsPerComponent; // Bits per component
 

Previous topic: How to calculate the image size?

Next topic: Color Key Masking