Transparent bitmaps

If you are a C/C++/C# developer and have any questions about using our products from your application here is the place to post them.
Post Reply
ryanfure
Posts: 8
Joined: Thu Jan 06 2005
Location: Wisconsin

Transparent bitmaps

Post by ryanfure »

Hello,

I am using the PDFCreator Active X controls and am trying to overlay two bitmap images on a pdf document with the top bitmap being transparent. I have tried making the bitmap itself transparent but the background still is covering up the bottom bitmap. Is there a way to set the top bitmap as transparent with the PDF Creator so that the bottom bitmap can be seen?
beandog
Posts: 33
Joined: Wed Dec 14 2005

If you only need one color transparent:

Post by beandog »

If you only need to have one color transparent (have all the black on your image be transparent instead), you can set the RGBMask property of the image. I create such an image in code like this:

//Create the object
CString csName = GetNextTickMarkName();
pView->PDF.CreateObject(CPDFCreactiveX::acObjectTypePicture, csName);

//Get a handle to the object
CacObject o = pView->PDF.GetObjectByName(csName);

//Move it into position:
o.put_Attribute("Left", COleVariant(lLeft));
o.put_Attribute("Top", COleVariant(lTop));
o.put_Attribute("Right", COleVariant(lRight));
o.put_Attribute("Bottom", COleVariant(lBottom));

//Load the image:
o.put_Attribute("FileName", COleVariant(csTemp));

//Make white be transparent (color is in ARGB format):
o.put_Attribute("RGBMask", COleVariant((long)0x00ffffff));

//And make sure the image is redrawn with the new mask:
pView->PDF.RedrawRect(lLeft, lTop, lRight, lBottom);

Works for me.



Ben Dilts
Post Reply