Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6182453
Votes 0
Synopsis Filling and drawing same GeneralPath do not match
Category java:classes_2d
Reported Against
Release Fixed
State 11-Closed, duplicate of 4151279, bug
Priority: 3-Medium
Related Bugs
Submit Date 21-OCT-2004
Description
FULL PRODUCT VERSION :
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
 customer  Windows 2000 [Version 5.00.2195]
Service pack 4

A DESCRIPTION OF THE PROBLEM :
Sometimes the pixels touched by filling an area and then drawing the same area are not  aligned. The filling seems to 'spill' pixels outside of the outline, and seems not to fill all pixels inside the outline.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
The bug can be seen by running the attached program.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I was expecting to see no visual distortion.
ACTUAL -
Blue pixels of the filling are seen outside the outline. White (background) pixels are left unfilled inside the outline.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.geom.*;
import java.awt.image.*;
import javax.swing.*;

public class Spill
{
    static public void main(String[] args)
    {
        /* Create an image */
        BufferedImage image = new BufferedImage(500,500,BufferedImage.TYPE_INT_RGB);
        Graphics2D graphics = image.createGraphics();
        graphics.setColor(Color.white);
        graphics.fillRect(0,0,image.getWidth(),image.getHeight());
        /* Make the shape */
        GeneralPath path = new GeneralPath();
        path.moveTo(-5.0f,-5.0f);
        path.lineTo(33.0f,-5.0f);
        path.lineTo(33.0f,19.0f);
        path.lineTo(-5.0f,19.0f);
        path.closePath();
        /* Render without error */
        graphics.translate(200.0,150.0);
        render(graphics,path);
        /* Render with error */
        graphics.translate(0.517747036277655,100.11394841313354);
        render(graphics,path);
        graphics.dispose();
        /* Show image */
        JFrame frame = new JFrame("Spill Test");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(new JLabel(new ImageIcon(image)));
        frame.pack();
        frame.show();
    }

    static private void render(Graphics2D graphics,GeneralPath path)
    {
        graphics.setColor(Color.blue);
        graphics.fill(path);
        graphics.setColor(Color.red);
        graphics.draw(path);
    }
}

---------- END SOURCE ----------
  xxxxx@xxxxx   10/21/04 10:28 GMT
Work Around
N/A
Evaluation
Contribution-Forum:https://jdk-collaboration.dev.java.net/servlets/ProjectForumMessageView?messageID=11504&forumID=1463
Posted Date : 2006-02-17 22:20:45.0

This bug was fixed within the fix of the 4151279 by using the same code for tracking
boundaries of the GeneralPath in filling and drawing code. So, I'm closing this bug
as duplicate.
Posted Date : 2006-02-22 13:11:48.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang