dplug.graphics.image

In-memory images.

Public Imports

dplug.graphics.color
public import dplug.graphics.color;
Undocumented in source.

Members

Aliases

GetInputColor
alias GetInputColor(COLOR, INPUT) = Select!(is(COLOR == InputColor), INPUT, COLOR)
Undocumented in source.
ViewColor
alias ViewColor(T) = typeof(T.init[0, 0])

Returns the color type of the specified view. By convention, colors are structs with numeric fields named after the channel they indicate.

Classes

OwnedImage
class OwnedImage(COLOR)

Manually managed image.

Enums

isDirectView
eponymoustemplate isDirectView(T)

Optionally, a view can also provide direct pixel access. We call these "direct views".

isTargetColor
eponymoustemplate isTargetColor(C, TARGET)
Undocumented in source.
isView
eponymoustemplate isView(T)

A view is any type which provides a width, height, and can be indexed to get the color at a specific coordinate.

isWritableView
eponymoustemplate isWritableView(T)

Views can be read-only or writable.

Functions

blitTo
void blitTo(SRC src, DST dst)

Blits a view onto another. The views must have the same size.

blitTo
void blitTo(SRC src, DST dst, int x, int y)

Helper function to blit an image onto another at a specified location.

convertImageToOwnedImage_l16
OwnedImage!L16 convertImageToOwnedImage_l16(Image image)
convertImageToOwnedImage_l8
OwnedImage!L8 convertImageToOwnedImage_l8(Image image)
convertImageToOwnedImage_rgb8
OwnedImage!RGB convertImageToOwnedImage_rgb8(Image image)

Convert and disown gamut Image to OwnedImage. Result: ìmage` is disowned, result is owning the image data.

convertImageToOwnedImage_rgba8
OwnedImage!RGBA convertImageToOwnedImage_rgba8(Image image)

Convert and disown gamut Image to OwnedImage. Result: ìmage` is disowned, result is owning the image data.

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

Copy a view's pixels (top-to-bottom) to a COLOR buffer.

copyScanline
void copyScanline(SRC src, int y, COLOR[] dst)

Copy the indicated row of src to a COLOR buffer.

createViewFromImageRef
void createViewFromImageRef(Image view, ImageRef!COLOR source)

Make a gamut Image view from a dplug:graphics ImageRef. The original OwnedImage is still the owner of the pixel data.

cropImageRef
ImageRef!COLOR cropImageRef(ImageRef!COLOR src, box2i rect)
ImageRef!COLOR cropImageRef(ImageRef!COLOR src, int xmin, int ymin, int xmax, int ymax)

Crop an ImageRef and get an ImageRef instead of a Voldemort type. This also avoid adding offset to coordinates.

loadImageSeparateAlpha
OwnedImage!RGBA loadImageSeparateAlpha(void[] imageDataRGB, void[] imageDataAlpha)

Loads two different images: - the 1st is the RGB channels - the 2nd is interpreted as greyscale and fetch in the alpha channel of the result. The returned OwnedImage!RGBA should be destroyed with destroyFree.

loadOwnedImage
OwnedImage!RGBA loadOwnedImage(void[] imageData)

Loads an image from compressed data. The returned OwnedImage!RGBA should be destroyed with destroyFree.

loadOwnedImageDepth
OwnedImage!L16 loadOwnedImageDepth(void[] imageData)

Loads an image to be a 16-bit one channel image (OwnedImage!L16). The returned OwnedImage!L16 should be destroyed with destroyFree.

size
void size(V src, int w, int h)

Default implementation for the .size method. Asserts that the view has the desired size.

toRef
ImageRef!L8 toRef(OwnedImage!L8 src)
ImageRef!L16 toRef(OwnedImage!L16 src)
ImageRef!RGBA toRef(OwnedImage!RGBA src)

Convert an OwnedImage to an ImageRef.

Mixin templates

DirectView
mixintemplate DirectView()

Mixin which implements view primitives on top of existing direct view primitives.

Warp
mixintemplate Warp(V)

Mixin which implements view primitives on top of another view, using a coordinate transform function.

Structs

ImageRef
struct ImageRef(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
Undocumented in source.
TargetColor
struct TargetColor
Undocumented in source.

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/.