So frustrating!
#12
(03-09-2023, 10:36 PM)PhilOfPerth Wrote: Is it ok to have a file with maybe 20 images in it, but only have oneĀ image-handle, and attach a different picĀ  each time? and if so, when do I need to use _FreeImage?

You can have one file with 20 images or any number of images, but for sanity's sake one "picture within a picture" inside the image should be the same size as the others. You load it with _LOADIMAGE like you just did in your program, then to select the picture you want to show you use _PUTIMAGE. You have to figure out the coordinates for the (top, left) and (bottom, right) of the "big" picture to get the "little" picture, then use _PUTIMAGE to display it on the screen to show the user.

The little pictures could be of various sizes but it could be confusing if you don't know where one picture begins and ends. Windows Paint could be used to help figure out the coordinates but it could be tedious panning around in the picture and having to write row and column integers somewhere else.

If you load one picture you only need to call _FREEIMAGE to affect that picture. If you create an array of 20 LONG variables and each one sets its value with a call to _LOADIMAGE or _NEWIMAGE (except if it fails by returning -1), you have to call _FREEIMAGE for each array element. However you have to make sure the handle is not the active display, it's not set by _DEST or QB64(PE) would give you an error saying it cannot get rid of the active screen.

The "256" as the last parameter to _LOADIMAGE or _NEWIMAGE is called "8-bit color", it's just a term, it only offers 256 colors. It's "SCREEN 13" in your earlier programming days with QuickBASIC or QBasic, but you could change the dimensions from 320x200 now considered too small for the really large screens that are the rage these days, at least in the U.S.A. LOL. The "32" is for at least 16MB colors, which requires using _RGB() like bplus just said. The "33", well, erm, ah... you could search for it for the dozens of times Steve got up to explain it. Smile
Reply


Messages In This Thread
So frustrating! - by PhilOfPerth - 03-09-2023, 07:30 AM
RE: So frustrating! - by bplus - 03-09-2023, 07:56 AM
RE: So frustrating! - by PhilOfPerth - 03-09-2023, 08:27 AM
RE: So frustrating! - by bplus - 03-09-2023, 08:32 AM
RE: So frustrating! - by mnrvovrfc - 03-09-2023, 10:45 AM
RE: So frustrating! - by a740g - 03-09-2023, 10:59 AM
RE: So frustrating! - by PhilOfPerth - 03-09-2023, 10:36 PM
RE: So frustrating! - by mnrvovrfc - 03-10-2023, 06:48 AM
RE: So frustrating! - by bplus - 03-09-2023, 11:21 PM
RE: So frustrating! - by PhilOfPerth - 03-10-2023, 04:21 AM
RE: So frustrating! - by bplus - 03-10-2023, 05:35 AM
RE: So frustrating! - by PhilOfPerth - 03-10-2023, 06:26 AM
RE: So frustrating! - by PhilOfPerth - 03-10-2023, 10:10 AM



Users browsing this thread: 7 Guest(s)