I have a canvas, into which I DrawPicture an image after drawing the background color of the canvas:
Sub Paint(g As Graphics, areas() As REALbasic.Rect)
#if TargetLinux
g.forecolor = &c36353500
#ElseIf TargetMacOS
g.forecolor = &c36333600
#endif
g.FillRectangle(0, 0, g.Width, g.Height)
g.DrawPicture(owclogo_56, 0, 0)
End Sub
Under Linux, the color is correct and the background of the canvas is the same color as the window I’m drawing onto (I’m covering a default graphics that is baked into the window’s background). However, on macOS, the background is black (0,0,0).
Also, when type “g.Fo[TAB]” in that event, ForeColor does not autocomplete, nor is it listed as an option in the popup list.
Is painting using a FillRectangle broken on macOS?
That’s above my pay grade Probably some mac magic where they change colors depending on the moon phase or how bright the room is or some other daft metric. Someone else might be able to shed some light on that one (pun intended).
Possibly an issue with the way the transparency is set on the image, or the way the framework loads it in, or the moon phase Try the ball image from here Scrollbar nightmare - #4 by anon20074439
That one’s clean. Could it be that the image I’m using is a multiple image, hi-def support PNG (even though I’ve never seen this before)? The images that make up the xojo_image were created with Preview.
Highly likely, it could be that its got multiple images in there or that it was made with preview or a mix of both or that xojo’s png image loader fails on one of those combos, but without testing its a bit of a guess.
Maybe windows and linux just selects the first image it comes across where as the mac version tries to intelligently select the correct image which either has an issue with the transparency or it forgets to load the transparency. Again not sure, sorry I can’t really help any more, maybe some of the more mac centric peeps can help out here.
It may be due to the ratios of the three images in. the xojo_image being off by 1 pixel and the @2 image being slightly scaled. I’m going back to the original AI image and recut it so that it’s properly divisible nd reimport them.
The color you get on a Mac will vary according to color profiles.
While I know ‘pros’ want this stuff, it’s a pain.
In your shoes, I would try this for a ‘quick fix’:
(ps I personally dont like IF… ELSEIF on the grounds of clarity)
Code…
Sub Paint(g As Graphics, areas() As REALbasic.Rect)
g.forecolor = &c36333600 //default value
#if TargetLinux
//use something else on Linux
g.forecolor = &c36353500
#endif
g.FillRectangle(0, 0, g.Width, g.Height)
g.DrawPicture(owclogo_56, 0, 0)
End Sub
The OWC image is a simple 2 color thing… invert it and apply the inversion as a mask.
That will guarantee you have control of what is shown and what is not.