Le 16 juil. 06 à 04:07 Matin, CV a écrit:

On Jul 15, 2006, at 6:34 AM, Christian Miller wrote:

Is it possible to obtain the contents of a canvas and place it back into a Picture object? Sort of the opposite of double- buffering. Without knowing what has been drawn on the canvas, I want to take a "snapshot" of what the canvas few. I hope that makes sense, I don't feel like I'm explaining myself correctly.


  The only way would be to bit map it:


  dim p as picture = newPicture(Canvas1.Width, Canvas1.Height, 32)
  dim Surf as RGBSurface = p.RGBSurface
  dim h as integer
  dim v as integer

  dim hmin as integer = Window1.Left + Canvas1.Left
  dim vmin as integer = Window1.Top + Canvas1.Top
  dim hmax as integer = hmin + Canvas1.Width
  dim vmax as integer = vmin + Canvas1.Height

  For h = hmin to hmax
    For v =vmin to vmax
      Surf.Pixel(h - hmin, v - vmin) = system.Pixel(h, v)
    Next v
  Next h

// p contains an image of Canvas1

I think it won't work if another window is in front of the one containing the canvas while the code is running.
But you can use DrawInto instead of System.Pixel, 
no?_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to