July 09, 2011
On 7/9/11, Johannes Pfau <spam@example.com> wrote:
> //Use Andrej Mitrovic's API from
> //https://github.com/AndrejMitrovic/DWindowsProgramming/tree/master/win32
> version(EXT_WIN32_BINDINGS)
> {
>     import win32.windef;
>     import win32.wingdi;
> }

That's not my API, it's from this project:
http://dsource.org/projects/bindings/wiki/WindowsApi
Also the imports were just demonstrative, I'd have to find out exactly
which modules your library needs (I think it only needs HDC and some
HFONT definitions, because I've had to do the same for my direct C
bindings).

Otherwise I guess that might work.
July 09, 2011
I'll see about contributing to your project in some way. I'm interested in how Cairo's new opengl backend operates, animation works somewhat ok with a win32 backend but it seems to quickly eat up performance (that could be my mistake though). I'll give a shot at using the cairo opengl backend via Derelict.

Also, the Cairo team recommends using pangocairo over Cairo's native text rendering API functions for anything more complicated than simple text rendering. The Pango dev and bin package from http://www.gtk.org/download/index.php contains the pangocairo.h header file which imports cairo.h, but pango also has a ton of other headers so this might well be out of the scope of your project. I haven't tried used pango's text rendering yet.
July 09, 2011
The docs on the Boost license say as much as well, and derive from legal consult. I must say that after reading this I felt a lot better about the headers I've implemented.

Sent from my iPhone

On Jul 9, 2011, at 1:56 AM, Mike Parker <aldacron@gmail.com> wrote:

> On 7/9/2011 5:43 AM, Steven Schveighoffer wrote:
>> On Fri, 08 Jul 2011 16:02:39 -0400, Johannes Pfau <spam@example.com> wrote:
>> 
>>> Steven Schveighoffer wrote:
>>>> On Fri, 08 Jul 2011 15:39:22 -0400, Johannes Pfau <spam@example.com> wrote:
>>>> 
>>>>> Andrej Mitrovic wrote:
>>>>>> What's the license on the bindings?
>>>>> 
>>>>> Have not thought about that yet, but I think I'll use the boost
>>>>> license. (I'm not sure if that's possible, as
>>>>> cairo is LGPL, maybe I'll have to release the binding part at least
>>>>> as LGPL, as that's based on the cairo headers? Stupid licensing
>>>>> stuff... )
>>>>> 
>>>> 
>>>> I'm not a lawyer, but I think LGPL just covers the library code, not the bindings, as long as the link is dynamic. In other words, LGPL specifically allows dynamically linking with any license, as long as the library remains LGPL.
>>>> 
>>>> For reference, the C standard library (which phobos uses extensively)
>>>> is LGPL on Linux (glibc).
>>>> 
>>>> -Steve
>>> 
>>> True, but in this case the bindings were translated from the cairo c headers. I wasn't sure if the bindings could be considered a derivate work.
>> 
>> Well, if we look at this logically -- if the C headers contain so much code that using them would require releasing your software under LGPL, then why even use LGPL? The only point for using LGPL is to allow other licensed code to use your library, yet still have your library be under the GPL. If linking a C application using the C headers doesn't require GPL'ing your code (or LGPL'ing), then I can't see how a translation of them would require it.
>> 
>> But almost certainly a translation of the headers is a derived work, so the bindings themselves should have the same license as the headers (LGPL). I think this should cause no problems with linking proprietary code. I don't think it would qualify as a phobos module though.
>> 
> 
> A few years back I was concerned about this same issue with my SDL bindings in Derelict. SDL was licensed under the LGPL. So I posted a question to the SDL mailing list. The maintainer, Sam Lantinga, answered thus:
> 
> "The API is not copyrighted, only the SDL implementation is.  I would consider this a work that uses the library, rather than a derivative work.  You'll notice that using inline functions in LGPL headers, which technically places code from those headers in your object code, also does not change your work into a derivative work - it remains a work that uses the library."
> 
> That reinforced my own understanding. So for years now the license for Derelict's bindings has usually been different from the C libraries. That's especially true for Derelict 2, which is licensed under Boost.
> 
> Realistically, I'd like to release Derelict with no license at all. I'm not sure exactly what it is I'm licensing. The lion's share of original code in the project is in the utility package. The bindings themselves generally have very little non-interface code, just what's required to implement the loader. But I've learned that people get nervous when there's no license attached to a library. So Boost it is.
July 09, 2011
Andrej Mitrovic wrote:
>On 7/9/11, Johannes Pfau <spam@example.com> wrote:
>> //Use Andrej Mitrovic's API from
>> //https://github.com/AndrejMitrovic/DWindowsProgramming/tree/master/win32
>> version(EXT_WIN32_BINDINGS)
>> {
>>     import win32.windef;
>>     import win32.wingdi;
>> }
>
>That's not my API, it's from this project:
>http://dsource.org/projects/bindings/wiki/WindowsApi
>Also the imports were just demonstrative, I'd have to find out exactly
>which modules your library needs (I think it only needs HDC and some
>HFONT definitions, because I've had to do the same for my direct C
>bindings).
>
>Otherwise I guess that might work.

Ok, I knew about the WindowsApi project, but I thought the headers in your repo were more recent / different. I guess I was wrong ;-)

Let's see what answers your thread in the D newsgroup will get.
-- 
Johannes Pfau

