The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Hunk on March 07, 2012, 03:54:49 AM

Title: Bitmap
Post by: Hunk on March 07, 2012, 03:54:49 AM
Hi,

I got a bitmap image and I want to remove the white portion outside the bitmap and want to make it transparent.  Can anyone provide me some example or idea how to do so? :U
Title: Re: Bitmap
Post by: dedndave on March 07, 2012, 04:16:25 AM
i use an icon editor - then save as a bmp, png, or gif
can you attach the image ?
Title: Re: Bitmap
Post by: Hunk on March 07, 2012, 05:30:51 AM
I attached jpg format. I hope you have no issue with it.  The main problem is white portion, but I want only image not that white portion around it.  While selecting image in winasm I only get bitmap option, not for png and gif formats...
Title: Re: Bitmap
Post by: dedndave on March 07, 2012, 08:39:44 AM
jpg's are lossy and hard to make transparencies from
but - that image is a png and is already a transparency   :bg

(http://www.masm32.com/board/index.php?action=dlattach;topic=18466.0;id=10402)
Title: Re: Bitmap
Post by: dedndave on March 07, 2012, 08:59:34 AM
notice the red circles

open the image to paste to (target) in one instance of Paint
open the transparency in another instance of Paint

in both instances, select a black background (circles at bottom)

in the instance that has the transpareny, click Edit - Select All
then Edit - Copy
on the left, click on the transparency mode icon (circle on left)

in the target instance, click Edit - Paste
on the left, click on the transparency mode icon (circle on left)

move the transparency around until you have it where you like and save the file   :U

click on the image below for full size
(http://img269.imageshack.us/img269/5904/transvt.png) (http://img269.imageshack.us/img269/5904/transvt.png)
Title: Re: Bitmap
Post by: qWord on March 07, 2012, 01:29:34 PM
If you want to show some parts of the images, you can create a control and set the window region according to the image data (http://www.masm32.com/board/index.php?topic=16579.msg137712#msg137712) (see my first and third post)
Title: Re: Bitmap
Post by: dedndave on March 07, 2012, 02:37:00 PM
i just noticed that the image has shading below the ball   :P
this is done with varying levels of transparency - a dib version 5 thing, i think
i would like to know if the Paint program for win 7 handles it correctly - i am using XP
Title: Re: Bitmap
Post by: fearless on March 07, 2012, 06:46:34 PM
pbrush for windows 7 allows transparent selection, but the dithered part at bottom of globe doesnt seem to show right, has a white halo type effect on it.
(http://img803.imageshack.us/img803/5480/pbrush2.jpg)
Title: Re: Bitmap
Post by: qWord on March 07, 2012, 07:11:39 PM
For Windows Vista or newer,  an alpha channel can be easily added to a window using the DwmEnableBlurBehindWindow  (http://msdn.microsoft.com/en-us/library/windows/desktop/aa969508(v=vs.85).aspx) function.
Eaxmple Attached.
(http://www.masm32.com/board/index.php?action=dlattach;topic=18466.0;id=10405)
Title: Re: Bitmap
Post by: dedndave on March 07, 2012, 08:21:46 PM
hmmmmm
have to write one for XP   :P

must be in there, already
when i posted the image, it renders correctly in FireFox
Title: Re: Bitmap
Post by: hfheatherfox07 on March 11, 2012, 11:28:45 PM
Quote from: dedndave on March 07, 2012, 08:21:46 PM
hmmmmm
have to write one for XP   :P

must be in there, already
when i posted the image, it renders correctly in FireFox


I found this http://code.google.com/p/max2aero/source/browse/?r=172#svn%2Ftrunk%2FDwmApi%253Fstate%253Dclosed

could the dwmapi.lib and dwmapi.def be used to make  dwmapi.inc so we can use this technique on windows XP ?
if anything I found AeroStyle.xml ... I remember some one looking for that ...but for got who
Title: Re: Bitmap
Post by: hfheatherfox07 on March 11, 2012, 11:36:35 PM
Is this something similar that I was trying to achieve here   http://www.masm32.com/board/index.php?topic=17505.0

To answer your original question Hunk ... try GIMP Portable... It is free and not pirated (even source available)  http://portableapps.com/apps/graphics_pictures/gimp_portable

under image options you could remove alpha blend ...or under edit remove all background ... I messed with .png's last night
Title: Re: Bitmap
Post by: dedndave on March 12, 2012, 01:20:28 AM
well - having the def file doesn't help
as qWord stated, Dwm is vista or newer