
/' Keal's Gamma Adjust ( 2024 03/11 ) '/

declare Function AdjustGamma(ByVal cca As Double) As Double

declare Function AdjustDepth(sy1 as longint) As longint

Dim shared As Double adjustedGamma
'gamma = 2.2 ' Set your desired gamma value here

	' Calculate adjusted depth value
	cca = AdjustDepth(sy1)
		
	' Calculate adjusted gamma value
	adjustedGamma = AdjustGamma(cca) ', gamma)


	' Apply gamma adjustment
	pPix[p].r = (pPix[p].r * adjustedGamma) \ 255
	pPix[p].g = (pPix[p].g * adjustedGamma) \ 255
	pPix[p].b = (pPix[p].b * adjustedGamma) \ 255
	pPix[p].x = (pPix[p].x * adjustedGamma) \ 255

Function AdjustGamma(ByVal cca As Double) As Double
	return 255 * ((cca / 255) ^ (POSONE / GAMMA))
End Function

Function AdjustDepth(sy1 as longint) As longint
	return ((YDIM\POSTWO-sy1)*POSSIXTYFOUR)*POSTWO\YDIM
End Function
