I wonder if there is historical reasoning (or any reasoning at all) behind making shadowOffset
of NSShadow
and CALayer
expressed via CGSize
type and NOT CGPoint
type?
I believe that by its meaning, the "shadow offset" is a vector, pointing to an origin of shadow in relation to layer.frame.origin
(or layer.bounds.origin
). So it seems more convenient for it to be CGPoint
instead of CGSize
.
Thanks in advance!
A point is a location in a coordinate space. A size describes distances in the x&y dimensions.
If you used a CGPoint for shadowOffset, it would need to be a point relative to some other point. What point? The center of the shadow path? The origin? In terms of the bounds, or the frame?
An offset is an amount in 2 dimensions. A point is a location. It makes perfect sense to me to use a CGSize
for shadowOffset
, and it would not make sense to use a point.