| View previous topic :: View next topic |
| Author |
Message |
Rubes_sw Valued Contributor


Joined: 11 Jun 2001 Posts: 625 Location: Northern Ireland
|
Posted: Wed Dec 04, 2002 2:26 pm Post subject: Screen Colour |
|
|
How can I (example code if possibel )
I want a small program that will run in the top corner of the screen, when i mouse the mouse anywhere on the screen.
I want my program to display the mouse position and the pixel colour ?
I have tried doing a printscreen then using tommys vdsdll.dll to load the bitmap and then use @dll(pixel) but it is very slow and not reiable.
Any help
Nathan |
|
| Back to top |
|
 |
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
Posted: Wed Dec 04, 2002 3:16 pm Post subject: |
|
|
Hi Nathan,
I think you tried to use the VDSIMAGE part of the VDSDLL 3. The VDSCAP DLL
contains a pixel function too which returns the color of a specified screen coordinate.
I think that one may work for your purposes.
Tommy |
|
| Back to top |
|
 |
Rubes_sw Valued Contributor


Joined: 11 Jun 2001 Posts: 625 Location: Northern Ireland
|
Posted: Wed Dec 04, 2002 3:58 pm Post subject: |
|
|
Works great, now how do i convert the colour produced by the @dll(pixel etc)
to :
RGB ???
VDS Compaitbale colour
HTML colour
Nathan |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Wed Dec 04, 2002 4:15 pm Post subject: |
|
|
Hehehehehee.... Aren't color conversions fun?
I've got some code for that, let me go find it . BRB.
-Garrett |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Wed Dec 04, 2002 4:22 pm Post subject: |
|
|
The following code assumes that you are using the vdscap.dll. Color
conversions provided are RGB, VDS, HTML, CHEX and LONG.
-Garrett
| Code: | %%Color0 = @capture(Pixel,@mousepos(x),@mousepos(y))
Gosub Convert
%%vdscolor = @sum(%%Color,0)
%%hex = @hex(@diff(%%vdscolor,0),8)
%%blue = @sum($@substr(%%hex,3,4),0)
%%green = @sum($@substr(%%hex,5,6),0)
%%red = @sum($@substr(%%hex,7,8),0)
%%HtmColor = #@hex(%%red,2)@hex(%%green,2)@hex(%%blue,2)
%%CHex = 0x@hex(%%blue,2)@hex(%%green,2)@hex(%%red,2)
%%Long = @sum($%%hex,0)
Goto EventLoop
:Convert
If @equal(%%Color0,red)
%%Color = $000000FF
ElsIf @equal(%%Color0,black)
%%Color = $00000000
ElsIf @equal(%%Color0,white)
%%Color = $00FFFFFF
ElsIf @equal(%%Color0,dkred)
%%Color = $00000080
ElsIf @equal(%%Color0,dkgreen)
%%Color = $00008000
ElsIf @equal(%%Color0,brown)
%%Color = $00008080
ElsIf @equal(%%Color0,dkblue)
%%Color = $00800000
ElsIf @equal(%%Color0,magenta)
%%Color = $00800080
ElsIf @equal(%%Color0,gray)
%%Color = $00808080
ElsIf @equal(%%Color0,silver)
%%Color = $00C0C0C0
ElsIf @equal(%%Color0,ltgreen)
%%Color = $0000FF00
ElsIf @equal(%%Color0,yellow)
%%Color = $0000FFFF
ElsIf @equal(%%Color0,ltblue)
%%Color = $00FF0000
ElsIf @equal(%%Color0,cyan)
%%Color = $00FFFF00
Else
%%Color = $00@hex(%%Color0)
End
Exit |
|
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Dec 04, 2002 4:49 pm Post subject: |
|
|
Just a note...
VDS uses a reversed color format (BBGGRR), HTML
uses standard RRGGBB format.
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Thu Dec 05, 2002 5:08 am Post subject: |
|
|
Sorry, I lack commenting source code. Especially when I just grab the
code from something that wasn't an example.
-Garrett |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|