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:17:14 -0700
Thanks alot, this got me started in the right direction. I still have fine tuning I need to do to get the size and draw point perfect but with some adjustments to the code I have it mostly working.
if any one wants to see I can post the new code.
On Dec 21, 2009, at 10:23 PM, Henry McGilton (Boulevardier) wrote:
>
> On Dec 21, 2009, at 8:02 PM, Development wrote:
>
>> Then I don't understand how to do this.
>>
>> Do I create the context at this larger size? because that's what I did.
>> Do I drawInRect the image at it's original size? Because that's what I did.
>>
>> 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.
>
> Are you aware that the context you get from UIGraphicsBeginImageContext has its origin
> at upper left ?
>
> In any case, I have posted a mini example that *appears* to do what you want, but based
> on the descriptions, I might have misunderstood, in which case please excuse me for
> wasting bandwidth . . .
>
> The project is here:
>
> http://www.trilithon.com/download/Shadow.zip
>
> Cheers,
> . . . . . . . . Henry
>
>
>>
>>
>>
>>
>> On Dec 21, 2009, at 8:45 PM, Graham Cox wrote:
>>
>>>
>>> On 22/12/2009, at 1:49 PM, Development wrote:
>>>
>>>> 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.
>>>
>>>
>>> Try thinking instead of flailing about throwing code at it.
>>>
>>> You need a bigger image to accommodate the shadow. But the image you want to composite on top is the same size as it always was. So you need to keep its original size around so you can draw it at that size but into the larger image context. If you draw it at the new size you are back at square one, but larger.
>>>
>>> --Graham
>>>
>>>
>>
>> _______________________________________________
>>
>> 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
>
_______________________________________________
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