Inserting 1 bitmap in to another

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stu

    Inserting 1 bitmap in to another

    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



  • Herfried K. Wagner [MVP]

    #2
    Re: Inserting 1 bitmap in to another

    * "Stu" <s.lock@cergis. com> scripsit:[color=blue]
    > 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![/color]

    \\\
    Dim b1 As New Bitmap(...)
    Dim b2 As New Bitmap(...)
    Dim g As Graphics = Graphics.FromIm age(b1)
    g.DrawImage(b2, ...)
    g.Dispose()
    b1.Save(...)
    b1.Dispose()
    b2.Dispose()
    ///

    --
    Herfried K. Wagner [MVP]
    <URL:http://dotnet.mvps.org/>

    Comment

    • Mick Doherty

      #3
      Re: Inserting 1 bitmap in to another

      What's wrong with DrawImage?

      \\\\\\\\\\
      Function StampImage(ByVa l Source As Image, ByVal Stamp As Image, Coord as
      Point) As Image
      Dim NewBmp As New Bitmap(Source)
      Dim NewGraphics As Graphics = Graphics.FromIm age(NewBmp)
      NewGraphics.Dra wImage(Stamp, Coord )
      Return NewBmp
      End Function
      //////////

      --
      Mick Doherty



      "Stu" <s.lock@cergis. com> wrote in message
      news:uH$JsI9SEH A.1768@TK2MSFTN GP10.phx.gbl...[color=blue]
      > 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
      >
      >
      >[/color]


      ---
      Outgoing mail is certified Virus Free.
      Checked by AVG anti-virus system (http://www.grisoft.com).
      Version: 6.0.693 / Virus Database: 454 - Release Date: 31/05/2004


      Comment

      • spamfurnace

        #4
        Re: Inserting 1 bitmap in to another

        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


        Comment

        • Andre Nogueira

          #5
          Re: Inserting 1 bitmap in to another

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

          Andre Nogueira

          "spamfurnac e" <bitemybum@tast ycheeks.com> wrote in message
          news:uE2$WGCTEH A.3968@TK2MSFTN GP09.phx.gbl...[color=blue]
          > Watch yourself here, though. This knida stuff can become extremely[/color]
          amusing,[color=blue]
          > 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
          >
          >[/color]


          Comment

          Working...