ae.utils.graphics.image

In-memory images and various image formats.

Public Imports

ae.utils.graphics.view
public import ae.utils.graphics.view;
Undocumented in source.

Members

Aliases

ElementViewImage
alias ElementViewImage(R) = ViewImage!(ElementType!R)

Resolves to an Image with the same color type as the element type of the view range R.

GetInputColor
alias GetInputColor(COLOR, INPUT) = Select!(is(COLOR == InputColor), INPUT, COLOR)

Resolves COLOR to INPUT if it is InputColor.

ViewImage
alias ViewImage(V) = Image!(ViewColor!V)

Resolves to an Image with the same color type as the view V.

Enums

PNGColourType
enum PNGColourType

PNG image attributes.

PNGCompressionMethod
enum PNGCompressionMethod
Undocumented in source.
PNGFilterAdaptive
enum PNGFilterAdaptive
Undocumented in source.
PNGFilterMethod
enum PNGFilterMethod
Undocumented in source.
PNGInterlaceMethod
enum PNGInterlaceMethod
Undocumented in source.
bitmapNeedV4HeaderForRead
eponymoustemplate bitmapNeedV4HeaderForRead(COLOR)
Undocumented in source.
bitmapNeedV4HeaderForWrite
eponymoustemplate bitmapNeedV4HeaderForWrite(COLOR)

Whether to use a V4 BMP header for the given color type. Different software have different standards regarding alpha without a V4 header. ImageMagick will write BMPs with alpha without a V4 header, but not all software will read them.

isTargetColor
eponymoustemplate isTargetColor(C, TARGET)

Workaround for https://issues.dlang.org/show_bug.cgi?id=12433

Functions

bitmapChannelMasks
uint[4] bitmapChannelMasks()

Calculates bV4RedMask etc. values for the given color type.

copy
auto copy(SRC src, TARGET target)

Copy the given view into the specified target.

copy
auto copy(SRC src)

Copy the given view into a newly-allocated image.

copyPixels
void copyPixels(SRC src, StorageType[] dst)

Copy a view's pixels (top-to-bottom) to a StorageType buffer. Rows are assumed to be StorageType.sizeof-aligned.

copyScanline
void copyScanline(SRC src, xy_t y, StorageType[] dst)

Copy the indicated row of src to a StorageType buffer.

downscaleTo
auto downscaleTo(SRC src, TARGET target)

Downscaling copy (averages colors in source per one pixel in target).

downscaleTo
auto downscaleTo(SRC src, xy_t w, xy_t h)

Downscales an image to a certain size.

fromPixels
auto fromPixels(INPUT[] input, xy_t w, xy_t h, TARGET target)
auto fromPixels(INPUT[] input, xy_t w, xy_t h)

Loads a raw COLOR[] into an image of the indicated size.

hjoin
auto hjoin(R images, TARGET target)
auto hjoin(R images)

Splice multiple images horizontally.

makePNG
ubyte[] makePNG(PNGChunk[] chunks)

Construct a PNG file out of the given PNG chunks.

parseBMP
auto parseBMP(const(void)[] data, TARGET target)
auto parseBMP(const(void)[] data)

Parses a Windows bitmap (.bmp) file.

parsePBM
auto parsePBM(const(void)[] vdata, TARGET target)
auto parsePBM(const(void)[] vdata)

Parses a binary Netpbm monochrome (.pgm) or RGB (.ppm) file.

toBMP
ubyte[] toBMP(SRC src)

Creates a Windows bitmap (.bmp) file.

toPBM
ubyte[] toPBM(SRC src)

Creates a binary Netpbm monochrome (.pgm) or RGB (.ppm) file.

toPNG
ubyte[] toPNG(SRC src, int compressionLevel)

Creates a PNG file. Only basic PNG features are supported (no filters, interlacing, palettes etc.)

toRef
ImageRef!(ViewColor!SRC) toRef(SRC src)

Convert a direct view to an ImageRef. Assumes that the rows are evenly spaced.

viewBMP
auto viewBMP(V data)

Returns a view representing a BMP file. Does not copy pixel data.

vjoin
auto vjoin(R images, TARGET target)
auto vjoin(R images)

Splice multiple images vertically.

Properties

bitmapPixelStride
size_t bitmapPixelStride [@property getter]

Calculates the BMP pixel stride for the given StorageType and width.

Static variables

pngSignature
ubyte[8] pngSignature;

The PNG file signature.

Structs

Image
struct Image(COLOR, StorageType = PlainStorageUnit!COLOR)

An in-memory image. Pixels are stored as contiguous scanlines, with each scanline consisting of one or more StorageType.

ImageRef
struct ImageRef(COLOR, StorageType = PlainStorageUnit!COLOR)

Represents a reference to COLOR data already existing elsewhere in memory. Assumes that pixels are stored row-by-row, with a known distance between each row.

InputColor
struct InputColor

Placeholder type used where an output color is specified, which indicates that the output color type should be the same as the input color.

PNGChunk
struct PNGChunk

A PNG chunk.

PNGChunkFooter
struct PNGChunkFooter
Undocumented in source.
PNGChunkHeader
struct PNGChunkHeader
Undocumented in source.
PNGHeader
struct PNGHeader

PNG header (IHDR).

TargetColor
struct TargetColor

Workaround for https://issues.dlang.org/show_bug.cgi?id=12433

Templates

BMPStorageType
template BMPStorageType(COLOR)

Resolves to the storage type to use for the given COLOR.

downscale
template downscale(int HRX, int HRY = HRX)

Performs linear downscale by a constant factor

Meta

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Authors

Vladimir Panteleev <ae@cy.md>