Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add unRgba

  • Loading branch information...
commit 584f92875dc38d0376ab97eaa611243ceb1b4891 1 parent ad732f0
@dancor authored
Showing with 9 additions and 1 deletion.
  1. +9 −1 Graphics/GD.hsc
View
10 Graphics/GD.hsc
@@ -38,7 +38,7 @@ module Graphics.GD (
drawString, measureString,
drawStringCircle,
-- * Colors
- rgb, rgba
+ rgb, rgba, unRgba
) where
import Control.Exception (bracket)
@@ -569,6 +569,14 @@ rgba r g b a =
(int g `shiftL` 8) .|.
int b
+unRgba :: Color -> (Int, Int, Int, Int)
+unRgba c = (int r, int g, int b, int a) where
+ a = c3 `shiftR` 8
+ r = c3 .&. 255
+ g = c2 .&. 255
+ b = c .&. 255
+ c2 = c `shiftR` 8
+ c3 = c2 `shiftR` 8
--
-- * Utilities
Please sign in to comment.
Something went wrong with that request. Please try again.