On Tuesday, 24 March 2015 at 13:31:06 UTC, Eric wrote:
BTW, why do you need FreeImage to create image? Isn't it just
possible inside dlangui?
This is basically my question. Is there a drawing engine that
can draw lines, circles, and shapes as well as single pixels?
-Eric
Hello,
I've implemented CanvasWidget today as convenient way of custom
drawing, and added drawPixel and drawLine methods to DrawBuf.
See example1 / Canvas tab.
Sample code:
CanvasWidget canvas = new CanvasWidget("canvas");
canvas.layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT);
canvas.onDrawListener = delegate(CanvasWidget canvas, DrawBuf
buf, Rect rc) {
buf.fill(0xFFFFFF);
int x = rc.left;
int y = rc.top;
buf.fillRect(Rect(x+20, y+20, x+150, y+200), 0x80FF80);
buf.fillRect(Rect(x+90, y+80, x+250, y+250), 0x80FF80FF);
canvas.font.drawText(buf, x + 40, y + 50, "fillRect()"d,
0xC080C0);
buf.drawFrame(Rect(x + 400, y + 30, x + 550, y + 150),
0x204060, Rect(2,3,4,5), 0x80704020);
canvas.font.drawText(buf, x + 400, y + 5, "drawFrame()"d,
0x208020);
canvas.font.drawText(buf, x + 300, y + 100, "drawPixel()"d,
0x000080);
for (int i = 0; i < 80; i++)
buf.drawPixel(x+300 + i * 4, y+140 + i * 3 % 100, 0xFF0000 + i
* 2);
canvas.font.drawText(buf, x + 200, y + 250, "drawLine()"d,
0x800020);
for (int i = 0; i < 40; i+=3)
buf.drawLine(Point(x+200 + i * 4, y+290), Point(x+150 + i * 7,
y+420 + i * 2), 0x008000 + i * 5);
};