XIMAGE : Gamma Level Adjustment
Posted: Mon Jul 08, 2024 2:41 pm
Upcoming Enhancement to TXImage class:
New Data nGamma. Default value 1.0
Programmer can assign any value 0.0 or greater to change the Gamma value.
New Data nGamma. Default value 1.0
Programmer can assign any value 0.0 or greater to change the Gamma value.
Code: Select all | Expand
#include "fivewin.ch"
function Main()
local oDlg, oImage, oFont, cFile
local oGamma, nGamma := 100.0, oSay
cFile := "..\bitmaps\olga1.jpg"
DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 600,800 PIXEL TRUEPIXEL RESIZABLE FONT oFont ;
TITLE Upper( cFileName( cFile ) )
@ 60,20 XIMAGE oImage FILE cfile SIZE -20,-20 OF oDlg
oImage:FitRect()
@ 10,20 SAY "Gamma" SIZE 100,20 PIXEL OF oDlg
@ 10,120 SLIDER oGamma VAR nGamma SIZE oDlg:nWidth - 260,20 PIXEL OF oDlg ;
HORIZONTAL RANGE 0,300 UPDATE TOP DIRECTION ;
ON CHANGE ( oImage:nGamma := nVar * 0.01, oDlg:Update() ) ;
ON THUMBPOS ( nGamma := nVar, oImage:nGamma := nVar * 0.01, oDlg:Update() ) ;
SLIMSTYLE
@ 10,oDlg:nWidth - 120 SAY oSay PROMPT { || oImage:nGamma } PICTURE "9.9999" SIZE 100,20 PIXEL OF oDlg RIGHT UPDATE
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil