digitalmars.D.learn - Plot one pixel in blue on a canvas
- Alain De Vos (9/9) Nov 29 I want to plot a pixel in blue at coordinates (100,100) on a
- Sergey (9/11) Nov 29 Check this lib from p0nce maybe
- Alain De Vos (2/13) Nov 29 Can i how the image on screen while i draw ?
- Aravinda VK (33/42) Dec 01 You can use Chitra library. It is still under active development,
- Aravinda VK (16/58) Dec 01 Missed adding color in the above example (Also added the
I want to plot a pixel in blue at coordinates (100,100) on a canvas of size (200,200) I think i can use the arsd module. But i have no idea what "dub add" comment I should use. What i should import How this demo program would look. Cfr, https://www.reddit.com/r/scala/comments/1h2g8a2/simple_graphics_api/ https://www.reddit.com/r/fsharp/comments/1h2g7pv/simple_graphics_api/
Nov 29
On Friday, 29 November 2024 at 14:02:38 UTC, Alain De Vos wrote:I want to plot a pixel in blue at coordinates (100,100) on a canvas of size (200,200)Check this lib from p0nce maybe https://code.dlang.org/packages/canvasity. So steps should be like: ```bash dub init dub add canvasity ``` Couple of demos are presented in the description.
Nov 29
On Friday, 29 November 2024 at 15:01:12 UTC, Sergey wrote:On Friday, 29 November 2024 at 14:02:38 UTC, Alain De Vos wrote:Can i how the image on screen while i draw ?I want to plot a pixel in blue at coordinates (100,100) on a canvas of size (200,200)Check this lib from p0nce maybe https://code.dlang.org/packages/canvasity. So steps should be like: ```bash dub init dub add canvasity ``` Couple of demos are presented in the description.
Nov 29
On Friday, 29 November 2024 at 14:02:38 UTC, Alain De Vos wrote:I want to plot a pixel in blue at coordinates (100,100) on a canvas of size (200,200) I think i can use the arsd module. But i have no idea what "dub add" comment I should use. What i should import How this demo program would look. Cfr, https://www.reddit.com/r/scala/comments/1h2g8a2/simple_graphics_api/ https://www.reddit.com/r/fsharp/comments/1h2g7pv/simple_graphics_api/You can use Chitra library. It is still under active development, working on adding support for text and curves. Refer this documentation to install the dependencies and add Chitra to your project. Chitra is based on Cairo Graphics for 2D graphics and PangoCairo for rendering texts. https://github.com/aravindavk/chitra-d Example for your use case, ```d import chitra; void main() { auto ctx = new Chitra(200, 200); ctx.pixel(100, 100); ctx.saveAs("dot.png"); } ``` Or just run the file without installing it, like below. Create a file `dot.d` with the following content. ```d /+ dub.sdl: dependency "chitra" version="~>0.1.0" +/ import chitra; void main() { auto ctx = new Chitra(200, 200); ctx.pixel(100, 100); ctx.saveAs("dot.png"); } ``` And run as `dub dot.d` Let me know if this works for you. Thanks.
Dec 01
On Sunday, 1 December 2024 at 16:40:56 UTC, Aravinda VK wrote:On Friday, 29 November 2024 at 14:02:38 UTC, Alain De Vos wrote:Missed adding color in the above example (Also added the alternate syntax using `with` statement). ```d import chitra; void main() { auto ctx = new Chitra(200, 200); with(ctx) { fill("blue"); pixel(100, 100); saveAs("dot.png"); } } ```I want to plot a pixel in blue at coordinates (100,100) on a canvas of size (200,200) I think i can use the arsd module. But i have no idea what "dub add" comment I should use. What i should import How this demo program would look. Cfr, https://www.reddit.com/r/scala/comments/1h2g8a2/simple_graphics_api/ https://www.reddit.com/r/fsharp/comments/1h2g7pv/simple_graphics_api/You can use Chitra library. It is still under active development, working on adding support for text and curves. Refer this documentation to install the dependencies and add Chitra to your project. Chitra is based on Cairo Graphics for 2D graphics and PangoCairo for rendering texts. https://github.com/aravindavk/chitra-d Example for your use case, ```d import chitra; void main() { auto ctx = new Chitra(200, 200); ctx.pixel(100, 100); ctx.saveAs("dot.png"); } ``` Or just run the file without installing it, like below. Create a file `dot.d` with the following content. ```d /+ dub.sdl: dependency "chitra" version="~>0.1.0" +/ import chitra; void main() { auto ctx = new Chitra(200, 200); ctx.pixel(100, 100); ctx.saveAs("dot.png"); } ``` And run as `dub dot.d` Let me know if this works for you. Thanks.
Dec 01