Page 1 of 1

Keeping an image within an enclosed area

Posted: Tue Dec 23, 2003 9:36 pm
by Grumble
Most programming languages have a "gadget" to keep an image within a limited area of a window (i.e. "picturebox" in Visual Basic, or "canvas" in rapidq) so that if an image doesn't fit inside the defined area the part that doesn't fit is not displayed.
I can't figure out how to do this is Purebasic and it's image and ImageGadget commands; if I load a large picture it always covers the whole window and the gadgets inside it.
Anyone knows how to define such a "drawing-area" ?

Posted: Tue Dec 23, 2003 9:51 pm
by Karbon
The image is appearing outside the image gadget when the image is larger than the image gadget??

Posted: Tue Dec 23, 2003 9:55 pm
by Num3
I guess it is because you're using the same image size in the imagegadget...

try changing imagegadget(0,x,y,w,h,pic) <- after loading the picture

Posted: Tue Dec 23, 2003 10:12 pm
by Berikco
use a containergadget to hold the imagegadget
Even if imagegadget is bigger than container, it will be clipped

Code: Select all

      ContainerGadget(#Container_0, 90, 100, 440, 340)
      ImageGadget(#Image_0, 0, 0, 640, 480, Image0)
      CloseGadgetList()

Posted: Tue Dec 23, 2003 10:24 pm
by Grumble
Thanks Berikco, this one does the trick. :P