Copio aqui el codigo fuente para JPGs:
TestMap2.prg
#include "FiveWin.ch"
function Main()
local oDlg, oHand, oBmp1
DEFINE CURSOR oHand HAND
DEFINE DIALOG oDlg RESOURCE "Test"
REDEFINE IMAGE oBmp1 ID 110 OF oDlg FILENAME "olga1.jpg"
oBmp1:oCursor = oHand
oBmp1:bLClicked = { | nRow, nCol | MsgInfo( GetArea( GetColor( nRow, nCol, oDlg ) ) ) }
ACTIVATE DIALOG oDlg CENTERED
return nil
function GetColor( nRow, nCol, oDlg )
local hDC := CreateCompatibleDC( oDlg:GetDC() )
local oImg := TImage()
local dummy := oImg:LoadImage( , "olga2.jpg" )
local hBmp := oImg:hBitmap
local hOldBmp := SelectObject( hDC, hBmp )
local nRGBColor := GetPixel( hDC, nCol, nRow )
SelectObject( hDC, hOldBmp )
DeleteObject( hBmp )
DeleteDC( hDC )
oDlg:ReleaseDC()
return nRGBColor
function GetArea( nRGBColor )
do case
case nRGBColor == 5091363
return "Nariz"
case nRGBColor == 2366445
return "Ojos"
case nRGBColor == 2523134
return "Boca"
case nRGBColor == 10832034
return "Oido"
otherwise
return Str( nRGBColor ) + ", no definido aun en la funcion GetArea()"
endcase
return nil
TestMap2.rc
test DIALOG 17, 36, 235, 260
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "TestMap"
FONT 8, "MS Sans Serif"
{
CONTROL "", 110, "TImage", WS_CHILD | WS_VISIBLE, 0, 0, 235, 300
}