Re: converting rects between coordinate systems
Re: converting rects between coordinate systems
- Subject: Re: converting rects between coordinate systems
- From: email@hidden
- Date: Wed, 4 Jun 2003 21:45:24 -0400
Sorry for the vague explanation.
I have several views that represent huge objects. You would laugh at
the size and location of their frames. In order to show them entirely
on screen, they are placed inside of another view which has an
extremely large bounds rectangle (set with scaleUnitSquareToSize:). The
result is a scaling of the images of the subviews. It is important for
a certain part of the program to calculate the width of these scaled
images in screen pixels. In other words, though the frame of a subview
is extremely large, the final image may only be 200 pixels wide. That
final result is what I seek. I hope this explains the predicament a bit
more.
On Wednesday, Jun 4, 2003, at 19:09 America/New_York, j o a r wrote:
You are a bit confused about something here. You use the mehtods you
mention to translate points between overlapping coordinate systems.
Example: If you have a view contained in another view, the subview
will have a x.y position offset from the 0.0 origin of the bounds of
it's superview. This position is the origin of the subview's frame,
and this x.y position is only of any value in the coordinate system of
the superview.
You are asking about how to convert _sizes_, now sizes are the same
between coordinate systems and does not need any conversion.
If you are looking for information on the frame of a view, use this
method:
NSRect viewFrame = [aView frame];
float viewWidth = viewFrame.size.width.
etc.
If you want to control the frame of a view use these methods:
[aView setFrame: NSMakeFrame(0.0, 0.0, 12.0, 12.0)];
[aView setFrameOrigin: NSMakePoint(5.0, 5.0)];
[aView setFrameSize: NSMakeSize(24.0, 12.0)];
But back to your question, I'm not really sure what you're asking
about. Could you rephrase it?
What is "the final size as represented in a superview"?
j o a r
On Wednesday, Jun 4, 2003, at 23:35 Europe/Stockholm,
email@hidden wrote:
I need to be able to convert the size of a frame of a subview to its
final size as represented in a superview. Since the bounds of the
superview is generally much larger than that of the subview, the
resulting image of the subview is scaled down. The width of this
scaled down version is what is important. I have tried the NS View
methods:
convertRect:fromView:
convertRect:toView:
convertSize:fromView:
convertSize:toView
but they down take scaling into account. I'm probably missing
something simple, so please clue me in. Thanks.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.