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 DBPro Corner / Color at a point on an image

Author
Message
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 3rd Oct 2007 04:55
Hi.

I was just wondering, is it possible to get the color of a certain point on an image (similar to the POINT(X,Y) command) without refreshing the screen first? Just wondering...

Thanks,
-Sixty Squares

Mr Kohlenstoff
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Germany
Posted: 4th Oct 2007 13:03
It's easily possible with memblocks. It's not that hard to write a function which calculates the memblock-position from a Position relative in the image, and returns the color-dword.
If you know how memblocks work that's a few minutes of work.

TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 5th Oct 2007 01:27
I don't follow what you mean by "without refreshing the screen first".

If you just want the colour of a single pixel clicked on with the mouse, you use Point(MouseX(),MouseY()) and if it's a fixed pixel on a hidden image, load it into Bitmap 1 first.

TDK_Man

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 6th Oct 2007 13:08 Edited at: 6th Oct 2007 13:09
You can either use memblocks as suggested by Mr K, or you can create a secondary bitmap, paste the image there and then get the colour from that bitmap.

[EDIT]Another alternative popped into my head - there's at least one plug-in around that allows you to access images as if they were bitmaps - you might look around and go that route.

Utility plugins collection and
http://www.matrix1.demon.co.uk for older plug-ins and example code
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 11th Oct 2007 13:53 Edited at: 11th Oct 2007 13:58
Thanks all

@Mr. Kohlenstoff: Well, I guess I need to learn memblocks then.

@TDK: Would that require the SYNC command in order to use? When I say without refreshing the screeen I mean without doing this:



@IanM: Thanks. It seems that bitmaps are easiest to access here.


I'll see if I can get something working with bitmaps or memblocks. Thanks for the help. (I'm trying to get the color of a pixel on another camera's screen without the player seeing this other camera.)

TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 11th Oct 2007 17:13
I've not tested it recently, but I certainly can't remember ever having to use Sync after Paste Image to make it appear.

TDK_Man

Login to post a reply

Server time is: 2024-09-27 05:16:33
Your offset time is: 2024-09-27 05:16:33