GDICanvas

A canvas with added GDI functionality.

Constructors

this
this(uint w, uint h)
Undocumented in source.

Members

Aliases

StorageType
alias StorageType = OneBitStorageBE

Storage type used by the GDI buffer.

StorageType
alias StorageType = PlainStorageUnit!COLOR
Undocumented in source.

Functions

opDispatch
auto opDispatch(A args)

Forwards Windows GDI calls.

scanline
inout(StorageType)[] scanline(xy_t y)

DirectView interface.

Mixins

__anonymous
mixin DirectView
Undocumented in source.

Structs

Data
struct Data

Wraps and owns the Windows API objects.

Variables

data
RefCounted!Data data;

Reference to the Windows API objects.

h
xy_t h;

Geometry.

w
xy_t w;

Geometry.

Mixed In Members

From mixin DirectView

StorageType
alias StorageType = Unqual!(typeof(scanline(0)[0]))
Undocumented in source.
COLOR
alias COLOR = Unqual!(typeof(StorageType.init[0]))
Undocumented in source.
opIndex
inout(COLOR) opIndex(xy_t x, xy_t y)

Implements the view[x, y] operator.

Row
struct Row

Allows array-like viewyx access.

opIndex
Row opIndex(xy_t y)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndexAssign
COLOR opIndexAssign(COLOR value, xy_t x, xy_t y)

Implements the view[x, y] = c operator.

Examples

	alias RGB = ae.utils.graphics.color.RGB;

//	alias BGR COLOR;
	alias BGRX COLOR;
	auto b = GDICanvas!COLOR(100, 100);
	b.fill(COLOR(255, 255, 255));

	const str = "Hello, world!";
	auto f = CreateFont(-11, 0, 0, 0, 0, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Tahoma"); scope(exit) DeleteObject(f);
	b.SelectObject(f);
	b.SetBkColor(0xFFFFFF);
	b.SetTextColor(0x0000FF);
	b.TextOutA(10, 10, str.ptr, cast(uint)str.length);

	b.SetPixel(5, 5, 0xFF0000);
	GdiFlush();
	b[6, 6] = COLOR(255, 0, 0);

	import ae.utils.graphics.image;
	auto i = b.copy.colorMap!(c => RGB(c.r,c.g,c.b))();
	assert(i[5, 5] == RGB(0, 0, 255));
	assert(i[6, 6] == RGB(0, 0, 255));
	assert(i[7, 7] == RGB(255, 255, 255));

//	i.savePNG("gditest.png");
//	i.savePNM("gditest.pnm");

Meta