Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, August 28, 2007 9:38:18 PM(UTC)

manju  
manju

Groups: Registered
Posts: 49


Hi,

Please find the attached image,if I load that in picturebox then it appear as only red colored star shape but if I load it in rasterImageViewer it display white color in place of transparent edges.So how should I get the same effect as picturebox in rasterImageViewer.I am using leadtools 15 and c# .net.Please reply soon.

Thanks
manju
manju attached the following image(s):
mpct_socket_star_fill.gif
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, August 29, 2007 10:19:06 AM(UTC)

jigar  
Guest

Groups: Guests
Posts: 3,040

Was thanked: 1 time(s) in 1 post(s)

Hello Manju,

The RasterImageViewer does not support transparency. We do have a simple work around for it though. All we have to do it create a region of the image where it is supposed to be transparent, and fill in the background color of the container into that region. So if we use your GIF image, it would be the white area that needs to be transparent.First we need to load the image as 24 bits/pixel. If we load it as the default (8 bits/pixel), it won't be able to do the transparency correctly.

RasterImage image = codecs.Load("star.gif", 24, CodecsLoadByteOrder.BgrOrGray, 1, 1);

Define the region which needs to be transparent

image.AddColorToRegion(new RasterColor(Color.White), RasterRegionCombineMode.Set);

The first parameter to AddColorToRegion specifies which color to make transparent. The second parameter is if you have multiple regions, they would need to be combined.

FillCommand fillCmd = new FillCommand();
fillCmd.Color = new RasterColor(rasterImageViewer1.BackColor);
fillCmd.Run(image);

The above statments create a FillCommand to fill the RasterImage with the RasterColor that you specify, in this case we are using the RasterImageViewer's background color. After that you assign the Image to the RasterImageViewer and it will display as if it was transparent.

Finally, this process modifies the image so you should keep a back up of your RasterImage. If you try to save the modified image to a GIF you need to make sure you specify 8 bits/pixel.

Update by moderator:
In addition to the technique described above, the current version of LEADTOOLS now support painting with alpha-channel transparency directly by using GDI+ rendering.

Edited by moderator Thursday, October 20, 2016 9:45:59 AM(UTC)  | Reason: Not specified

 
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.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.165 seconds.