July 09, 2011
Andrej Mitrovic wrote:
>I'll see about contributing to your project in some way. I'm interested in how Cairo's new opengl backend operates, animation works somewhat ok with a win32 backend but it seems to quickly eat up performance (that could be my mistake though). I'll give a shot at using the cairo opengl backend via Derelict.

I'm not sure if cairo's win32 backend uses some kind of acceleration? http://cairographics.org/threaded_animation_with_cairo/ talks about performance & animations, it's quite gtk specific, but maybe there's some useful information in there.

>Also, the Cairo team recommends using pangocairo over Cairo's native text rendering API functions for anything more complicated than simple text rendering. The Pango dev and bin package from http://www.gtk.org/download/index.php contains the pangocairo.h header file which imports cairo.h, but pango also has a ton of other headers so this might well be out of the scope of your project. I haven't tried used pango's text rendering yet.

I had a short look at pango some time ago as I also heard that it's the best way to do text rendering. Writing bindings for pango shouldn't be too difficult, but it's quite some work. All headers together are ~4800 lines of code. Pango also uses glib, so some glib bindings will also be needed. I think I'll finish the cairo wrapper first and then I might have a look at pango.

-- 
Johannes Pfau

July 09, 2011
On 7/9/11, Johannes Pfau <spam@example.com> wrote:
> I'm not sure if cairo's win32 backend uses some kind of acceleration? http://cairographics.org/threaded_animation_with_cairo/ talks about performance & animations, it's quite gtk specific, but maybe there's some useful information in there.

I'm already using multithreading. The performance issue I'm having is related to constantly creating and deleting a cairo surface and the cairo context.

Here cairo uses a backbuffer, draws to it, and then I do a blit via a GDI function:

case WM_PAINT:
            _buffer    = CreateCompatibleDC(hdc);
            hBitmap    = CreateCompatibleBitmap(hdc, width, height);
            hOldBitmap = SelectObject(_buffer, hBitmap);

            surf = cairo_win32_surface_create(_buffer);
            ctx = cairo_create(surf);

            DrawStuff(ctx, rc);

            BitBlt(hdc, 0, 0, width, height, _buffer, x, y, SRCCOPY);
            SelectObject(_buffer, hOldBitmap);
            DeleteObject(hBitmap);
            DeleteDC(_buffer);
            EndPaint(hwnd, &ps);

I'm trying to remove the calls to create/delete functions, I only really need them in two cases: when I initialize the window, and when the window is resized. If I do that I will still get performance issues when resizing because I get numerous WM_SIZE messages very rapidly as the window is resized, and just calling Create/Delete takes about 10% CPU time.

Probably a more clever way to do this is to initially create a big buffer that can fit the entire screen, and then just limit painting to the visible rectangle. This way I could avoid calling create/delete. But that wastes memory.

I'll look around the cairo newsgroups/websites to see how people handle window resizing.
July 10, 2011
On 2011-07-09 20:00, Johannes Pfau wrote:
> Andrej Mitrovic wrote:
>> I'll see about contributing to your project in some way. I'm
>> interested in how Cairo's new opengl backend operates, animation works
>> somewhat ok with a win32 backend but it seems to quickly eat up
>> performance (that could be my mistake though). I'll give a shot at
>> using the cairo opengl backend via Derelict.
>
> I'm not sure if cairo's win32 backend uses some kind of
> acceleration? http://cairographics.org/threaded_animation_with_cairo/
> talks about performance&  animations, it's quite gtk specific, but
> maybe there's some useful information in there.
>
>> Also, the Cairo team recommends using pangocairo over Cairo's native
>> text rendering API functions for anything more complicated than simple
>> text rendering. The Pango dev and bin package from
>> http://www.gtk.org/download/index.php contains the pangocairo.h header
>> file which imports cairo.h, but pango also has a ton of other headers
>> so this might well be out of the scope of your project. I haven't
>> tried used pango's text rendering yet.
>
> I had a short look at pango some time ago as I also heard that it's the
> best way to do text rendering. Writing bindings for pango shouldn't be
> too difficult, but it's quite some work. All headers together are
> ~4800 lines of code. Pango also uses glib, so some glib bindings will
> also be needed. I think I'll finish the cairo wrapper first and then I
> might have a look at pango.
>

Aren't there already bindings for these libraries floating around somewhere out there? DWT should at least have partial bindings for these libraries.

-- 
/Jacob Carlborg
July 10, 2011
gtkD seems to have pango bindings. But the bindings themselves are LGPL.

DWT does seem to have some bindings to pango too. Btw, which license does DWT use? It would be good to update the http://prowiki.org/wiki4d/wiki.cgi?GuiLibraries page and fill that in.
July 10, 2011
On 2011-07-10 15:55, Andrej Mitrovic wrote:
> gtkD seems to have pango bindings. But the bindings themselves are LGPL.
>
> DWT does seem to have some bindings to pango too. Btw, which license
> does DWT use? It would be good to update the
> http://prowiki.org/wiki4d/wiki.cgi?GuiLibraries page and fill that in.

EPL, Eclipse Public License, I've updated the wiki.

-- 
/Jacob Carlborg
August 05, 2011
I've shortened the name so the new link is here: https://github.com/AndrejMitrovic/DWinProgramming

Since "windows" is trademarked I don't really want to use it in a projects name. :)
1 2 3 4 5 6 7 8
Next ›   Last »