problem with image mask

View: New views
1 Messages — Rating Filter:   Alert me  

problem with image mask

by irashkin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
I'm trying to use a black and white gif as an image mask.  Included here is a snippet of the code which is creating a PDF for printing based on various input.
xImg below is a iTextSharp.text.Image, as is imask.
xRotate, xPos, yPos, yShift are all floats.
iDocument is an iTextSharp.text.Document.

If I do this, the image is positioned correctly and rotated correctly, but is not masked:
xImg.RotationDegrees = Math.Abs(xRotate);
xImg.SetAbsolutePosition(xPos, yPos + (xImg.Height - yShift));
iDocument.Add(xImg);


If I do this, no image appears at all:
xImg.RotationDegrees = Math.Abs(xRotate);
xImg.SetAbsolutePosition(xPos, yPos + (xImg.Height - yShift));
xImg.ImageMask = imask;
iDocument.Add(xImg);


But if I do this, I get two images - one in its proper place, not masked, and one at the test place (100,100), which IS masked!
xImg.RotationDegrees = Math.Abs(xRotate);
xImg.SetAbsolutePosition(xPos, yPos + (xImg.Height - yShift));
iDocument.Add(xImg);
xImg.ImageMask = imask;
xImg.SetAbsolutePosition(100, 100);
iDocument.Add(xImg);


Does anyone know why the second one is not rendering? It's like it just refuses to mask at the desired location (in fact, if I switch the above so the 100,100 is not masked and the real location is, i get no image at all!). And more importantly, anyone know how i can accomplish this? I am probably making some glaring error, but I'm a little fuzzy on the use of the image mask in iText, as is the documentation and even the In Action book.