[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] (no subject)


Hi !
I'm using eclipse 3.1 on Windows XP, when I draw round rectangles
sometimes the rounded corners are drawn badly specially when Transform is used.
Here is a snapshot of bad drawing :



Does anyone have seen yet ?

Thanks for any informations.

Arnaud.

PS: used code to reproduce problem:

package test1;

import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Transform;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class RoundRect
{
        public static void main(String[] args)
        {
                Display disp = new Display();
                Shell shell = new Shell( disp );
                shell.setSize( 400, 300 );
        shell.addPaintListener( new PaintListener() {
                        public void paintControl(PaintEvent e) {
                                Transform tr = new Transform( e.display );
//same effect:                                tr.translate( 0,0 );
                                tr.translate( 5,5 );
                                e.gc.setTransform( tr );
                                e.gc.setBackground( new Color(null,255,0,0));
                                e.gc.fillRoundRectangle( 0,0, 142, 90, 90,90 );                                
                                e.gc.drawRoundRectangle( 0,0, 142, 90, 90,90 );
                                e.gc.setTransform( null );
                                tr.dispose();
                        }
        });
       
        shell.open ();
        while (!shell.isDisposed ()) {
                if (!disp.readAndDispatch ())
                        disp.sleep ();
        }
        disp.dispose ();
        }

}