ADC Home > Reference Library > Technical Q&As > Legacy Documents > Graphics & Imaging >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

GXGetShapeLocalBounds Call


Q: The GXGetShapeLocalBounds call is causing many problems for us. According to the documentation, GXGetShapeLocalBounds should not have to use the viewport, and that it should just compute the geometry after the mapping to get the shape in local coordinates, but it does seem to use the viewport for the gxPicture.

A: If the transform for the picture is the same as the view transform (before the view is disposed), the behavior you're seeing is as-expected. This is because you're referencing a field of a disposed object, which would contain garbage.

GXGetShapeLocalBounds are not completely reliable for pictures, because you cannot tell what the transform for all of the objects within a picture is. Each object in the picture may have a transform set, and/or you may have nested objects (in the case of a picture within a picture). The GXGetShapeLocalBounds function returns the bounding rectangle of the source shape after the shape's transform mapping and style are applied. The dimensions of the rectangle are in the shape's local coordinates.

Try using the GXGetShapeBounds function to determine the bounding rectangle of a shape or of a specified contour of a shape. To get this in the same form that GXGetShapeLocalBounds returns, get the transform mapping and apply it to the shape.

To do this, make the following sequence of calls:

  • Use the GXGetShapeTransform function to determine the transform object associated with a shape object.
  • Examine the mapping property of a transform object directly using the function GXGetTransformMapping.

Once you have the transform-mapping matrix, you can transform the bounds returned by GXGetShapeBounds. This may seem like a roundabout way of doing this, but it is the best way to avoid the problems you're having. Bear in mind that you may need to iterate through the picture to get the bounds of all of its component objects.

[Mar 05 1996]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.