Keeping an image within an enclosed area

Just starting out? Need help? Post your questions and find answers here.
Grumble
User
User
Posts: 31
Joined: Sun Jun 15, 2003 8:44 pm

Keeping an image within an enclosed area

Post 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" ?
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

The image is appearing outside the image gadget when the image is larger than the image gadget??
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post 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
Berikco
Administrator
Administrator
Posts: 1326
Joined: Wed Apr 23, 2003 7:57 pm
Location: Belgium
Contact:

Post 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()
Grumble
User
User
Posts: 31
Joined: Sun Jun 15, 2003 8:44 pm

Post by Grumble »

Thanks Berikco, this one does the trick. :P
Post Reply