PDF Creator Pilot documentation |
Download CHM version of this manual. |
|
![]() ![]() Collapse AllInserts a masked image from a file into a PDF document and returns the index of the image.
|
| LONG AddImageWithColorMask ( BSTR fileName, OLE_COLOR colorMask ) |
Parameters
fileName
Path to the image file.
colorMask
Color which marks points that need to be transparent.
Return value
New image index. If there is more then one image in a file then method returns index of a last added image.
Remarks
colorMask parameter is a double word (4 bytes) value 0x00BBGGRR. The low-order byte contains a value for the relative intensity of red; the second byte contains a value for green; and the third byte contains a value for blue. The high-order byte must be zero.
The return value is an image identifier in document's images collection and can be used in FlipImage, GetImageHeight, GetImageResolution, GetImageWidth, MakeImageGrayScale, MakeImageNegative, PlaceImageToCurrentPage, PDFPAGE_ShowImage.
Analogue in new interface: IPDFDocument4::AddImageWithColorMask.
Example
How to load image with color mask
Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.BeginDoc;
clr := 255; { 255=x0000FF - red color }
j := PDF.AddImageWithColorMask('picture.gif', clr);
PDF.PDFPAGE_ShowImage(j, 0, 0, 122, 89, 0);
PDF.EndDoc;
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->BeginDoc();
COLORREF clr = RGB(0xFF, 0, 0); // red color
LONG j = PDF->AddImageWithColorMask("picture.gif", clr);
PDF->PDFPAGE_ShowImage(j, 0, 0, 122, 89, 0);
PDF->EndDoc();
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.BeginDoc();
int clr = System.Drawing.ColorTranslator.ToWin32(Color.Red);
long j = PDF.AddImageWithColorMask("picture.gif", clr);
PDF.PDFPAGE_ShowImage(j, 0, 0, 122, 89, 0);
PDF.EndDoc();
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.BeginDoc
clr = 255 '255=0x0000FF - red color
j = PDF.AddImageWithColorMask("picture.gif", clr)
PDF.PDFPAGE_ShowImage j, 0, 0, 122, 89, 0
PDF.EndDoc
See Also


