arsd.ico

Load (and, in the future, save) support for Windows .ico icon files.

Members

Functions

loadIco
MemoryImage[] loadIco(string filename)
loadIcoFromMemory
MemoryImage[] loadIcoFromMemory(const(ubyte)[] data)

Loads a ico file off the given file or from the given memory block.

Examples

void main() {
	auto thing = loadIco("test.ico");
	import std.stdio;
	writeln(thing.length); // tell how many things it found

	/+ // just to display one
	import arsd.simpledisplay;
	auto img = new SimpleWindow(thing[0].width, thing[0].height);
	{
	auto paint = img.draw();
	paint.drawImage(Point(0, 0), Image.fromMemoryImage(thing[0]));
	}

	img.eventLoop(0);
	+/

	// and this converts all its versions
	import arsd.png;
	import std.format;
	foreach(idx, t; thing)
		writePng(format("test-converted-%d-%dx%d.png", idx, t.width, t.height), t);
}

Meta

History

Written July 21, 2022 (dub v10.9)