DynaPDF Manual - Page 567

Previous Page 566   Index   Next Page 568

Function Reference
Page 567 of 777
Because such small pieces are not really meaningful when viewed alone, the application can either
try to reconstruct the original image, or if this is not possible, such images should be skipped.
When the content parser returns lots of very small images then it is usually best to provide a fallback
that renders the entire page with RenderPage() or RenderPageToImage().
Image coordinate space
An image occupies a rectangle in image space w units wide and h units high, where w and h are the
width and height of the image in samples or pixels. Each sample occupies one square unit. The
coordinate origin (0, 0) is at the upper-left corner of the image, with coordinates ranging from 0 to w
horizontally and 0 to h vertically.
The image’s sample data is ordered by row, with the horizontal coordinate varying most rapidly.
The upper-left corner of the first sample is at coordinates (0, 0), the second at (1, 0), and so on
through the last sample of the first row, whose upper-left corner is at (0, 0) and whose upper-right
corner is at (w - 1, 0). The next samples after that are at coordinates (0, 1), (1, 1), and so on to the final
sample of the image, whose upper-left corner is at (0, 0) and whose lower-right corner is at (w-1, h-1).
The correspondence between image space and user space is constant: the unit square of user space,
bounded by user coordinates (0, 0) and (1, 1), corresponds to the boundary of the image in image
space. Following the normal convention for user space, the coordinate (0, 0) is at the lower-left corner
of this square, corresponding to coordinates (0, h) in image space. The implicit transformation from
image space to user space, if specified explicitly, would be described by the matrix [1/w, 0, 0, -1/h, 0,
An image can be placed on the output page in any position, orientation, and size by modifying the
current transformation matrix to map the unit square of user space to the rectangle or parallelogram
in which the image shall be painted. Typically, this is done within a pair of save/restore graphics
state operators to isolate the effect of the transformation, which can include translation, rotation,
reflection, and skew.
Please note that the content parser returns images as is. It is maybe required to mirror an image on
the x- or y-axis or to rotate it according to the current transformation matrix. DynaPDF does not
provide functions to manipulate images.
Helper functions
When extracting images it is usually required to create some kind of image file from the raw image
data that is returned by the content parser. The following helper functions can be used to create
image files:

Previous topic: Physical organization of images

Next topic: Vector Graphics