This code for ShadowBrush.ShadowColor works well when drawing a graphic in a canvas, but when attempting with an image, it seems as though the shadow color is ignored and only displays as black. Is this expected? Is there a way around this without having to get creative and drawing a graphic underneath the actual image?
Was wondering this too Sam, thanks. This was on Mac 10.14, running Xojo 2021 r1. Will try also on Windows tomorrow and will file a report then too with a sample project
Btw the ShadowBrush properties do not auto-complete which makes me suspect that you can’t set them.
What does a bold property in the docs mean again? Read only? So maybe these properties can only be set in the Constructor?
Yup, I think that’s it. A really stup… not very user-friendly way of relaying information. How about having that on every page behind the PROPERTIES header:
“Properties in bold are read-only and can only be set in a Constructor”
g.width = 100 will result in a “Cannot assign a value to this property”.
but
g.ShadowBrush.Offset.X = 5 does NOT raise an error (but should)
The one-liner did the trick. Seems as though the multiline should work as it does for a drawn image. I just submitted a feedback report case
<https://xojo.com/issue/65480>
NSShadow is a class and not a function, but I’ve never tried to use that on a graphics context (so I don’t know if this can be used in that way or not).
But like you say, it really depends on how Xojo are translating their shadowBrush class to system API.
I did but thought you were highlighting the inconsistencies in the docs. It does make it seem as though you can change these as in the multi line code. I found that either in the examples project or on the forum and implemented it in my project. Either way, we should suspect it should work modifying using the multi line code in both the drawn red square and the picture and with the single line, or, if they cannot/should not be able to be changed calling g.ShadowBrush… and only when using the constructor, then it should not work when drawing the red square.
Just was pointing out an inconsistency that may need to be improved upon, either way
I’m always learning. This stuff may come as second nature to many of you, but for those of us (me) who take it as it is and run with it, I’d expect when A = B that B should also = A