Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PIXEL COLOR AND MOUSE
#7
i like the idea, but i find that onscreen info is some kind of useless, because
you only see the color info.
my work in progress modification opens a small dialog with color info on
key [control end] (unusual key combination, but easy to reach.)


[Image: colordialog.jpg]

here is my current code:
function MouseColor
Code:
Copy      Help
str MouCol rgb
int mx my omx omy sy sx ocol r g b
sy=ScreenHeight
sx=ScreenWidth

rep
,mx=xm
,my=ym

,if(mx+100 > sx)
,,omx=mx-50
,else
,,omx=mx+20
,if(my+30 > sy)
,,omy=my-20
,else
,,omy=my+2
,;if((xm=sx-1 && ym=sy-1 ))
,,;end
,ifk(CE) break
,sys.ColorToRGB(pixel(xm ym) r g b)
,MouCol.format("0x%X" pixel(xm ym))
,ocol=pixel(omx omy)
,ocol=!ocol
,OnScreenDisplay(MouCol 0.2 (omx) omy "" 8 ocol )
,OnScreenDisplay(MouCol 0.2 (omx+1) omy+1 "" 8 0x000001)
,0.15


str controls = "3 6 8 10 11"
str _nullx hex red green blue
_nullx=MouCol
hex.format("#%X" pixel(xm ym))
red=r;green=g;blue=b
if(!ShowDialog("MouseColorDialog" &MouseColorDialog &controls)) ret

function MouseColorDialog
Code:
Copy      Help
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
if(!ShowDialog("MouseColorDialog" &MouseColorDialog 0 0 0 0 0)) ret
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 121 46 "Colorpicker"
;9 Edit 0x54030080 0x200 4 50 10 8 "dummy"
;4 Static 0x54000000 0x0 6 4 10 10 "0x"
;5 Static 0x54000000 0x0 6 18 10 10 "#"
;7 Static 0x54000000 0x0 2 32 16 8 "RGB"
;3 Edit 0x54030080 0x200 22 2 96 14 "as 0x"
;6 Edit 0x54030080 0x200 22 16 96 14 "as hex"
;8 Edit 0x54030080 0x200 22 30 20 14 "red"
;10 Edit 0x54030080 0x200 44 30 20 14 "green"
;11 Edit 0x54030080 0x200 66 30 20 14 "blue"
;END DIALOG
;DIALOG EDITOR: "" 0x2010807 "" ""


ret
;messages
if(message=WM_INITDIALOG) DT_Init(hDlg lParam)
;int param=DT_GetParam(hDlg)

sel message
,case WM_INITDIALOG
,ret 1
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case EN_SETFOCUS<<16|3
,,out "0x"
,case EN_SETFOCUS<<16|6
,,out "hex"
,case EN_SETFOCUS<<16|8
,,out "rgb red"
,case EN_SETFOCUS<<16|10
,,out "rgb green"    
,case EN_SETFOCUS<<16|11
,,out "rgb blue"    
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1


feel free to optimize.
pi


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)