Re: UIImage and shadows, WAS: Re: Please if some one knows
Re: UIImage and shadows, WAS: Re: Please if some one knows
- Subject: Re: UIImage and shadows, WAS: Re: Please if some one knows
- From: Development <email@hidden>
- Date: Mon, 21 Dec 2009 19:49:57 -0700
I have changed the code I added:
CGSize newSize = rotatingView.bounds.size;
newSize.width += (abs(myShadowOffset.width) + spread);
newSize.height += (abs(myShadowOffset.height) + spread);
CGRect newSelf = CGRectMake(self.frame.origin.x, self.frame.origin.y,
newSize.width, newSize.height);
self.frame = newSelf;
UIGraphicsBeginImageContext(newSize);
however what I am getting now is a larger image, offset in the view and still cutting off the shadow. So I honestly do not know how I am suppose to draw this shadow. I would really be grateful for some additional direction.
On Dec 21, 2009, at 7:09 PM, David Duncan wrote:
> On Dec 21, 2009, at 5:29 PM, Development wrote:
>
>> I'll try my question again. Ok, I have a UIImageView. I am trying to draw a shadow under the UIImage it holds. Now if I make the UIImageView's bounds some ungodly size, like the size of the screen it draws shadows perfectly but obviously this is not acceptable. So I don't understand what I am doing wrong. I've tried turning off the clipstobounds but that doesn't help unless the context I am drawing is is clipping in which case I do not know how to turn it off. But at least in the UIImageView it is not clipping.
>
>
> Your drawing to an offscreen context, and in doing so your asking to create a context that is a certain size. If you draw outside of that area, then your going to lose that drawing, period, because there is no place to put it.
>
> If you want to add a shadow, your going to have to calculate how much extra space you need and increase the context you draw by that size. A reasonable approximation is the shadow offset plus the shadow spread. Either way, your not going to be able to use the image's original size as the final size because you are explicitly asking to draw outside of that original image.
> --
> David Duncan
> Apple DTS Animation and Printing
>
_______________________________________________
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