Inserting 1 bitmap in to another

  • Thread starter Thread starter Stu
  • Start date Start date
S

Stu

Hi,

What is the quickest (performance wise) way to copy one small bitmap to
certain coordinates of a bigger bitmap? I'm currently doing it by looping
through each pixel....and I get the feeling I've missed something a little
more elegant!

Thanks in advance,

Stew
 
* "Stu said:
What is the quickest (performance wise) way to copy one small bitmap to
certain coordinates of a bigger bitmap? I'm currently doing it by looping
through each pixel....and I get the feeling I've missed something a little
more elegant!

\\\
Dim b1 As New Bitmap(...)
Dim b2 As New Bitmap(...)
Dim g As Graphics = Graphics.FromImage(b1)
g.DrawImage(b2, ...)
g.Dispose()
b1.Save(...)
b1.Dispose()
b2.Dispose()
///
 
What's wrong with DrawImage?

\\\\\\\\\\
Function StampImage(ByVal Source As Image, ByVal Stamp As Image, Coord as
Point) As Image
Dim NewBmp As New Bitmap(Source)
Dim NewGraphics As Graphics = Graphics.FromImage(NewBmp)
NewGraphics.DrawImage(Stamp, Coord )
Return NewBmp
End Function
//////////
 
Watch yourself here, though. This knida stuff can become extremely amusing,
and many hours can be wasted tinkering the GDI+ namespace. It really needs
some kind of restricted access/parental gudiance/disclaimer thingy to be
smacked on the front of it.

Terribly addictive stuff that... so be warned.

Richard
 
And only now you tell me about it... after i've spent so many hours playing
around with it...
I feel betrayed.. :(

Andre Nogueira
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top