Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / SetImageMask() and HandsOnAGK2 BASIC

Author
Message
vitp4145
7
Years of Service
User Offline
Joined: 22nd Aug 2016
Location:
Posted: 16th Apr 2017 10:46
Hi everyone,

I am hoping someone can point me in the right direction here.

Using Alistair Stewart's very useful guide to AGK2 BASIC, I have come across an issue that I cannot resolve.

In his sample listing, "JigsawPiece" (p702-703) use is made of the function call SetImageMask(). Using his supplied sample images, I have keyed in the code and I get nothing. Just a blank white rectangle.

If I substitute a ,jpg or .png file as the original file, that image will show in the app window, but the jigsaw mask doesn't work.

This is the line I am using, exactly as shown in the book.

SetImageMask( game.images[1], game.images[2] ,4, 4,0 ,0 )

I have tried this in the latest version on Steam and nothing.

Is it that the images supplied with the listing are faulty? Is this a known bug in AGK2 BASIC?

I want to make use of the feature in an applicatuion I am developing and I have been unable to find any help via the AGK2 documentation files. Cany anyone give me a heads up on this?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 16th Apr 2017 15:31
I haven't seen the code you are referring to, but here is another example I created that requires masks...

https://forum.thegamecreators.com/thread/218449
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
vitp4145
7
Years of Service
User Offline
Joined: 22nd Aug 2016
Location:
Posted: 16th Apr 2017 19:22
The code is taken (literally from Alistair Stewart's AGK2 BASIC Tutorial Guide). So far, all the example listings given that use SetMaskImage() do not work. I get a black and white rectangle with a red cross in it or just an empty white rectangle.

Here's the code:

vitp4145
7
Years of Service
User Offline
Joined: 22nd Aug 2016
Location:
Posted: 17th Apr 2017 17:00
Update:

It appears SetImageMask is not the issue at all.

It never occured to me that AGK2 wouldn't load *.bmp files, but sure enough, no bitmap files at all will load. So, it is only .jpg and .png that will load successfully on my AGK2 in Windows.
Alistair
17
Years of Service
User Offline
Joined: 4th Oct 2006
Location: Scotland
Posted: 18th Apr 2017 12:17
When the book was first written AGK2 handled BMP files. Unfortunately, it no longer does. I'll change this section of the book during the next update (around June).
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 18th Apr 2017 13:48
For what possible reason would they remove support for a format if it was already there?

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 18th Apr 2017 13:51 Edited at: 18th Apr 2017 13:52
Filesizes?
The image processing library no longer supports BMPs ?
Mobile devices don't support BMPs so it was dropped for cross compatibility?
"Ancient Aliens"
Signature removed by mod because it's larger than 600x120... please resize and try again.
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 18th Apr 2017 15:44 Edited at: 18th Apr 2017 22:56
Quote: "For what possible reason would they remove support for a format if it was already there?"

Devices used to use the platform provided methods for loading images, which meant JPG, PNG, plus a load of others depending on the platform. Except on Android, which didn't have access to the platform functions from C++, so it used the libJPEG and libPNG libraries, limiting it to JPG and PNG. All the other platforms have now also migrated to using libJPEG and libPNG for their image loading so they now have the same limitation. Since BMP doesn't offer anything that PNG can't provide no time was given to supporting a BMP loader.
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 18th Apr 2017 17:16
Quote: "no time was giving to supporting a BMP loader"
Good job!

Login to post a reply

Server time is: 2024-05-04 05:11:12
Your offset time is: 2024-05-04 05:11:12