Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Fedor  
#1 Posted : Wednesday, November 29, 2006 11:37:00 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
Alpha channel can be corrupted when drawing on bitmaps that have 32-bit ARGB pixel format.

Description

If you attempt to draw on a bitmap with Format32bppArgb pixel format using the

Aurigma.GraphicsMill.Drawing.GdiGraphics class, the alpha channel is not processed correctly. As a result, graphics you draw is invisible or it is looking like a "hole" in the image (i.e. pixels modified by GDI are fully transparent).

Reason

Aurigma.GraphicsMill.Drawing.GdiGraphics class uses GDI to draw graphics. GDI does not support the alpha channel. It does support 32-bit RGB pixel format, but the high-order byte, that contains alpha channel value in ARGB, is used only to align stored pixel values to DWORD (4-byte unit). From the point of view, this byte always contains trash, so it always writes a zero value (0) there. But from the point of view of Graphics Mill, it means that pixels which GDI has modified while drawing are always transparent.

To avoid this, you should not use the Aurigma.GraphicsMill.Drawing.GdiGraphics class to draw anything on bitmaps with the 32-bit ARGB pixel format. Of course, you can still use this class with such bitmaps if you copy the alpha channel somewhere before drawing and then set it back for the resulting bitmap, but it is not good idea - you will have to write extra code, and it will work noticeable slower. Instead of it you should solve this problem in one of these ways:

  1. Use Aurigma.GraphicsMill.Drawing.GdiGraphics either with 32-bit RGB (Format32bppRgb) or 24-bit RGB (Format24bppRgb) bitmaps. Even if you will need to work with alpha channel, you can always add it later using the bitmap.Channels.AddAlpha method call.

  2. Use System.Drawing.Graphics instead of the Aurigma.GraphicsMill.Drawing.GdiGraphics. In other words, draw using GDI+ instead of GDI. GDI+ was designed to support alpha channel, so you will not have this problem with it.

Notes

This problem is related to Graphics Mill 3.x for .NET. All further version are throwing an exception when you attempt to draw anything on 32-bit ARGB bitmaps using GDI.

Edited by moderator Sunday, June 10, 2012 9:07:44 PM(UTC)  | Reason: Not specified

Best regards,

Fedor Skvortsov

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.