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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to