AlternateClip
IPDFDocument4 :: Page Operations :: Graphics

See Also Example
Collapse All

This method sets the current path as a clipping boundary using an even-odd rule.

Syntax

HRESULT AlternateClip ()
Return value
If successful, this method returns S_OK. If it fails, this method should return one of the error values.

Remarks

This method installs the current paths as the boundary for clipping subsequent drawings. The use of the clip operator may require some care, because it does not use the current path. Also note that there is no practical way of removing a clipping path, except by using SaveGraphicsState before clipping. This method uses an even-odd rule for defining the "path inside".

Example

How to Draw Text in a Clipped Region

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
{ create clip region as circle }
PDF.DrawCircle(70, 70, 50);
PDF.DrawCircle(90, 90, 40);
PDF.AlternateClip;
{ now region is clipped, draw text }
for i := 1 to 25 do
    PDF.ShowTextAt(10, 10*i, 'text text text text text text text text text');
PDF.SaveToFile('test.pdf', true);
C/C++
[copy to clipboard]
// PDF object is supposed to be created
// create clip region as circle
PDF->DrawCircle(70, 70, 50);
PDF->DrawCircle(90, 90, 40);
PDF->AlternateClip();
// now region is clipped, draw text
for (int i = 1; i < 25; i++)
    PDF->ShowTextAt(10, 10*i, "text text text text text text text text text");
PDF->SaveToFile("test.pdf", true);
C#
[copy to clipboard]
// PDF object is supposed to be created
// create clip region as circle
PDF.DrawCircle(70, 70, 50);
PDF.DrawCircle(90, 90, 40);
PDF.AlternateClip();
// now region is clipped, draw text
for (int i = 1; i < 25; i++)
    PDF.ShowTextAt(10, 10*i, "text text text text text text text text text");
PDF.SaveToFile("test.pdf", true);
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
' create clip region as circle
PDF.DrawCircle 70, 70, 50
PDF.DrawCircle 90, 90, 40
PDF.AlternateClip
' now region is clipped, draw text
For i = 1 To 25
    PDF.ShowTextAt 10, 10*i, "text text text text text text text text text"
Next
PDF.SaveToFile "test.pdf", true

See Also

Reference