



Collapse All
Syntax| LONG AddUnColoredPattern ( PatternTilingType tilingType, ColorSpaceType type ) |
Remarks
Example{ PDF object is supposed to be created }
pattern := PDF.AddUnColoredPattern(pttConstantSpacing, cstDefaultRGB);
PDF.SwitchToPattern(pattern);
PDF.PageHeight := 5;
PDF.PageWidth := 5;
PDF.SetColorSpaceType(cstDefaultRGB);
PDF.SetColor(1, 0, 0, 0); { this call will be ignored, as we compose uncolored pattern }
PDF.DrawCircle(2, 2, 2);
PDF.FillAndStroke;
PDF.SwitchToCurrentPage;
PDF.SetPattern(pattern);
{ now all paths will be filled with created pattern }
PDF.SetColor(0, 1, 0, 0);
helvetica := PDF.AddBuiltInFont(bfHelveticaBoldOblique, false, false);
PDF.UseFont(helvetica, 28);
PDF.ShowTextAt(50, 50, 'Uncolored Pattern colored green');
PDF.SetColor(0, 0, 1, 0);
PDF.ShowTextAt(50, 100, 'Same Pattern colored blue');
{ back to simple filling }
PDF.SetColorSpaceType(cstDefaultRGB);
PDF.SetColor(0, 0, 0, 0);
PDF.ShowTextAt(50, 150, 'Usual text');
PDF.SaveToFile('test.pdf', true);
// PDF object is supposed to be created
long pattern = PDF->AddUnColoredPattern(pttConstantSpacing, cstDefaultRGB);
PDF->SwitchToPattern(pattern);
PDF->PageHeight = 5;
PDF->PageWidth = 5;
PDF->SetColorSpaceType(cstDefaultRGB);
PDF->SetColor(1, 0, 0, 0); //this call will be ignored, as we compose uncolored pattern
PDF->DrawCircle(2, 2, 2);
PDF->FillAndStroke();
PDF->SwitchToCurrentPage();
PDF->SetPattern(pattern);
// now all paths will be filled with created pattern
PDF->SetColor(0, 1, 0, 0);
long helvetica = PDF->AddBuiltInFont(bfHelveticaBoldOblique, false, false);
PDF->UseFont(helvetica, 28);
PDF->ShowTextAt(50, 50, "Uncolored Pattern colored green");
PDF->SetColor(0, 0, 1, 0);
PDF->ShowTextAt(50, 100, "Same Pattern colored blue");
// back to simple filling
PDF->SetColorSpaceType(cstDefaultRGB);
PDF->SetColor(0, 0, 0, 0);
PDF->ShowTextAt(50, 150, "Usual text");
PDF->SaveToFile("test.pdf", true);
// PDF object is supposed to be created
long pattern = PDF.AddUnColoredPattern(PatternTilingType.pttConstantSpacing, ColorSpaceType.cstDefaultRGB);
PDF.SwitchToPattern(pattern);
PDF.PageHeight = 5;
PDF.PageWidth = 5;
PDF.SetColorSpaceType(ColorSpaceType.cstDefaultRGB);
PDF.SetColor(1, 0, 0, 0); //this call will be ignored, as we compose uncolored pattern
PDF.DrawCircle(2, 2, 2);
PDF.FillAndStroke();
PDF.SwitchToCurrentPage();
PDF.SetPattern(pattern);
// now all paths will be filled with created pattern
PDF.SetColor(0, 1, 0, 0);
long helvetica = PDF.AddBuiltInFont(BuiltInFont.bfHelveticaBoldOblique, false, false);
PDF.UseFont(helvetica, 28);
PDF.ShowTextAt(50, 50, "Uncolored Pattern colored green");
PDF.SetColor(0, 0, 1, 0);
PDF.ShowTextAt(50, 100, "Same Pattern colored blue");
// back to simple filling
PDF.SetColorSpaceType(ColorSpaceType.cstDefaultRGB);
PDF.SetColor(0, 0, 0, 0);
PDF.ShowTextAt(50, 150, "Usual text");
PDF.SaveToFile("test.pdf", true);
' PDF object is supposed to be created pattern = PDF.AddUnColoredPattern(1, 1)' pttConstantSpacing, cstDefaultRGB PDF.SwitchToPattern pattern PDF.PageHeight = 5 PDF.PageWidth = 5 PDF.SetColorSpaceType 1 'cstDefaultRGB PDF.SetColor 1, 0, 0, 0 ' this call will be ignored, as we compose uncolored pattern PDF.DrawCircle 2, 2, 2 PDF.FillAndStroke PDF.SwitchToCurrentPage PDF.SetPattern pattern ' now all paths will be filled with created pattern PDF.SetColor 0, 1, 0, 0 helvetica = PDF.AddBuiltInFont(9, false, false) 'bfHelveticaBoldOblique PDF.UseFont helvetica, 28 PDF.ShowTextAt 50, 50, "Uncolored Pattern colored green" PDF.SetColor 0, 0, 1, 0 PDF.ShowTextAt 50, 100, "Same Pattern colored blue" ' back to simple filling PDF.SetColorSpaceType 1 'cstDefaultRGB PDF.SetColor 0, 0, 0, 0 PDF.ShowTextAt 50, 150, "Usual text" PDF.SaveToFile "test.pdf", true
See Also