stb-image-redux-0.2.1.3: Image loading and writing microlibrary
Copyright(c) Alexis Williams 2016
LicenseBSD3
Maintainersasinestro@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Data.STBImage

Description

Much like the original library, the focus of this library is placed on ease of use rather than richness of feature set, thus the rather spartan interface.

Synopsis

The Color Typeclass

class Storable a => Color a where Source #

Associated Types

data ColorFlag a :: * Source #

Methods

loadImage :: ColorFlag a -> FilePath -> IO (Either String (Image a)) Source #

loadImage reads the image (with ColorFlag Y, YA, RGB, or RGBA) at the supplied path.

writePNG :: FilePath -> Image a -> IO () Source #

writePNG writes the image passed to it out at the path path in PNG format. The path must include the extension.

writeBMP :: FilePath -> Image a -> IO () Source #

writeBMP writes the image passed to it out at the path path in BMP format. The path must include the extension.

writeTGA :: FilePath -> Image a -> IO () Source #

writeTGA writes the image passed to it out at the path path in TGA format. The path must include the extension.

red :: a -> Word8 Source #

green :: a -> Word8 Source #

blue :: a -> Word8 Source #

alpha :: a -> Word8 Source #

Instances

Instances details
Color RGBAColor Source # 
Instance details

Defined in Data.STBImage.Color

Associated Types

data ColorFlag RGBAColor Source #

Color RGBColor Source # 
Instance details

Defined in Data.STBImage.Color

Associated Types

data ColorFlag RGBColor Source #

Color YAColor Source # 
Instance details

Defined in Data.STBImage.Color

Associated Types

data ColorFlag YAColor Source #

Color YColor Source # 
Instance details

Defined in Data.STBImage.Color

Associated Types

data ColorFlag YColor Source #

showColor :: Color a => a -> String Source #

showColor is a default implementation of Show for any instance of the Color typeclass.

Images and their utilities

data Image a Source #

Image is the least opinionated reasonable type to represent an image, just a vector of pixel Colors (laid out top-to-bottom, left-to-right) and a size.

Constructors

Image 

Fields

Instances

Instances details
(Storable a, Eq a) => Eq (Image a) Source # 
Instance details

Defined in Data.STBImage.Immutable

Methods

(==) :: Image a -> Image a -> Bool #

(/=) :: Image a -> Image a -> Bool #

Show (Image a) Source # 
Instance details

Defined in Data.STBImage.Immutable

Methods

showsPrec :: Int -> Image a -> ShowS #

show :: Image a -> String #

showList :: [Image a] -> ShowS #

Generic (Image a) Source # 
Instance details

Defined in Data.STBImage.Immutable

Associated Types

type Rep (Image a) :: Type -> Type #

Methods

from :: Image a -> Rep (Image a) x #

to :: Rep (Image a) x -> Image a #

type Rep (Image a) Source # 
Instance details

Defined in Data.STBImage.Immutable

