bitmaps-0.2.6.3: Bitmap library

Safe HaskellNone
LanguageHaskell2010

Data.Bitmap.String.Internal

Synopsis

Documentation

data BitmapString Source

A bitmap represented as a string or stored as bytes

By default, the RGB32 format (where the most significant byte, the head-most one, is unused) is used.

The bitmap must be stored by pixels not separated by component. Each pixel must contain at least the red, blue, and green component, each one byte wide (bytes are assumed to be octets), either in that order or reversed. There may be an alpha component either immediately before the other three components or immediately after. Thus there are four possible arrangements of components for each pixel, which must be consistent for every pixel. Any amount of padding or unused bytes is permitted before each pixel, but the amount must be fixed. The same is true also after each pixel.

This type is most efficient with lazy bytestrings.

Constructors

BitmapString 

Fields

_bmps_data :: GenString

Bitmap data; it is assumed to be large enough

_bmps_dimensions :: Dimensions (BIndexType BitmapString)

Width and height of the data; bmps_rowFromBeg, etc. need to be taken account for the dimensions of the bitmap

_bmps_rowAlignment :: Int

Each row is aligned to this many bytes; when necessary, null bytes are added to each row

_bmps_redHead :: Bool

Whether the red component is first; if True, the order of the components is red, green, blue; otherwise, it is blue, green, red

_bmps_alphaHead :: Maybe Bool

If Nothing, then there is no alpha component; otherwise, if True, it is before the other three components (towards the head) most significant first, otherwise, it is after the other three components towards the tail least significant / last of the four components

_bmps_paddingHead :: Int

Number of unused bytes before each pixel

_bmps_paddingTail :: Int

Number of unused bytes after each pixel

_bmps_rowFromTop :: Bool

Is the first row at the top?

_bmps_columnFromLeft :: Bool

Is the first column in each row at the left?

_bmps_rowFromBeg :: Int

How many rows of data to skip from the beginning (from *first* row); used in cropping

_bmps_rowFromEnd :: Int

How many rows of data to skip from the end; used in cropping

_bmps_columnFromBeg :: Int
 
_bmps_columnFromEnd :: Int
 

defaultBSFormat :: BitmapString Source

Default BitmapString format

This is equivalent to IBF_BGRU32

rowPadding :: BIndexType BitmapString -> Int -> Int -> (Int, Int) Source

Return (rowSize, paddingSize) based on width, bytes per pixel, and alignment

Be careful when using the results of this function that you're actually using the right value.

rowPaddingBS :: BitmapString -> (Int, Int) Source

Return (rowSize, paddingSize)

Be careful when using the results of this function that you're actually using the right value.

pixelPart :: BitmapString -> BPixelType BitmapString -> Int -> StringCellChar GenStringDefault Source

Get part of a pixel as a cell of GenStringDefault

The bitmap passed is only used for its format; its dimensions and data are not used. This function doesn't return any alpha parts; for those it returns pad bytes, which are zero.

constructBitmapStringFormatted :: BitmapString -> Dimensions (BIndexType BitmapString) -> (Coordinates (BIndexType BitmapString) -> BPixelType BitmapString) -> BitmapString Source

Construct a bitmap in the format of the meta bitmap passed

Only the format fields of the bitmap is used, so the data and dimensions of it can be undefined.

The data in the new bitmap is what GenStringDefault is aliased to.

encodeBSFormat :: Stringy s => BitmapString -> BitmapString -> s Source

Used by the encoders