friday-devil-0.1.0.1: Uses the DevIL C library to read and write images from and to files and memory buffers.

Safe HaskellNone
LanguageHaskell2010

Vision.Image.Storage.DevIL

Contents

Description

Uses the DevIL C library to read and write images from and to files and memory buffers.

Please read our README to to get a detailed usage and some examples.

Note: As the underlying DevIL library is *not* tread-safe, there is a global lock which will prevent two load/save calls to be performed at the same time. The Haskell interface should be thread-safe but will not be able to benefit from multiple processing cores.

Synopsis

Types & classes

data StorageError Source

Constructors

FailedToInit

Failed to initialise the library.

FailedToOpenFile

Failed to open the given file.

FailedToLoad

Failed to load the image, invalid format.

FailedToHaskell

Failed to convert the loaded image to its Haskell representation.

FailedToDevil

Failed to write the image content through the inner DevIL library.

FailedToSave

Failed to save the image.

FileAlreadyExists

The file already exists.

InvalidFile

The file could not be loaded because of an invalid value.

OutOfMemory

Could not allocate memory for the new image data.

UnknownFileType

The file content or extension does not match any known image type.

UnknownError (Maybe String) 

Functions

load :: (LoadImageType t, Convertible StorageImage i) => t -> FilePath -> IO (Either StorageError i) Source

Reads an image from a file.

If the Autodetect image type is given, type will be determined automatically with the file extension and the file headers.

loadBS :: (LoadImageType t, Convertible StorageImage i) => t -> ByteString -> Either StorageError i Source

Reads an image from a strict ByteString.

If the Autodetect image type is given, type will be determined automatically with the file headers.

save :: (SaveImageType t, Convertible i StorageImage) => t -> FilePath -> i -> IO (Maybe StorageError) Source

Saves the image to the given file.

If the Autodetect image type is given, type will be determined automatically with the file extension.

Note: will fail if the file already exists.

saveBS :: (SaveBSImageType t, Convertible i StorageImage) => t -> i -> Either StorageError ByteString Source

Saves the image into a manifest vector from a strict ByteString.

Images types

data Autodetect Source

Tries to determine automatically the image type with the header and/or the file extension.

Raises an UnknownFileType error if the detection failed.

Constructors

Autodetect 

data BLP Source

Constructors

BLP 

data CUT Source

Constructors

CUT 

data DCX Source

Constructors

DCX 

data DDS Source

DirectDraw Surface (.dds).

Constructors

DDS 

data Doom Source

Doom texture.

Constructors

Doom 

data DoomFlat Source

Doom flat texture (floor).

Constructors

DoomFlat 

data DPX Source

Constructors

DPX 

data FITS Source

Constructors

FITS 

data FTX Source

Constructors

FTX 

data GIF Source

Constructors

GIF 

data ICO Source

Constructors

ICO 

data ICNS Source

Constructors

ICNS 

data IFF Source

Constructors

IFF 

data IWI Source

Constructors

IWI 

data LIF Source

Homeworld (.lif).

Constructors

LIF 

data MDL Source

Constructors

MDL 

data MNG Source

Constructors

MNG 

data MP3 Source

Constructors

MP3 

data PCD Source

Constructors

PCD 

data PCX Source

Constructors

PCX 

data PIC Source

Constructors

PIC 

data PIX Source

Constructors

PIX 

data PNM Source

Portable AnyMap (.pbm, .pgm or .ppm).

Constructors

PNM 

data PSD Source

Photoshop Document.

Constructors

PSD 

data PSP Source

Paint Shop Pro image.

Constructors

PSP 

data PXR Source

Constructors

PXR 

data RAW Source

Raw data with a 13-byte header.

Constructors

RAW 

data ROT Source

Constructors

ROT 

data SUN Source

Constructors

SUN 

data Texture Source

Medieval II: Total War Texture (.texture) file.

Constructors

Texture 

data TPL Source

Constructors

TPL 

data UTX Source

Constructors

UTX 

data WAL Source

Constructors

WAL