GUI library for D

Matthias Pleh jens at konrad.net
Wed Apr 6 10:15:38 PDT 2011


Am 06.04.2011 17:35, schrieb Michel Fortin:
> On 2011-04-06 10:25:42 -0400, Matthias Pleh <jens at konrad.net> said:
>
>> Am 06.04.2011 14:49, schrieb Michel Fortin:
>>> final class Bitmap(Color) : Image {
>>> void opIndexAssign(int x, int y, Color color) {
>>> pixels[y * width + x] = Color(color);
>>> }
>>>
>>> size_t width, height;
>>> Color[] pixels;
>>> }
>>
>> Yep, exactly. I would implement it as template.
>>
>> About the render backend, Nick mentioned.
>> In the first step, I would just draw all objects (lines, boxes,
>> circles) to the buffer and then render it as image per gdi/xlib.
>>
>> this render should ideally be in a single file, so other backends can
>> be implemented (gdi/direct2d/cairo/xcb/cocoa/..)
>
> Since you're at it, have you considered making the API flexible enough
> so it could support vector images too?
>
> // return an object derived from image depending on the actual file type
> Image im = loadImage("filename");
>
> // creating a bitmap for on-screen rendering
> auto bitmap = new Bitmap!RGBColor(im.width, im.height);
>
> // base image class has a virtual function to draw itself on a bitmap at
> // a given location, so it's easy to draw it on screen
> im.draw(10, 10, bitmap);
>


Yep, definitley this would be an issue to place on the todo-list.
But let's just start with a basic implementation with simple raster 
graphics, but always in mind to extand it in the future.
BTW: to implement the whole SVG specification, that would be a huge 
project, but basic vector drawings would be definitive a nice thing to have.

°Matthias


More information about the Digitalmars-d mailing list