Giuseppe,

  There is no built-in way to make a copy of an image; renaming it just
makes a new reference, and the simplest way is to load the image file
twice.  The memory overhead is exactly the same as if you were to make a
copy, so don't feel like it is being inefficient.

An alternative that might work in some cases is to use a canvas.  If you
add an image to a canvas and Draw() the canvas, the image will imprint on
the canvas.  Then, if you move the image and Draw() again, the first
imprint will remain and the new one will appear too.

You can also use a canvas to make a copy of an image.  A new function (I
haven't tested it) something like this should do the trick in most
situations:

define CopyImage(img)
{
  canv <- MakeCanvas(MakeColor("black"),img.width,img.height)
  AddObject(img,canv)
  Move(img,canv.width/2,canv.height/2)
  Draw(canv)
  RemoveObject(img,canv)
  return canv
}

 It may behave differently from an image in a few situations that you
probably never use--if you add another image, shape, etc. to it, it might
not reset to the original image.  This is probably a capability you
aren't using, so it should be fine. It is not clear to me that this would
be any simpler than just loading the image file twice, but it could in
some cases.

Shane

> Hi Shane,
> how can I draw an image:
>         gStim <- MakeImage("file.bmp")
>
> in different positions of the gWin? Of course this doesn't work:
>
>         AddObject(gStim,gWin)
>         Move(gStim,gVideoWidth/2, gVideoHeight/2-200)
>         Draw()
>         imagebottom <- gStim
>         Move(imagebottom,gVideoWidth/2, gVideoHeight/2+200)
>            AddObject(imagebottom,gWin)
>         Draw()
>
> How can really copy the complex object gStim without make also:
> imagebottom <-  MakeImage("file.bmp") ????
>
> Thanks in advance and best regards,
>
> --
> Giuseppe Cabras, PhD - Chemistry, Physics and Environment Dept.
> InterUniversity Center for Behavioral Neurosciences http://icbn.uniud.it
> University of Udine - via delle Scienze, 206 - 33100 UDINE
> Phone: +39-043255-8212 - Fax:   +39-043255-8222
> SMS:                     http://www.fisica.uniud.it/cabras/SMS.html
> URL:                     http://people.uniud.it/page/giuseppe.cabras
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics
> Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk_______________________________________________
> Pebl-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pebl-list
>



------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Pebl-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pebl-list

Reply via email to