Re: [iPhone] UIImage drawInRect not scaling image
Re: [iPhone] UIImage drawInRect not scaling image
- Subject: Re: [iPhone] UIImage drawInRect not scaling image
- From: Jamie Phelps <email@hidden>
- Date: Mon, 10 Mar 2008 08:14:46 -0500
No iPhone discussion in public lists because it is under NDA. This has
been flogged to death.
JP
Sent from my iPhone
On Mar 10, 2008, at 7:23 AM, "Stuart A. Malone" <email@hidden
> wrote:
(Please correct me if I'm on the wrong list. Cocoa-dev seems to be
the list suggested at the end of the iPhone developer videos, and I
can't find any other.)
I've begun working with the iPhone SDK, and quickly ran into what
looks like a bug in UIImage drawInRect: and
drawInRect:blendMode:alpha: in the iPhone simulator. But before
filing a bug report, I wanted to check with others to make sure that
I'm not suffering from some misunderstanding of what these functions
are supposed to do.
I'm trying to draw an image obtained from the
UIPickerImageController so that it fits within a particular portion
of my custom UIView. I find that using either of the drawInRect:
routines, the image is drawn with the correct bottom-left corner,
but the image is not scaled to fit the height and width of the
rectangle. I've worked around the problem using the lower-level
CGContext routines as follows:
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
CGContextTranslate(context, 0, rect.origin.y + rect.origin.y +
rect.size.height);
CGContextScale(context, 1, -1);
CGContextSetBlendMode(context, blendMode);
CGContextDrawImage(context, rect, image.CGImage);
CGContextRestoreGState(context);
This results in the image being scaled to fit exactly in the
rectangle I specified. Am I correct that this is also how the
UIImage drawInRect: routines are supposed to work?
Best wishes,
--Stuart A. Malone
Llamagraphics, Inc.
Makers of Life Balance personal coaching software
http://www.llamagraphics.com/
_______________________________________________
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