22.03.2015 Views

DLI Implementation and Reference Guide - Datalogics

DLI Implementation and Reference Guide - Datalogics

DLI Implementation and Reference Guide - Datalogics

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Containers within Pages 7.5<br />

Areas<br />

If your composition engine describes lines as being members of an area <strong>and</strong> positions<br />

within that area, then you may want to create a container for each area, <strong>and</strong> distort it<br />

to match your definition of an area:<br />

"C" Example: Container within an Area<br />

void WritePage (DLPDFDOC *Doc, ASFixed Width, ASFixed Depth,<br />

areadata *AreaData)<br />

{<br />

DLPDFPAGE *Page = dlpdfdoccreatepage (Doc, Width, Depth);<br />

areadata *CurrentArea = AreaData;<br />

ASFixedMatrix Matrix;<br />

while (AreaData)<br />

{<br />

DLPDFCONTENT *Content = dlpdfcontentcreate (Doc);<br />

/* Calculate rotated lower left corner */<br />

Matrix.a = Matrix.d = fixedOne;/* Unity Matrix */<br />

Matrix.b = Matrix.c = 0;<br />

/* Translate the matrix to the lower left corner of the<br />

* area to be rotated */<br />

Matrix.h = AreaData->X;<br />

Matrix.v = Depth - AreaData->Y - AreaData->Depth;<br />

/* Rotate the matrix to the desired angle */<br />

dlpdfmatrixrotate (&Matrix, AreaData->Rotation);<br />

/* Translate the width <strong>and</strong> depth of the area to the<br />

* desired angle */<br />

Point.h = AreaData->Width;<br />

Point.v = AreaData->Depth;<br />

FixedMatrixTransform (&Point, &Matrix, &Point);<br />

/* Translate to the upper left corner of the rotated area */<br />

dlpdcontenttranslate (Content,<br />

Point.h - AreaData->Width,<br />

Point.v - AreaData->Depth);<br />

dlpdfcontentrotate (Content, AreaData->Rotation);<br />

WriteLines (AreaData->UserData, Content);<br />

dlpdfcontenttopage (Content, Page);<br />

}<br />

AreaData = AreaData->Next;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!