Jump to page: 1 2
Thread overview
Render SVG To Display And Update Periodically
Oct 17, 2016
Jason C. Wells
Oct 17, 2016
rikki cattermole
Oct 17, 2016
ketmar
Oct 17, 2016
ketmar
Oct 18, 2016
Karabuta
Oct 19, 2016
Basile B.
Oct 20, 2016
Jason C. Wells
Oct 20, 2016
Mike Parker
Oct 21, 2016
Jason C. Wells
Oct 22, 2016
Mike Parker
Oct 22, 2016
Adam D. Ruppe
Oct 22, 2016
Jason C. Wells
Oct 22, 2016
Mike Parker
Oct 22, 2016
Jason C. Wells
Oct 22, 2016
ketmar
Oct 22, 2016
Jason C. Wells
Oct 20, 2016
ketmar
Oct 20, 2016
ketmar
October 17, 2016
I have in mind a project to render instruments (speed, pressure, position) to a screen using SVG. I am able to produce the SVG easily enough. What I am looking for is a library/canvas/toolkit that I can use in D inside of a loop and update the instrument readouts.

This whole project is a vehicle for me to expand my mechanical engineering abilities into instrumentation and control. I've decided that D is the language I want to learn to do this.

I see things like Cairo and librsvg. Maybe a full blown GUI toolkit has the bits i need. The thing I have a hard time with is assessing whether or not these things are suitable for what I hope to do.

Thanks in advance,
Jason C. Wells
October 17, 2016
On 17/10/2016 2:20 PM, Jason C. Wells wrote:
> I have in mind a project to render instruments (speed, pressure,
> position) to a screen using SVG. I am able to produce the SVG easily
> enough. What I am looking for is a library/canvas/toolkit that I can use
> in D inside of a loop and update the instrument readouts.
>
> This whole project is a vehicle for me to expand my mechanical
> engineering abilities into instrumentation and control. I've decided
> that D is the language I want to learn to do this.
>
> I see things like Cairo and librsvg. Maybe a full blown GUI toolkit has
> the bits i need. The thing I have a hard time with is assessing whether
> or not these things are suitable for what I hope to do.
>
> Thanks in advance,
> Jason C. Wells

You're going to need to find an svg rasterizer in some form or another.
I don't think we have one in D and certainly not a complete one.

Otherwise you could always just make it as web application and let the web browser do all the rendering, which seems easier.
October 17, 2016
On Monday, 17 October 2016 at 02:07:47 UTC, rikki cattermole wrote:
> You're going to need to find an svg rasterizer in some form or another.
> I don't think we have one in D and certainly not a complete one.

'cmon, you know that i have a working port of NanoSVG! and it works on top of NanoVG, so no toolkit is required. ah...
October 17, 2016
On Monday, 17 October 2016 at 07:05:24 UTC, ketmar wrote:
> On Monday, 17 October 2016 at 02:07:47 UTC, rikki cattermole wrote:
>> You're going to need to find an svg rasterizer in some form or another.
>> I don't think we have one in D and certainly not a complete one.
>
> 'cmon, you know that i have a working port of NanoSVG! and it works on top of NanoVG, so no toolkit is required. ah...

oops, forgot to give some links. ;-)

nanovg and nanosvg ports: http://repo.or.cz/iv.d.git/tree/HEAD:/nanovg
some demos: http://repo.or.cz/iv.d.git/tree/HEAD:/nanovg_demo

to make it actually draw something, i'm using Adam's excellect simpledisplay from here: https://github.com/adamdruppe/arsd

fetching color.d and simpledisplay.d is enough, you don't need the whole repository. ;-)

it works at least in GNU/Linux and Windows. OSX is not tested.
October 18, 2016
On Monday, 17 October 2016 at 07:18:40 UTC, ketmar wrote:
> On Monday, 17 October 2016 at 07:05:24 UTC, ketmar wrote:
>> On Monday, 17 October 2016 at 02:07:47 UTC, rikki cattermole wrote:
>>> [...]
>>
>> 'cmon, you know that i have a working port of NanoSVG! and it works on top of NanoVG, so no toolkit is required. ah...
>
> oops, forgot to give some links. ;-)
>
> nanovg and nanosvg ports: http://repo.or.cz/iv.d.git/tree/HEAD:/nanovg
> some demos: http://repo.or.cz/iv.d.git/tree/HEAD:/nanovg_demo
>
> to make it actually draw something, i'm using Adam's excellect simpledisplay from here: https://github.com/adamdruppe/arsd
>
> fetching color.d and simpledisplay.d is enough, you don't need the whole repository. ;-)
>
> it works at least in GNU/Linux and Windows. OSX is not tested.

This thing really needs a GitHub repo + documentation after all the hardwork.
October 19, 2016
On Tuesday, 18 October 2016 at 21:00:12 UTC, Karabuta wrote:
> On Monday, 17 October 2016 at 07:18:40 UTC, ketmar wrote:
>> On Monday, 17 October 2016 at 07:05:24 UTC, ketmar wrote:
>>> [...]
>>
>> oops, forgot to give some links. ;-)
>>
>> nanovg and nanosvg ports: http://repo.or.cz/iv.d.git/tree/HEAD:/nanovg
>> some demos: http://repo.or.cz/iv.d.git/tree/HEAD:/nanovg_demo
>>
>> to make it actually draw something, i'm using Adam's excellect simpledisplay from here: https://github.com/adamdruppe/arsd
>>
>> fetching color.d and simpledisplay.d is enough, you don't need the whole repository. ;-)
>>
>> it works at least in GNU/Linux and Windows. OSX is not tested.
>
> This thing really needs a GitHub repo + documentation after all the hardwork.

