| Copyright | (c) Alexis Williams 2016 |
|---|---|
| License | BSD3 |
| Maintainer | sasinestro@gmail.com |
| Stability | experimental |
| Safe Haskell | None |
| Language | Haskell2010 |
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
- class Storable a => Color a where
- showColor :: Color a => a -> String
- data Image a = Image {}
- flipImage :: Storable a => Image a -> Image a
- data YColor = YColor {
- _yGreyscale :: Word8
- data YAColor = YAColor {
- _yaGreyscale :: Word8
- _yaAlpha :: Word8
- data RGBColor = RGBColor {}
- data RGBAColor = RGBAColor {
- _rgbaRed :: Word8
- _rgbaGreen :: Word8
- _rgbaBlue :: Word8
- _rgbaAlpha :: Word8
The Color Typeclass
class Storable a => Color a where 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.
Instances
Images and their utilities
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.
Instances
| (Storable a, Eq a) => Eq (Image a) Source # | |
| Show (Image a) Source # | |
| Generic (Image a) Source # | |
| type Rep (Image a) Source # | |
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
Constructors
| YColor | |
Fields
| |
Instances
| Eq YColor Source # | |
| Show YColor Source # | |
| Generic YColor Source # | |
| Storable YColor Source # | |
| Color YColor Source # | |
Defined in Data.STBImage.Color Methods loadImage :: ColorFlag YColor -> FilePath -> IO (Either String (Image YColor)) Source # writePNG :: FilePath -> Image YColor -> IO () Source # writeBMP :: FilePath -> Image YColor -> IO () Source # writeTGA :: FilePath -> Image YColor -> IO () Source # red :: YColor -> Word8 Source # green :: YColor -> Word8 Source # | |
| Show (ColorFlag YColor) Source # | |
| type Rep YColor Source # | |
Defined in Data.STBImage.ColorTypes | |
| data ColorFlag YColor Source # | |
Defined in Data.STBImage.Color | |
Constructors
| YAColor | |
Fields
| |
Instances
| Eq YAColor Source # | |
| Show YAColor Source # | |
| Generic YAColor Source # | |
| Storable YAColor Source # | |
| Color YAColor Source # | |
Defined in Data.STBImage.Color Methods loadImage :: ColorFlag YAColor -> FilePath -> IO (Either String (Image YAColor)) Source # writePNG :: FilePath -> Image YAColor -> IO () Source # writeBMP :: FilePath -> Image YAColor -> IO () Source # writeTGA :: FilePath -> Image YAColor -> IO () Source # red :: YAColor -> Word8 Source # green :: YAColor -> Word8 Source # | |
| Show (ColorFlag YAColor) Source # | |
| type Rep YAColor Source # | |
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 # | |
Defined in Data.STBImage.Color | |
Instances
Constructors
| RGBAColor | |
Fields
| |