type Rep (Image a) = D1 ('MetaData "Image" "Data.STBImage.Immutable" "stb-image-redux-0.2.1.3-inplace" 'False) (C1 ('MetaCons "Image" 'PrefixI 'True) (S1 ('MetaSel ('Just "_pixels") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Vector a)) :*: (S1 ('MetaSel ('Just "_width") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "_height") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))))

flipImage :: Storable a => Image a -> Image a Source #

Utility function to flip images, e.g. for use with OpenGL

Individual color types

data YColor Source #

Constructors

YColor 

Fields

Instances

Instances details
Eq YColor Source # 
Instance details

Defined in Data.STBImage.ColorTypes

Methods

(==) :: YColor -> YColor -> Bool #

(/=) :: YColor -> YColor -> Bool #

Show YColor Source # 
Instance details

Defined in Data.STBImage.Color

Generic YColor Source # 
Instance details

Defined in Data.STBImage.ColorTypes

Associated Types

type Rep YColor :: Type -> Type #

Methods

from :: YColor -> Rep YColor x #

to :: Rep YColor x -> YColor #

Storable YColor Source # 
Instance details

Defined in Data.STBImage.ColorTypes

Color YColor Source # 
Instance details

Defined in Data.STBImage.Color

Associated Types

data ColorFlag YColor Source #

Show (ColorFlag YColor) Source # 
Instance details

Defined in Data.STBImage.Color

type Rep YColor Source # 
Instance details

Defined in Data.STBImage.ColorTypes

type Rep YColor = D1 ('MetaData "YColor" "Data.STBImage.ColorTypes" "stb-image-redux-0.2.1.3-inplace" 'False) (C1 ('MetaCons "YColor" 'PrefixI 'True) (S1 ('MetaSel ('Just "_yGreyscale") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8)))
data ColorFlag YColor Source # 
Instance details

Defined in Data.STBImage.Color

data YAColor Source #

Constructors

YAColor 

Instances

Instances details
Eq YAColor Source # 
Instance details

Defined in Data.STBImage.ColorTypes

Methods

(==) :: YAColor -> YAColor -> Bool #

(/=) :: YAColor -> YAColor -> Bool #

Show YAColor Source # 
Instance details

Defined in Data.STBImage.Color

Generic YAColor Source # 
Instance details

Defined in Data.STBImage.ColorTypes

Associated Types

type Rep YAColor :: Type -> Type #

Methods

from :: YAColor -> Rep YAColor x #

to :: Rep YAColor x -> YAColor #

Storable YAColor Source # 
Instance details

Defined in Data.STBImage.ColorTypes

Color YAColor Source # 
Instance details

Defined in Data.STBImage.Color

Associated Types

data ColorFlag YAColor Source #

Show (ColorFlag YAColor) Source # 
Instance details

Defined in Data.STBImage.Color

type Rep YAColor Source # 
Instance details

Defined in Data.STBImage.ColorTypes

type Rep YAColor = D1 ('MetaData "YAColor" "Data.STBImage.ColorTypes" "stb-image-redux-0.2.1.3-inplace" 'False) (C1 ('MetaCons "YAColor" 'PrefixI 'True) (S1 ('MetaSel ('Just "_yaGreyscale") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8) :*: S1 ('MetaSel ('Just "_yaAlpha") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8)))
data ColorFlag YAColor Source # 
Instance details

Defined in Data.STBImage.Color

data RGBColor Source #

Constructors

RGBColor 

Instances

Instances details
Eq RGBColor Source # 
Instance details

Defined in Data.STBImage.ColorTypes

Show RGBColor Source # 
Instance details

Defined in Data.STBImage.Color

Generic RGBColor Source # 
Instance details

Defined in Data.STBImage.ColorTypes

Associated Types

type Rep RGBColor :: Type -> Type #

Methods

from :: RGBColor -> Rep RGBColor x #

to :: Rep RGBColor x -> RGBColor #

Storable RGBColor Source # 
Instance details

Defined in Data.STBImage.ColorTypes

Color RGBColor Source # 
Instance details

Defined in Data.STBImage.Color

Associated Types

data ColorFlag RGBColor Source #

Show (ColorFlag RGBColor) Source # 
Instance details

Defined in Data.STBImage.Color

type Rep RGBColor Source # 
Instance details

Defined in Data.STBImage.ColorTypes

type Rep RGBColor = D1 ('MetaData "RGBColor" "Data.STBImage.ColorTypes" "stb-image-redux-0.2.1.3-inplace" 'False) (C1 ('MetaCons "RGBColor" 'PrefixI 'True) (S1 ('MetaSel ('Just "_rgbRed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8) :*: (S1 ('MetaSel ('Just "_rgbGreen") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8) :*: S1 ('MetaSel ('Just "_rgbBlue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8))))
data ColorFlag RGBColor Source # 
Instance details

Defined in Data.STBImage.Color

data RGBAColor Source #

Constructors

RGBAColor 

Instances

Instances details
Eq RGBAColor Source # 
Instance details

Defined in Data.STBImage.ColorTypes

Show RGBAColor Source # 
Instance details

Defined in Data.STBImage.Color

Generic RGBAColor Source # 
Instance details

Defined in Data.STBImage.ColorTypes

Associated Types

type Rep RGBAColor :: Type -> Type #

Storable RGBAColor Source # 
Instance details

Defined in Data.STBImage.ColorTypes

Color RGBAColor Source # 
Instance details

Defined in Data.STBImage.Color

Associated Types

data ColorFlag RGBAColor Source #

Show (ColorFlag RGBAColor) Source # 
Instance details

Defined in Data.STBImage.Color

type Rep RGBAColor Source # 
Instance details

Defined in Data.STBImage.ColorTypes

type Rep RGBAColor = D1 ('MetaData "RGBAColor" "Data.STBImage.ColorTypes" "stb-image-redux-0.2.1.3-inplace" 'False) (C1 ('MetaCons "RGBAColor" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_rgbaRed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8) :*: S1 ('MetaSel ('Just "_rgbaGreen") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8)) :*: (S1 ('MetaSel ('Just "_rgbaBlue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8) :*: S1 ('MetaSel ('Just "_rgbaAlpha") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8))))
data ColorFlag RGBAColor Source # 
Instance details

Defined in Data.STBImage.Color