Re: Compositing shrunk cells
Re: Compositing shrunk cells
- Subject: Re: Compositing shrunk cells
- From: Guy English <email@hidden>
- Date: Mon, 26 Mar 2007 03:36:20 -0400
Well I'm not sure I understand the question without pretty pictures
but ...
I think you were on the right track with option A. If they were
drawing at the bottom left hand corner of the view it's because your
view isFlipped. Your affine transform scales the coord system of the
view such that what would normally be 1 point is now y_scale points.
The origin is in the same place though. What you want to do is move
the origin to the bottom left corner of where you'd like to draw the
cells then apply the scale.
Untested and typed right into Mail I think this will work:
[NSGraphicsContext saveGraphicsState]; // save this so you don't
mess with the Order Of Things
NSAffineTransform *translate = [NSAffineTransform transform];
[translate translateXBy: 0 yBy: NSMaxY( [theView bounds] ) -
scaleFactor];
NSAffineTransform *scale = [NSAffineTransform transform];
[scale scaleXBy: scaleFactor yBy: scaleFactor];
[translate concat]; // move the origin
[scale contat]; // scale the coord system
// do your drawing here ....
[NSGraphicsContext restoreGraphicsState]; // restore the Order Of
Things
Hope that helps,
Guy
On 26-Mar-07, at 2:56 AM, Nick Zitzmann wrote:
Anyone? I originally posted this on a Friday night, so maybe some
people missed it...
Begin forwarded message:
From: Nick Zitzmann <email@hidden>
Date: March 23, 2007 7:32:03 PM MDT
To: email@hidden
Subject: Compositing shrunk cells
X-Mailer: Apple Mail (2.752.3)
I've checked the archives, and although this has come up before,
no one had a solution...
I've got three cells which I'm drawing into a view. The cells have
a fixed cell size and can't be drawn pre-shrunk. I want to draw
these cells into a view and shrink them.
At first I was just using NSAffineTransform to scale down the
drawing, but then I couldn't get them to draw at the top of the
view, since apparently scaling the drawing also scaled the
available space.
So then I tried creating an NSImage, applying the transform, and
drawing the cells into the image. That worked great, and I got an
image that I could draw anywhere, but the problem is the image
lost all of its vector data, so I'm left with a blurry and
pixelated trio of cells. No matter what I do with image caching
and data retention, it still loses vector data.
What do I need to do to draw these cells in the view, shrunk, at
the top of the view, and arranged horizontally, without losing
quality?
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40chronosnet.com
This email sent to email@hidden
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40gmail.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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