473,396 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Big problem Overlaying two bitmaps

I have 2 1bppindexed bitmaps and i want to combine both together. I
converted both to 24bpp then tried to combine them but it didnt work. If
possible i want to be able to draw one bitmap directly on top of the
other and would be really good if i only had to use one 24bpp bitmap to
do this.Below is a way to map draw a 1bpp bitmap onto a 24bpp
one.....would it be possible to draw my second bitmap on the same
one?.....some pixels overlap as well so i need to set a value for those
pixels too.....any ideas?
Bitmap onebit=(Bitmap)Image.FromFile("theimagefile");
Bitmap bm=new Bitmap(onebit.Width, onebit.Height,
PixelFormat.Format24bppRGB);
Graphics g=Graphics.FromImage(bm);
g.DrawImage(onebit,new
Rectangle(0,0,onebit.Width,onebit.Height),0,0,oneb it.Width,onebit.Height
,Gra
phicsUnit.Pixel);
g.dDispose();

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
3 4390
Are you trying to overlap two images so that one shows thru the other - a
trick with the image's alpha property?

"James Dean" wrote:
I have 2 1bppindexed bitmaps and i want to combine both together. I
converted both to 24bpp then tried to combine them but it didnt work. If
possible i want to be able to draw one bitmap directly on top of the
other and would be really good if i only had to use one 24bpp bitmap to
do this.Below is a way to map draw a 1bpp bitmap onto a 24bpp
one.....would it be possible to draw my second bitmap on the same
one?.....some pixels overlap as well so i need to set a value for those
pixels too.....any ideas?
Bitmap onebit=(Bitmap)Image.FromFile("theimagefile");
Bitmap bm=new Bitmap(onebit.Width, onebit.Height,
PixelFormat.Format24bppRGB);
Graphics g=Graphics.FromImage(bm);
g.DrawImage(onebit,new
Rectangle(0,0,onebit.Width,onebit.Height),0,0,oneb it.Width,onebit.Height
,Gra
phicsUnit.Pixel);
g.dDispose();

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #2
yes how is this done?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #3
Hi James,

That's pretty simple. :)

1. First create the intial bitmap object based on the actual image.
2. Now create a new bitmap object based on the second image. Apply a
ColorMatrix setting the required value of alpha, and then draw this bitmap
upon the first bitmap using the appropriate overload of the DrawImage method.

There is an article on using implementing the apha effect which would give
you a good idea on using the colormatrix etc. @ codeproject:
http://www.codeproject.com/cs/media/alphafx.asp

PS: I wonder whether you will miss this post :(..sorry i had been off to sleep

HTH,
Rakesh

"James Dean" wrote:
yes how is this done?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Brad Smalling | last post by:
Does anyone know if there is a reason to prefer bitmaps over icons (or vice-versa) when populating image lists? I've always favored icons because of their built-in transparency (although I've...
2
by: wooks | last post by:
I have designed a form whereby the bottom right hand corner of each field is overlayed with text that act as a caption for the field. As an example see the background labels in this article...
1
by: Mark Evans | last post by:
I have a dialog box and on it I want to display a bitmap, which will change at various times during the program. My problem is that the bitmaps will not be the same each time. I want the user to...
4
by: Nathan | last post by:
Hello, I'm needing some advice: I have an app for which I've built a timer out of multiple bitmaps--a clock with a moving hands. I've saved each hand position (1 second, 2 seconds, etc.) as a...
1
by: John | last post by:
I have 76 bitmaps (640 x 480) and need to combine them together to form a big one (about 3840 x 2880). Those 76 bitmaps overlap each other with a small portion. Is there any way to do it? Thanks.
2
by: Mike | last post by:
Hello everybody. I am drawing a country map that consists of 149 municipality bitmaps, each around 25 Kb. I draw it onto the in-memory bitmap, then draw it on the picture box. I use C++, but...
1
by: nkumarin001 | last post by:
Hi, Can anyone help me in this matter:- When i was studying locally managed tablespaces i came across bitmaps that are used in locally managed tablespaces it stated that:- "Locally...
0
by: Sirus86 | last post by:
problem with text and image.Text is overlaying or moving to below image. i design is very complex and i need to include a scroll within the design. this is what i have so far div id="content" ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.