better overflow for RGBA creation
This commit is contained in:
parent
89fc700dfe
commit
693215792b
1 changed files with 2 additions and 2 deletions
|
@ -13,8 +13,8 @@ newRGBA :: Int -> Int -> Int -> Int -> RGBA
|
|||
newRGBA r g b a = RGBA (overflow r) (overflow g) (overflow b) (overflow a)
|
||||
where
|
||||
overflow x
|
||||
| x < 0 = 255 + (x `mod` 255)
|
||||
| otherwise = x `mod` 255
|
||||
| x < 0 = x - (x `div` 256) * 255 + 1
|
||||
| otherwise = x - (x `div` 256) * 255
|
||||
|
||||
getR :: RGBA -> Int
|
||||
getR (RGBA r _ _ _) = r
|
||||
|
|
Loading…
Reference in a new issue