FUNCTION MAIN()
local cFile:="a.bmp"
local cColori:="colori.png"
local oDlg,oBmp,oImg
local nColor := 0, oColor
local hdc, nPickRow := 0, nPickCol := 0
local oSay1, oSay2, oSay3, oFont
DEFINE CURSOR oHand HAND
DEFINE FONT oFont NAME "Verdanal" SIZE 0, -12 BOLD
DEFINE dialog oDlg size 520, 520
@ 4,1 XIMAGE oImg filename cFile SIZE 200,200 OF oDlg
oImg:oCursor := oHand
oImg:bPainted := < |hDC|
FLOODFILL( nPickRow, nPickCol, nColor )
// FILLCOLOR( hDC, oImg, nPickRow, nPickCol, nColor )
oSay1:Refresh()
oSay2:Refresh()
oSay3:Refresh()
RETURN NIL
>
oImg:bLClicked := { | nRow, nCol | nPickRow := nRow, nPickCol := nCol, oImg:refresh() }
@ 220,1 XIMAGE oBmp filename cColori SIZE 180,20 OF oDlg
@ 220, 183 get oColor var ncolor size 20, 20 pixel COLOR nColor, nColor UPDATE
@ 190, 210 say oSay0 PROMPT "Top, Left, color" size 60, 30 pixel COLOR 0 FONT oFont UPDATE
@ 200, 210 say oSay1 var nPickRow size 20, 20 pixel COLOR 255 FONT oFont UPDATE
@ 210, 210 say oSay2 var nPickCol size 20, 20 pixel COLOR 255 FONT oFont UPDATE
@ 220, 210 say oSay3 var nColor size 20, 20 pixel COLOR 255 FONT oFont UPDATE
oBmp:oCursor := oHand
oBmp:bLClicked := { | nRow, nCol | ( ncolor := GETCOLOR( oBmp, nRow, nCol ), ;
oColor:SetColor(nColor, nColor), oColor:refresh() ) }
ACTIVATE DIALOG oDlg CENTERED
oFont:End()
RETURN NIL
//-----------------------
FUNCTION GETCOLOR( oBmp, nRow, nCol )
hDC := oBmp:GetDC()
nColor := GetPixel( hDC, nCol, nRow )
oBmp:ReleaseDC()
RETURN nColor
//-----------------------
FUNCTION FILLCOLOR( hDC, oImg, nRow, nCol, nColor )
//MsgAlert( nRow, "Row" )
//MsgAlert( nCol, "Column" )
//MsgAlert( nColor, "Color" )
//ExtFloodFill( hDC, nRow, nCol, ncolor, 1 )
FloodFill( nRow, nCol, nColor )
RETURN NIL