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.

Newcomers AppGameKit Corner / [Question] Is there a command to check color under mouse/at x/y coordinate?

Author
Message
Rknight
21
Years of Service
User Offline
Joined: 25th Sep 2003
Location: NJ
Posted: 16th Sep 2015 07:11
Is there a command to check the color of whatever pixel is at the x/y coordinate you specify?
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 16th Sep 2015 13:19 Edited at: 16th Sep 2015 13:22
You can do this using memblocks by loading an image into a memblock and then reading the point at x, y in that memblock.

This is a snippet of the code from an early version of Paint Pot:

memBlockin is the name of the memBlock
width is the width of the image
x, y is the point of the mouse



You check the thread for more info here:

http://forum.thegamecreators.com/?m=forum_view&t=213305&b=48

The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 18th Sep 2015 16:47 Edited at: 18th Sep 2015 16:50
You could:
1-Grab a single pixel from the screen as an image - GetImage()
2-Convert it to a memblock - CreateMemblockFromImage()
3-Use spectrepaul's function to get the pixel data with a slight tweak:



Using AppGameKit V2 Tier 1
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 18th Sep 2015 18:16
Quote: "You could:
1-Grab a single pixel from the screen as an image - GetImage()
2-Convert it to a memblock - CreateMemblockFromImage()
3-Use spectrepaul's function to get the pixel data with a slight tweak:"


Cool, never thought of putting that slant on it

The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!

Login to post a reply

Server time is: 2024-11-23 10:27:49
Your offset time is: 2024-11-23 10:27:49