This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Transparency Questions

Hi There,

We have been using Graphics Mill for a proof of concept. Our problem is that we need to combine 4 trapezoidal images together as one i.e. as a box/frame when you piece them together.

To do this, we have first constructed the rectangles and are then using the Combiner class and applying a mask to get the trapeziums required. Sample code for this is below:

method is passed the Bitmap called 'side' and then:

Aurigma.GraphicsMill.Bitmap mask = side.GetEmptyMask();
Aurigma.GraphicsMill.Drawing.GdiGraphics g = mask.GetGdiGraphics();
Aurigma.GraphicsMill.Drawing.SolidBrush brush = new Aurigma.GraphicsMill.Drawing.SolidBrush();
brush.Color = Aurigma.GraphicsMill.RgbColor.White;
System.Drawing.Point[] points = { 
	new System.Drawing.Point(0, 0),
	new System.Drawing.Point(side.Width, 0),
	new System.Drawing.Point(side.Width - side.Height, side.Height),
	new System.Drawing.Point(side.Height, side.Height)
				};
g.FillPolygon(brush, points);

Aurigma.GraphicsMill.Transforms.Combiner c = new Aurigma.GraphicsMill.Transforms.Combiner();
Aurigma.GraphicsMill.Bitmap maskResult = new Aurigma.GraphicsMill.Bitmap(side.Width, side.Height, side.PixelFormat);
c.CombineMode = Aurigma.GraphicsMill.Transforms.CombineMode.Alpha;
c.SourceBitmap = side;
c.ApplyMaskTransform(maskResult, mask);

return maskResult;


This seems to be working correctly for us, which is great - from this we can generate 4 trapezium shapes i.e. rectangles with 2 trianglar pieces sliced off. Or so it seems - the images which are produced have a trapezoidal shape of the image we require and then two black triangles (which we believe are transparent).

The problem is that then, we need to combine the 4 sides and we do this by using the following code similar to the following:

method is passed bitmaps topSide, leftSide, rightSide and bottomSide and then...

Aurigma.GraphicsMill.Bitmap final = new Aurigma.GraphicsMill.Bitmap(workingBitmap);

final = drawBitmapOnBitmap(topSide, final, 0, 0);
final = drawBitmapOnBitmap(leftSide, final , 0, 0);
final = drawBitmapOnBitmap(rightSide, final , topSide.Width - rightSide.Width, 0);
final = drawBitmapOnBitmap(bottomSide, final , 0, leftSide.Height - bottomSide.Height);


where draw bitmap effectively does the following:

sourceBitmap.Draw(destinationBitmap, destinationX, destinationY, sourceBitmap.Width, sourceBitmap.Height, Aurigma.GraphicsMill.Transforms.CombineMode.Alpha, 1.0f, Aurigma.GraphicsMill.Transforms.InterpolationMode.LowQuality);[/code]

This works fine except for the fact that on the combined image, the black from the trapezium images shows up AS BLACK. i.e. it covers other parts of images whic it should be letting show through. We were expecting to black to be transparent when combined in this way but it is not - it's solid black. Are we missing something here.. or is the whole approach (i.e. using Combine with Mask and then combining with Draw) wrong to begin with?

Many Thanks in Advance for your help!
Hello,

I have replied to you by email.
Many Thanks Dmitry,

Unfortunately, it seems I did not receive your reply email. Would you possibly be able to post what you wrote here?

Many Thanks!
Hello,

Thanks for your interesting to our software.

Could you submit case with complete sample project which reproduces your problem and we will try to find solution?
Dmitry,

Many thanks in advance for your help with this. I have now sent you an email with a project named 'Box Example' in it for you to take a look at.

Kind Regards,
Tristan
Hello,

Unfortunately we have not received your email. Could you forward copy to [email removed]?
Dear Dmitry,

Sorry about that - I've now tried resending to your own email address and I sent from two different email addresses in case it was a problem from the sending mail server. Please let me know if you don't receive this within about 30 minutes and I will resend again.

Kind Regards,
Tristan
Hi Dmitry,

Can you please confirm that you got the email I sent with the example project? - I've tried sending a couple of times now to [email removed].

Many Thanks!
Tristan
Hello,

Thanks, I have received the email. I will reply as soon as possible.
Dmitry,

Thank you so much for the OUTSTANDING level of support you gave on this. The code changes you suggested have carried out exactly what we needed to be able to do and within the target time. We really couldn't have asked for a better level of support.

I just need to check - to use this on a single-server based website, do we need one single server licence at $349?

Many Thanks!!
Tristan