Instance Method

convertSize:fromView:

Converts a size from another view’s coordinate system to that of the view.

Declaration

- (NSSize)convertSize:(NSSize)size fromView:(NSView *)view;

Parameters

aSize

The size (width and height) in aView's coordinate system.

aView

The view with aSize in its coordinate system. Both aView and the view must belong to the same NSWindow object, and that window must not be nil. If aView is nil, this method converts from window coordinates instead.

Return Value

The converted size, as an NSSize structure.

Discussion

The returned NSSize values are always forced to have positive a width and height.

You can also use this method to get a view’s current magnification or zoom level, if it’s been changed from the default scale. Specifically, if you convert a known size from the window's base coordinate space to that of aView, the result is the current zoom level.

See Also

Converting Coordinate Values

- backingAlignedRect:options:

Returns a backing store pixel-aligned rectangle in local view coordinates.

- convertPointFromBacking:

Converts a point from its pixel aligned backing store coordinate system to the view’s interior coordinate system.

- convertPointToBacking:

Converts a point from the view’s interior coordinate system to its pixel aligned backing store coordinate system.

- convertPointFromLayer:

Convert the point from the layer's interior coordinate system to the view’s interior coordinate system.

- convertPointToLayer:

Convert the size from the view’s interior coordinate system to the layer's interior coordinate system.

- convertRectFromBacking:

Converts a rectangle from its pixel aligned backing store coordinate system to the view’s interior coordinate system.

- convertRectToBacking:

Converts a rectangle from the view’s interior coordinate system to its pixel aligned backing store coordinate system.

- convertRectFromLayer:

Convert the rectangle from the layer's interior coordinate system to the view’s interior coordinate system.

- convertRectToLayer:

Convert the size from the view’s interior coordinate system to the layer's interior coordinate system.

- convertSizeFromBacking:

Converts a size from its pixel aligned backing store coordinate system to the view’s interior coordinate system.

- convertSizeToBacking:

Converts a size from the view’s interior coordinate system to its pixel aligned backing store coordinate system.

- convertSizeFromLayer:

Convert the size from the layer's interior coordinate system to the view’s interior coordinate system.

- convertSizeToLayer:

Convert the size from the view’s interior coordinate system to the layer's interior coordinate system.

- convertPoint:fromView:

Converts a point from the coordinate system of a given view to that of the view.

- convertPoint:toView:

Converts a point from the view’s coordinate system to that of a given view.

- convertSize:toView:

Converts a size from the view’s coordinate system to that of another view.

- convertRect:fromView:

Converts a rectangle from the coordinate system of another view to that of the view.

- convertRect:toView:

Converts a rectangle from the view’s coordinate system to that of another view.

- centerScanRect:

Converts the corners of a specified rectangle to lie on the center of device pixels, which is useful in compensating for rendering overscanning when the coordinate system has been scaled.