Shadow Scaling
Shadow Scaling
- Subject: Shadow Scaling
- From: Gordon Apple <email@hidden>
- Date: Fri, 21 Dec 2007 11:27:40 -0600
I know that you are going to tell me that NSShadow works as advertised,
but I had hoped that my fears wouldn't be realized. I create miniature
views of my main view for various reasons and also allow the user to set the
scale on the main view. The problem is that the shadow offsets do not scale
with the views. Everything else scales properly, but in small views the
shadows can be so far off as to be separated completely from the object.
That is not good. I was hoping that even though shadow offsets are
independent of applied transforms, that maybe they wouldn't be independent
of main view scaling transform.
The drawn objects have no knowledge of their environment, and I was
hoping to keep it that way. It appears that I'm going to have to do
something to pass the view scaling to the drawing routines for the objects
so they can scale the shadow offsets appropriately.
I already had to subclass NSShadow in order to bind the joystick polar
coordinates offset to NSShadow's Cartesian offsets. I simply added the
polar ivars and property declarations and then overrode NSShadow's "set"
method to do that. I guess that also might be a place to scale the offset
for the view scaling.
Is there any way to set a shadow offset scaling factor that can be set
once for a scaled view? This is clearly unacceptable.
NSShadow, unlike NSGradient, is a mutable object so you really need only
one. One option might be to use a single (subclassed) NSShadow per window
(or view) instead of attaching one to each shadowed object as I am now
doing. The scale factor could be imbedded in the shared NSShadow subclass
and scaled when the window is scaled (i.e., frame/bounds relationship). My
own shadow object could just load the shared NSShadow's params when needed.
Maybe that's a solution. I just hate having to do a workaround for something
that, IMHO, should have been included (at least as a option) in the system's
(or cocoa's) shadow rendering process and I really don't want to go back to
doing my own shadows.
Another possibility -- Is there anyway to offset the transparency layer
when drawing a shadow?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden