Committers,

Could someone be so kind and change the component for this issue to
the "classlib", please? Unfortunately, I forgot to set it when created
the issue and unable to change.

And, probably, apply the patch also :)

thanks,
--
 Oleg

---------- Forwarded message ----------
From: Oleg Khaschansky (JIRA) <[EMAIL PROTECTED]>
Date: Sep 13, 2006 3:10 PM
Subject: [jira] Updated: (HARMONY-1453) [classlib][awt] Incorrect
behavior of methods Graphics.draw3DRect and Graphics.fill3DRect
To: [EMAIL PROTECTED]


    [ http://issues.apache.org/jira/browse/HARMONY-1453?page=all ]

Oleg Khaschansky updated HARMONY-1453:
--------------------------------------

   Attachment: harmony-1453.patch

Patch with reimplemented draw3DRect and fill3DRect methods. All listed
issues fixed. AWT tests passed on win32 with this patch.

[classlib][awt] Incorrect behavior of methods Graphics.draw3DRect and 
Graphics.fill3DRect
-----------------------------------------------------------------------------------------

                Key: HARMONY-1453
                URL: http://issues.apache.org/jira/browse/HARMONY-1453
            Project: Harmony
         Issue Type: Bug
           Reporter: Oleg Khaschansky
           Priority: Minor
        Attachments: harmony-1453.patch


1. Methods Graphics.draw3DRect(int x, int y, int width, int height, boolean 
raised) and Graphics.fill3DRect(int x, int y, int width, int height, boolean 
raised) use their width parameter instead of height to draw the lines. This 
result in a quads instead of rectangles.
2. Calling these methods will reset paint attribute of the graphics context. 
Harmony implementation of these methods calls setColor method, which updates 
the paint attribute. This behavior is illogical and differs from RI.
3. Rendering of lines and filled rectangles in these methods uses paint and stroke 
defined in the Graphics2D. This behavior contradicts the spec for the Graphics2D class: 
"The draw3DRect and fill3DRect methods were implemented in terms of the drawLine and 
fillRect methods in the Graphics class which would predicate their behavior upon the 
current Stroke and Paint objects in a Graphics2D context. This class overrides those 
implementations with versions that use the current Color exclusively, overriding the 
current Paint and which uses fillRect to describe the exact same behavior as the 
preexisting methods regardless of the setting of the current Stroke."
4. If the rectangle is not raised then fill3Drect fills it with the incorrect 
color (behavior differs from RI).
5. There are per-pixel differences between RI and harmony implementations.
I will attach a patch for this issue soon.
The following test reveals all this incorrect behavior:
====================== test.java =======================
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class test {
    public static void main(String[] args) {
        Frame f = new Frame("test");
        f.add( new Canvas(){
            public void paint(Graphics g) {
                Graphics2D g2 = (Graphics2D) g;
                g2.setColor(Color.lightGray);
                g2.setStroke(new BasicStroke(5));
                g2.setPaint(new GradientPaint(0,0,Color.red,100,100,Color.blue, 
true));
                g2.fill3DRect(20, 20, g.getClipBounds().width-40, 
g.getClipBounds().height-40, true);
                g2.draw3DRect(10, 10, g.getClipBounds().width-20, 
g.getClipBounds().height-20, true);
                g2.fillRect(40, 40, g.getClipBounds().width-80, 
g.getClipBounds().height-80);
                int y1 = (g.getClipBounds().height / 30);
                int x1 = (g.getClipBounds().width / 20);
                g2.setTransform(AffineTransform.getScaleInstance(10, 10));
                g2.setColor(Color.gray);
                g2.draw3DRect(x1, y1, 3, 3, false);
                g2.fill3DRect(x1, y1*2, 4, 4, false);
            }
        });
        f.addWindowListener(new WindowAdapter() {
           public void windowClosing(WindowEvent we) {
               we.getWindow().dispose();
           }
        });
        f.setSize(200, 300);
        f.show();
    }
}
====================================================

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the
administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to