Transparent color when resize and rotate in VB6

Discussions about image processing and document imaging.
Post Reply
finn
Posts: 3
Joined: Thu Nov 08, 2007 11:06 am
Location: Singapore

Transparent color when resize and rotate in VB6

Post by finn » Sat Dec 08, 2007 7:49 am

Hi

I have some problems with the transparent color
when using the imaging to resize and rotate
It is just a simple bitmap drawing with white backcolor created in MS Paint


Call Imaging1.CreateImageFromPicture(Picture2.Picture)
Call Imaging1.ResizeImage(width, height, InterpolationModeHighQuality)
Call Imaging1.RotateAngleBackColor(Angle, White)

' Then loading the picture in to my windowless user control

MaskColor = &H80000005& ' (= White)
Picture = Imaging1.GetPicture
MaskPicture = Imaging1.GetPicture

Then the white color is not longer transparent

If I just load the picture direct then no problem to have the white color
transparent
MaskColor = &H80000005& ' (= White)
Picture = Picture2.Picture
MaskPicture = Picture2.Picture

It seems that the white color code is being changed
Anything I do wrong ??

Finn

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Post by Loïc » Fri Dec 14, 2007 4:55 pm

Hi finn.

The problem come from vb wich seems to doesn't support all the properties of the picture objects returned by the GDI+ API.

I can suggest you to proceed like that:

Code: Select all

Call Imaging1.CreateImageFromPicture(Picture2.Picture)
Call Imaging1.ResizeImage(Width, Height, InterpolationModeHighQuality)
Call Imaging1.RotateAngleBackColor(Angle, White)

' Then loading the picture in to my windowless user control
Call Imaging1.SaveAsBmp("tmpbitmap.tmp")
Imaging1.CloseNativeImage

MaskColor = &H80000005  ' (= White)
Picture = LoadPicture("tmpbitmap.tmp")
MaskPicture = Picture

Regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests