How to draw a simple square with gtk-d ?

Aravinda VK mail at aravindavk.in
Tue Dec 10 08:12:29 UTC 2024


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.

```d
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.


More information about the Digitalmars-d-learn mailing list