Copyright | (c) Taru Karttunen, 2014 |
---|---|
License | BSD3 |
Maintainer | taruti@taruti.net |
Stability | experimental |
Safe Haskell | None |
Draw raster/bitmap images for the Diagrams Cairo backend.
- cairoRaster ∷ (Int → Int → CairoColor) → Int → Int → IO (Diagram Cairo R2)
- cairoLoadImage ∷ FilePath → IO (Diagram Cairo R2)
- type CairoColor = Word32
- crgb ∷ Integral a ⇒ a → a → a → CairoColor
- crgba ∷ Integral a ⇒ a → a → a → a → CairoColor
- crgbap ∷ Integral a ⇒ a → a → a → a → CairoColor
High-level API
cairoRaster ∷ (Int → Int → CairoColor) → Int → Int → IO (Diagram Cairo R2) Source
Create an image "from scratch" by specifying the pixel data.
cairoLoadImage ∷ FilePath → IO (Diagram Cairo R2) Source
Load an image for Cairo (JPG, PNG, BMP, TIFF ...). The image is loaded once and which can be useful for e.g. tiles.
Colors
type CairoColor = Word32 Source
An ARGB color as understood by Cairo. Cairo colors are with pre-multiplied alpha in a native endian format with the bytes from low to high: blue, green, red and alpha.
crgb ∷ Integral a ⇒ a → a → a → CairoColor Source
Construct a CairoColor
from red, green and blue between [0 .. 255].
crgba ∷ Integral a ⇒ a → a → a → a → CairoColor Source
Construct a CairoColor
from non-premultiplied red, green, blue and alpha between [0 .. 255].
Non-premultiplied colors means that translucent red is crgba 255 0 0 127
.
crgbap ∷ Integral a ⇒ a → a → a → a → CairoColor Source
Construct a CairoColor
from already premultiplied red, green, blue and alpha between [0 .. min alpha 255].
Premultiplied colors means that translucent red is crgbap 127 0 0 127
.