[OpenJDK 2D-Dev] OpenJDK: Question on Bug 4197755

Igor Nekrestyanov Igor.Nekrestyanov at Sun.COM
Sun Aug 5 20:32:07 UTC 2007


I am not sure that approximation is acceptable but i am not expert in 
this part of the code.

Perhaps someone else from 2d-dev can comment on this.

-igor

Alexander Schunk wrote:
>
>  Hi,
>
> this Bug 4197755 seems also to be native plattform problem.
>
> The looser bounding box for getBounds is mentioned in the method comments
> for Arc2D.getBounds2D, but no justification is given.  This discrepancy is
> allowed by the spec of the Shape interface, but is not as useful.  The
> reason for the discrepancy here is probably due to the complicated math
> in the getBounds2D method.
>
> It looks like the math in getBounds2D could be greatly simplified - at 
> which
> point it would make sense to have getBounds also return a tighter bounding
> box.
> Posted Date : 2005-10-08 03:01:56.0
>
> I dont know what math actually is used in this implementation but 
> usually - under Windows for example -
>
> all 2D drawings are surrounded by a rectangel that coves the area of 
> the shape, that is the bounding box of this hape.
>
> This seems to be an optimization issue and some playing with Math and 
> should also be mathed to the spec mentioned above.
>
> May be in this case its good enough to simply approximate the actual 
> width of the bounding box and not to calculate it precisely.
>
> Regards
>
> Alex
>
> "Igor Nekrestyanov" <mailto:Igor.Nekrestyanov at Sun.COM> schrieb:
> > Hi,
> > >
> > > So i assume this only a problem on Windows plattforms and there is 
> > > already a suggestion for a  fix - i dont know if this suggestion has 
> > > been used so far - however this suggestions seems both obvious and a 
> > > bit lax, because users may need Arcs of a very small size - i.g. if 
> > > you draw in GUI widgets for example.
> > >
> > > However, reading the suggested fix i am not sure if this is a Java 2D 
> > > API problem at all rather than a Windows GDI problem.
> > >
> > Yes, this sounds like it might be caused by limitation of GDI.
> > However, we can try to workaround it in java2d code.
> > 
> > I am not very familiar with that part of code.
> > But bug is still open and therefore i do not think it is fixed.
> > 
> > If you want to try to fix it i suggest to start with reproducing the 
> > problem.
> > When you will have suggested fix - send it and tests to 2d-dev
> > and someone who knows that code better will comment.
> > 
> > -igor
> > 
> > 
>  
>




More information about the 2d-dev mailing list