Programmer Reference : Common Graphics : Using pixmaps : Getting pixmap geometry
Getting pixmap geometry
Information about a CgDrawable (window or pixmap) can be obtained by sending the getGeometry: message to the drawable. In the following example a pixmap is created and its geometry is requested. Return parameters are provided for the root window of the drawable, x, y, width, height, border width and depth information. The root window of a pixmap is the same as that for the window that was used to create the pixmap.
| window pixmap rootReturn xReturn yReturn wReturn hReturn bwReturn dReturn |
window := CgWindow default.
pixmap := window
createPixmap: 500
height: 50
depth: window depth.
getGeometry: (rootReturn := ReturnParameter new)
xReturn: (xReturn := ReturnParameter new)
yReturn: (yReturn := ReturnParameter new)
widthReturn: (wReturn := ReturnParameter new)
heightReturn: (hReturn := ReturnParameter new)
borderWidthReturn: (bwReturn := ReturnParameter new)
depthReturn: (dReturn := ReturnParameter new).
Transcript cr;
show: 'Pixmap root: ', rootReturn value printString; cr;
show: ' x: ', xReturn value printString;
show: ' y: ', yReturn value printString;
show: ' width: ', wReturn value printString;
show: ' height: ', hReturn value printString; cr;
show: ' borderWidth: ', bwReturn value printString;
show: ' depth: ', dReturn value printString.
pixmap freePixmap
There are also convenience methods, width, height, and depth, for querying the geometry of drawables.
Last modified date: 01/29/2015