Re: CGContext Drawn Squished
Re: CGContext Drawn Squished
- Subject: Re: CGContext Drawn Squished
- From: "Bridger Maxwell" <email@hidden>
- Date: Sun, 16 Mar 2008 00:23:02 -0600
Hey,
Got it solved. I was right when I guessed the resolutions were
different, even though I didn't know what I was talking about. When I
created the bitmap cgcontext, I made it take up the whole screen and
then drew it to a view that was smaller, thus the squishing. I thought
for sure it would be because the points weren't being converted
correctly....
Bridger Maxwell
On Fri, Mar 14, 2008 at 2:32 AM, Bridger Maxwell <email@hidden> wrote:
> Hey,
> New to Quartz drawing, and am still hazy on some of the concepts
> involved. I use:
>
> _cgContext = CGBitmapContextCreate(NULL, frame.size.width,
> frame.size.height, 8, 6 * frame.size.width, colorSpace,
> kCGImageAlphaPremultipliedFirst);
>
> To make a context to draw to. I do some drawing stuff. Later, I tag
> the view as needing an update, and use this code to do the drawing:
>
> - (void) drawRect:(CGRect)clip
> {
> CGRect bounds = [self bounds];
> CGContextRef context = UIGraphicsGetCurrentContext();
> CGImageRef image;
>
> //Copy the contents of the painting context to the view's context
> image = CGBitmapContextCreateImage(_cgContext);
> CGContextClearRect(context, self.frame);
> CGContextDrawImage(context, bounds, image);
> CGImageRelease(image);
> }
>
> After it is drawn though, the image comes out as being "squished"
> vertically. So the x coordinates come out correctly, but the y
> coordinates are smaller by a scale. I hope that makes sense. In other
> words, something that should have been drawn in the bottom left corner
> is still to the left left, but it is up from the bottom. It is like
> the resolution of the two contexts is out of whack. Can someone give
> me a hand here? What is going on?
>
> Thank You,
> Bridger Maxwell
>
_______________________________________________
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