dplug.graphics.view

A View is the base abstraction for images. Port of ae.utils.graphics.

Public Imports

dplug.graphics.color
public import dplug.graphics.color;

Members

Aliases

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.

Enums

isDirectView
eponymoustemplate isDirectView(T)

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

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.

crop
auto crop(V src, int x0, int y0, int x1, int y1)

Crop a view to the specified rectangle.

onePixel
auto onePixel(COLOR c)

Return a 1x1 view of the specified color. Useful for testing.

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

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

solid
auto solid(COLOR c, int w, int h)

Returns a view of the specified dimensions and same solid color.

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.

Templates

procedural
template procedural(alias formula)

Returns a view which calculates pixels on-demand using the specified formula.

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 <vladimir@thecybershadow.net> Guillaume Piolat <contact@auburnsounds.com>