Advertisement
jargon

Keal's Gamma Adjust

Mar 22nd, 2024
1,545
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
FreeBasic 0.84 KB | Gaming | 0 0
  1.  
  2. /' Keal's Gamma Adjust ( 2024 03/11 ) '/
  3.  
  4. declare Function AdjustGamma(ByVal cca As Double) As Double
  5.  
  6. declare Function AdjustDepth(sy1 as longint) As longint
  7.  
  8. Dim shared As Double adjustedGamma
  9. 'gamma = 2.2 ' Set your desired gamma value here
  10.  
  11.     ' Calculate adjusted depth value
  12.     cca = AdjustDepth(sy1)
  13.        
  14.     ' Calculate adjusted gamma value
  15.     adjustedGamma = AdjustGamma(cca) ', gamma)
  16.  
  17.  
  18.     ' Apply gamma adjustment
  19.     pPix[p].r = (pPix[p].r * adjustedGamma) \ 255
  20.     pPix[p].g = (pPix[p].g * adjustedGamma) \ 255
  21.     pPix[p].b = (pPix[p].b * adjustedGamma) \ 255
  22.     pPix[p].x = (pPix[p].x * adjustedGamma) \ 255
  23.  
  24. Function AdjustGamma(ByVal cca As Double) As Double
  25.     return 255 * ((cca / 255) ^ (POSONE / GAMMA))
  26. End Function
  27.  
  28. Function AdjustDepth(sy1 as longint) As longint
  29.     return ((YDIM\POSTWO-sy1)*POSSIXTYFOUR)*POSTWO\YDIM
  30. End Function
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement