The pixel-oriented APIs take the origin of the glyph vector in user space, but
return a Rectangle in device space.  This is because the user space can be
rotated, but device space (the pixels) are not.  So for example if you render
into a BufferedImage you will get the integer x,y,w,h of the rectangle bounding
the pixels in the BufferedImage.

This is different from getVisualBounds, which returns the bounds of the
GlyphVector outline in user space, or getLogicalBounds, which returns the
origin, ascent, advance, and descent + leading of the GlyphVector in user
space.  User space information can be used in subsequent draw calls (under the
same transform).  Device space information can only used when accessing the
device directly.

The pixel-oriented APIs are for when a precise bounding box on the device is
required.  Because of hinting, device alignment, and rasterization issues, this
can vary slightly from the visual bounds.

The way to test getPixelBounds is to get a clean buffered image, get a graphics
from it, apply a transform, and render the GlyphVector.  Then you check to see
if there are any changed pixels in the buffered image outside the rectangle
returned by getPixelBounds.  If there are, there's a bug.  Similarly, it ought
to be the case that at least one pixel on the inside of each of the sides of the
rectangle is changed from its original value.  This should work for all
transforms, and for when the rendering FRC is different from the FRC used to
construct the GlyphVector.

Doug

> Subject: GlyphVector API
> To: [EMAIL PROTECTED]
>
> ---------------------- Information from the mail header
-----------------------
> Sender:       Discussion list for Java 2D API <[EMAIL PROTECTED]>
> Poster:       SathishKumar S <[EMAIL PROTECTED]>
> Subject:      GlyphVector API
>
-------------------------------------------------------------------------------
>
> Hi
>  I have a doubt in the following api
>
> getPixelBounds(frc,x,y)
>
> The above method in GlyphVector Class returns a rectangle  when the
GlyphVector is rendered in graphics at x,y. When I call getX and getY on the
rectangle object I get the offset x, y values. Now again if I call getBounds on
the glyphVector and do a getX and getY i get one more coordinate(x,y). I am
interested to know if any relationship exists between the offset x, y and the
x,y got by calling getBounds on the glyphvector. How do I check if the
getPixelBounds method works correctly. Please mail me if you have any answers.
>
> Thanks in advance
>
> Regards
>     sats
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA2D-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to