Advertisement
Mysoft

Untitled

Jan 9th, 2016
650
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var pPix = cast(ARGB ptr,pImg+1), iWidM = pImg->Width-1  
  2.   dim as integer iNextR(iWidM), iNextG(iWidM), iNextB(iWidM)
  3.   for Y as integer = 0 to pImg->Height-1
  4.     var iErrR = 0 , iErrG = 0 , iErrB = 0
  5.     for X as integer = 0 to iWidM
  6.       var iMinDiff=&hFFFFFF, iNum = -1    
  7.       var iR = cint(pPix->R)+iErrR+iNextR(X): if cuint(iR) > 255 then iR = iR>255 and 255
  8.       var iG = cint(pPix->G)+iErrG+iNextG(X): if cuint(iG) > 255 then iG = iG>255 and 255      
  9.       var iB = cint(pPix->B)+iErrB+iNextB(X): if cuint(iB) > 255 then iB = iB>255 and 255
  10.       with tColors( (iB shr 3) or ((iG shr 3) shl 5) or ((iR shr 3) shl 10) )
  11.         iErrR = .DiffR : iErrG = .DiffG : iErrB = .DiffB
  12.         iNextR(X) = iErrR shr 1: iErrR -= iNextR(X)        
  13.         iNextG(X) = iErrG shr 1: iErrG -= iNextG(X)      
  14.         iNextB(X) = iErrB shr 1: iErrB -= iNextR(X)
  15.         *pPix = tFullPal( .iConColor shr 16): pPix += 1
  16.       end with
  17.     next X
  18.   next Y
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement