(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/


Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to