Thread overview
How to draw a simple square with gtk-d ?
Dec 10
Mike Shah
December 08

I look for a demo program how to draw a simple square with gtk-d ?

December 10

On Sunday, 8 December 2024 at 04:06:40 UTC, Alain De Vos wrote:

>

I look for a demo program how to draw a simple square with gtk-d ?

Probably worth pointing you toward https://github.com/rontarrant/gtkDcoding/tree/master/_posts for now as that is probably the most complete set of examples.

There should be some examples of drawing images, or otherwise setting up a drawing area which may be what you wanted.

December 10

On Sunday, 8 December 2024 at 04:06:40 UTC, Alain De Vos wrote:

>

I look for a demo program how to draw a simple square with gtk-d ?

Are you looking for drawing green square using D or gtk? (I observed your comment in reddit/r/crystal_programming as well). You can use Chitra library to draw a square and save it as png. Try it out.

import chitra;

void main()
{
    // Canvas of size 400x400
    auto ctx = new Chitra(400);
    ctx.fill(0, 255, 0);
    ctx.square(0, 0, 400);
    ctx.saveAs("green_rect.png");
}

Refer https://github.com/aravindavk/chitra-d for installation and usage details.