Copyright(c) Taru Karttunen, 2014
LicenseBSD3
Maintainertaruti@taruti.net
Stabilityexperimental
Safe HaskellNone

Diagrams.Backend.Cairo.Raster

Contents

Description

Draw raster/bitmap images for the Diagrams Cairo backend.

Synopsis

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.