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: Tue, 22 Dec 2009 08:46:57 -0700
I think I've gotten on the right track. Two issues. One I needed to add the spread * pi to the height and width. That made a huge difference. Thank you for the direction it helped a lot. Given the time to fine tune it exactly I think i might finally have this. I kind of didn't really realize it but you are actually working in side of a circle because the shadow offsets from the center of the image. Anyway that realization made a lot of difference.
On Dec 22, 2009, at 8:28 AM, David Duncan wrote:
>
> On Dec 21, 2009, at 8:02 PM, Development wrote:
>
>> As near as I can tell, no matter what I do, the image itself, not accounting for the shadow, is drawn in the upper left corner. this causes a negative shadow, or one to the upper left, to be cut off by the edge of the context.
>> I have attempted using drawAtPoint, and accounting for the negative shadow by moving the point an amount that should accommodate the shadow. It did not work.
>>
>> Now if the shadow is to the lower right, the adjustments I make work perfectly every time and the shadow is exactly what it should be.
>>
>> I think the point is that I do not understand the context drawing. I thought I did but it should be painfully obvious from this thread that I do not.
>
>
> I highly suspect that your drawing is just fine, but since your not drawing to a view, but extracting an image that you are assigning to a UIImageView, your conditions are likely different from drawing to a typical view. A UIImageView, by default, centers its content. This means that if you have a UIImageView that is 20x20 in size, but you assign a 30x30 image to it, then (unless clipToBounds=YES) the image will still be displayed at 30x30 centered on the view.
>
> A plain UIView by default resizes its content. Normally this does not matter because you don't set the contents of a UIView's layer. But it does mean that you would typically resize the UIView in order to have it display more content, and thus you would still avoid the issue.
>
> Overall, this is one of those situations where, as others have commented, you need to figure out where things are going wrong before anyone can really help you. There are lots of ways to debug this, but especially the simulator can make this very convenient since it is much easier to get files off. Typically when debugging offscreen drawing the standard approach is to dump images of that drawing to disk periodically to see what is going on. In the simulator you can easily just grab a PNG representation and drop it at the root of your hard disk or home folder (whereas on hardware you have to put it in your documents folder and then download it). Doing so would tell you if your drawing is doing what you want and help you figure out where the actual problem is.
> --
> 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