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

DynaPDF Manual - Page 138

Previous Page 137   Index   Next Page 139

Function Reference
Page 138 of 750
ApplyShading
Syntax:
SI32 pdfApplyShading(
const PPDF* IPDF, // Instance pointer
SI32 ShadHandle)
// Handle of the shading
This function applies a shading to the current clipping path, or if no clipping is active, to the entire
page. See also CreateAxialShading(), CreateRadialShading().
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.
Example (C):
// First we declare our error callback function
SI32 PDF_CALL PDFError(const void* Data, SI32 ErrCode, const char*
ErrMessage, SI32 ErrType)
{
printf("%s\n", ErrMessage);
return 0;
}
int main(int argc, char* argv[])
{
SI32 sh;
void* pdf = pdfNewPDF();
if (!pdf) return 2; // Out of memory?
pdfSetOnErrorProc(pdf, NULL, (void*)PDFError);
pdfSetDocInfo(pdf, diAuthor, "Jens Boschulte");
pdfSetDocInfo(pdf, diCreator, "C sample project");
pdfSetDocInfo(pdf, diSubject, "How to use shadings");
pdfSetDocInfo(pdf, diTitle, "Shadings");
// we use top-down coordinates
pdfSetPageCoords(pdf, pcTopDown);
pdfCreateNewPDF(pdf, "c:/cppout.pdf");
pdfAppend(pdf);
pdfSaveGraphicState(pdf);
pdfBeginClipPath(pdf);
pdfRectangle(pdf, 50, 50, 200, 30, fmNoFill);
pdfClipPath(pdf, cmWinding, fmFill);
sh = pdfCreateAxialShading(pdf, 50, 0, 250, 0, 1.5, PDF_WHITE,
PDF_BLUE, false, false);
pdfApplyShading(pdf, sh);
pdfRestoreGraphicState(pdf);
 

Previous topic: ApplyPattern

Next topic: AssociateEmbFile