https://github.com/Pctg-x8/nanovg-d, I even think it's been announced here last year.
October 20, 2016
This is probably a general programming question. I'll follow up here since this thread is the inspiration for my current question.

When attempting to compile simpledisplay.d, I get the following:

C:\...\dlang\arsd-master>dmd -Lgdi32.lib -L user32.lib simpledisplay.d color.d
OPTLINK (R) for Win32  Release 8.00.17
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
OPTLINK : Warning 9: Unknown Option : NOIGDI32.LIBUSER32.LIB
simpledisplay.obj(simpledisplay)
 Error 42: Symbol Undefined _D9invariant12_d_invariantFC6ObjectZv
simpledisplay.obj(simpledisplay)
** snip **

Interestingly enough, simpledisplay.obj and simpledisplay.exe are produced. Aren't errors fatal? The EXE is not a valid win32 application.

I am used to makefiles. The author doesn't use dub for these programs. (dub ~=make?)

gdi32.lib and user32.lib appear in multiple directories.  I added "C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64" to %LIB% which seemed sensible to do. I still get the warning:

OPTLINK : Warning 9: Unknown Option : NOIGDI32.LIBUSER32.LIB

So, I'm still figuring out how to set up a compile. I presume that dmd is not finding gdi32.lib and user32.lib.  What am I missing?

Regards,
Jason C. Wells
October 20, 2016
On Tuesday, 18 October 2016 at 21:00:12 UTC, Karabuta wrote:
> This thing really needs a GitHub repo
never.
October 20, 2016
On Wednesday, 19 October 2016 at 03:27:10 UTC, Basile B. wrote:
> https://github.com/Pctg-x8/nanovg-d, I even think it's been announced here last year.

this is wrapper. my thing is complete port.
October 20, 2016
On Thursday, 20 October 2016 at 04:52:11 UTC, Jason C. Wells wrote:
> This is probably a general programming question. I'll follow up here since this thread is the inspiration for my current question.
>
> When attempting to compile simpledisplay.d, I get the following:
>
> C:\...\dlang\arsd-master>dmd -Lgdi32.lib -L user32.lib simpledisplay.d color.d

Don't pass libraries with -L. Just do it like this:

dmd gdi32.lib user32.lib


> Interestingly enough, simpledisplay.obj and simpledisplay.exe are produced. Aren't errors fatal? The EXE is not a valid win32 application.

Those aren't errors. The linker thinks it has been passed a couple of options that it doesn't understand, but it will still proceed with the link.

>
> I am used to makefiles. The author doesn't use dub for these programs. (dub ~=make?)
>
> gdi32.lib and user32.lib appear in multiple directories.  I added "C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64" to %LIB% which seemed sensible to do. I still get the warning:
>
> OPTLINK : Warning 9: Unknown Option : NOIGDI32.LIBUSER32.LIB

See that OPTLINK in the error messages? That's the Digital Mars linker that ships with DMD. It doesn't know anything at all about the libraries that ship with the Windows kits. It uses the libraries that ship with DMD. The Windows SDK is only used when using the Microsoft linker, which only happens when passing -m64 or -m32mscoff to the compiler. By default (-m32), DMD uses OPTLINK.

Again, just pass the libraries without -L.

>
> So, I'm still figuring out how to set up a compile. I presume that dmd is not finding gdi32.lib and user32.lib.  What am I missing?

Your bigger issue, and why your compilation didn't produce a valid executable, is that you have no main function! Try something like the following:

Directory tree:
- testapp
-- test1.d
--- arsd
---- simpledisplay.d
---- color.d

In test1.d, using an example copy/pasted from the simpledisplay.d ddoc comments:

```
import arsd.simpledisplay;
import std.conv;
void main() {
    auto window = new SimpleWindow(Size(500, 500), "My D App");
    int y = 0;
    void addLine(string text) {
        auto painter = window.draw();
        if(y + painter.fontHeight >= window.height) {
            painter.scrollArea(Point(0, 0), window.width, window.height, 0, painter.fontHeight);
            y -= painter.fontHeight;
        }
        painter.outlineColor = Color.red;
        painter.fillColor = Color.black;
        painter.drawRectangle(Point(0, y), window.width, painter.fontHeight);
        painter.outlineColor = Color.white;
        painter.drawText(Point(10, y), text);
        y += painter.fontHeight;
    }
    window.eventLoop(1000,
      () {
        addLine("Timer went off!");
      },
      (KeyEvent event) {
        addLine(to!string(event));
      },
      (MouseEvent event) {
        addLine(to!string(event));
      },
      (dchar ch) {
        addLine(to!string(ch));
      }
    );
}
```

Then run the compiler with:

dmd test1.d arsd/simpledisplay.d arsd/color.d gdi32.lib user32.lib

IIRC, you don't need to pass user32.lib, as DMD will link it in by default (though I may be mistaken).




« First   ‹ Prev
1 2