Cairo on Windows vs 2017 140 or 141


#1

Has anyone gotten Cairo working on Windows with 140 or 141? I know there’s a few other posts floating around on here on this topic from over a year ago. If anyone has got it running I’d love some pointers.

thanks


#2

I’m actively working on this at the moment. We’re likely moving Cairo into an “official” CinderBlock similar to OpenCV as the binaries are rather large. Building it is fairly challenging but I should have something up in the coming days (hoping <1 week).


#3

Hi, may I ask if the work is done?
I compiled several samples depends on cairo in VS2017 141, and got errors about linking issues.


#4

I am working from VS2017 141 and I’ve worked out all the issues with all the Cairo samples. Replacing the lib with a 141 built one will get rid of the linking error you get with the Cinder supplied version. Without having to get into that you can also paste a fix into all the samples:

FILE _iob[] = { *stdin, *stdout, *stderr };
extern “C” FILE * __cdecl __iob_func(void) { return _iob; }

So you can get those Cairo samples to build, but some of them are going to reveal a pretty big problem when you run them. Double buffering is enabled but the mechanism that is supposed to give you handle to the back buffer is actually giving the handle of the window. The good news is that this is fixable and that the right method of getDC() is already in place. In cinder::app::Renderer.cpp change:

HDC Renderer2d::getDc() const
{
return mWindowImpl->getDc();
}

to

HDC Renderer2d::getDc() const
{
return mImpl->getDc();
}

The mImpl->getDc() method is declared in cinder::app::msw::RendererImpl2dGdi.h as:

virtual HDC getDc() const { return ( mDoubleBuffer ) ? mDoubleBufferDc : mPaintDc; }

There are a lot of samples that are affected, including Renderer2dBasic which doesn’t use Cairo. I have only be playing with Cinder for about a week so I don’t know how long it’s been like this. I will see how it goes with my pull request.