Tiny SVG mouse cursor is transparent on OS/X, not windows


I’m down to the very last few bugs in my cross-platform app!

This one might be new, because I updated everything to the modules branch recently… or I might not have noticed it before.

I have an SVG image that I use to make a mouse cursor of a magnifying glass. This cursor is transparent on OS/X, but it is not on Windows.

Interestingly enough, in a Windows debug build, the cursor background is a uniform grey - on Mac, the cursor background is a hodgepodge, leading me to believe I’m seeing uninitialized memory.

Here’s the code I use to create the icon:static juce::Image* getZoomCursor() { ptr<juce::Image> img(new juce::Image(juce::Image::RGB, ZOOM_CURSOR_WIDTH, ZOOM_CURSOR_HEIGHT, false)); Graphics g(*img); ptr<Drawable> drawable(gui::icon::ZoomInCursor::create()); drawable->draw(g, 1.0f); return img.transfer(); }

Here’s the SVG for the icon:[code]

<?xml version="1.0" ?> [/code]

(OT: the Image class has copy-by-value semantics, you know? No need to ever allocate one on the heap…)

And in your image’s constructor, you’re setting the “clear” parameter to false, which explains why you’d get junk in the background.

As for win32 mouse cursors, I can’t remember if they can even do an 8-bit alpha channel…?

I like the new picture, very handsome!

And DOH! on the copy-by-value semantics.

I unfortunately did play with that “clear” parameter in my experimentation. If I set it to “true”, then the cursor ends up being a completely black square, on Windows only, and again, perfectly OK on the Mac.

There must be some way in Windows to get partly transparent cursors - or else every Windows cursor would be rectangular shaped…!

Oh sorry, you’d also need to use an ARGB image, not RGB!


I suppose that one was obvious in the end - you get blinded by the fact that it works on one platform and not the other.

Except for the bizarre “BD-ROM is recognized as some obscure German self-help CD” issue, which I have instrumented and hope to get more information on (and isn’t really a serious issue), this means I AM OUT OF BUGS AND CAN RELEASE MY PROGRAM!!!

(Ahem… out of “known” bugs…)

But congratulations! Looking forward to seeing what you’ve been cooking up!

Actually, I’m not even out of known bugs :smiley: just “known bugs for this release”.

It’s a fun program, though I spent too much time on something so small. But I hadn’t done desktop development in almost two decades(!) so it was very instructive.