ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Roate and keep background transparent

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
chukkan Posted - Nov 04 2015 : 00:25:02
Hello there,
just trying to learn this wonderful component. How to rotate an image while keeping the background transparent?

Thanks in advance
1   L A T E S T    R E P L I E S    (Newest First)
w2m Posted - Nov 04 2015 : 07:42:04
What file types are you rotating? Are you loading bitmaps? If so then convert the bitmaps to png then rotate will maintain the alphachannel or if loading BMP 32 bits per pixel set BMP_HandleTransparency to true. When BMP_HandleTransparency is true the extra byte is interpreted as an alpha channel, otherwise it is just ignored. So if BMP_HandleTransparency = True the image will be displayed in ImageEn with transparency. Whereas if BMP_HandleTransparency = False the transparent color will not be used.
// if BMP_HandleTransparency = true then display with transparency
ImageENVect1.IO.Params.BMP_HandleTransparency := chkBMPHandleTransparency.Checked;
ImageENVect1.IO.LoadFromFile( FilePath );

if this does not work, then convert the image to 32-bit png and set the transparent color:
var
iRGB: TRGB;
ImageEnView1.IO.Params.BitsPerSample := 8;
ImageEnView1.IO.Params.SamplesPerPixel := 4;
iRGB := ImageEnView1.IEBitmap.Pixels[0, ImageEnView1.IEBitmap.Height - 1];
ImageEnView1.Proc.SetTransparentColors(iRGB, iRGB, 0);

Generally it is best to use png image files when using transparency.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development