forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Screen Colour

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Rubes_sw
Valued Contributor
Valued Contributor


Joined: 11 Jun 2001
Posts: 625
Location: Northern Ireland

PostPosted: Wed Dec 04, 2002 2:26 pm    Post subject: Screen Colour Reply with quote

How can I (example code if possibel Smile )

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
View user's profile Send private message Send e-mail Visit poster's website
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Wed Dec 04, 2002 3:16 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Rubes_sw
Valued Contributor
Valued Contributor


Joined: 11 Jun 2001
Posts: 625
Location: Northern Ireland

PostPosted: Wed Dec 04, 2002 3:58 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Wed Dec 04, 2002 4:15 pm    Post subject: Reply with quote

Hehehehehee.... Aren't color conversions fun? Very Happy

I've got some code for that, let me go find it . BRB.


-Garrett
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Wed Dec 04, 2002 4:22 pm    Post subject: Reply with quote

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
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Dec 04, 2002 4:49 pm    Post subject: Reply with quote

Just a note...

VDS uses a reversed color format (BBGGRR), HTML
uses standard RRGGBB format. Wink

Cheers, Mac Smile

_________________
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
View user's profile Send private message Send e-mail
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Thu Dec 05, 2002 5:08 am    Post subject: Reply with quote

Sorry, I lack commenting source code. Especially when I just grab the
code from something that wasn't an example.

-Garrett
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group