Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » drawRoundedRectangle doesn't work with AnitAlias activated
drawRoundedRectangle doesn't work with AnitAlias activated [message #199771] Wed, 19 October 2005 09:23 Go to next message
Markus Brigl is currently offline Markus BriglFriend
Messages: 10
Registered: July 2009
Junior Member
Some methods on org.eclipse.draw2d.Graphics doesn't work on "Linux" if
antialising has been activated. I had the problem with
draw- & fillRoundedRectangle and with fillGradient.
I'm using cairo-0.1.23!

public class Snippet {

public static void main(String args[]) {
Display d = new Display();
final Shell shell = new Shell(d);
shell.setSize(400, 400);
LightweightSystem lws = new LightweightSystem(shell);
Figure contents = new Figure();
XYLayout contentsLayout = new XYLayout();
contents.setLayoutManager(contentsLayout);

Figure fig = new Figure() {

@Override
protected void paintClientArea(Graphics graphics) {
graphics.setForegroundColor(ColorConstants.black);
graphics.drawRoundRectangle(getBounds().shrink(1, 1), 50, 50);
// graphics.fillGradient(getBounds(), true);
}


@Override
public void paint(Graphics graphics) {
graphics.setAntialias(SWT.ON);
super.paint(graphics);
}

};
fig.setBounds(new Rectangle(100, 100, 100, 100));
contents.add(fig);

lws.setContents(contents);
shell.open();
while (!shell.isDisposed())
while (!d.readAndDispatch())
d.sleep();
}
}
Re: drawRoundedRectangle doesn't work with AnitAlias activated [message #199787 is a reply to message #199771] Wed, 19 October 2005 10:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christian.sell.netcologne.de

could you elaborate what "doesnt work" means, for thos of us who dont
want to compile and run your code?

thanks,
christian
Re: drawRoundedRectangle doesn't work with AnitAlias activated [message #199811 is a reply to message #199771] Wed, 19 October 2005 15:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

You need Cairo 1.0 with Eclipse 3.2 integration builds. BTW, you shouldn't
be modifying the bounds directly as you do in the paintFigure() method.
Instead, do getBounds().getExpanded(-1,-1).

"Max" <mbrigl@gmx.net> wrote in message
news:pan.2005.10.19.09.23.46.601488@gmx.net...
> Some methods on org.eclipse.draw2d.Graphics doesn't work on "Linux" if
> antialising has been activated. I had the problem with
> draw- & fillRoundedRectangle and with fillGradient.
> I'm using cairo-0.1.23!
>
> public class Snippet {
>
> public static void main(String args[]) {
> Display d = new Display();
> final Shell shell = new Shell(d);
> shell.setSize(400, 400);
> LightweightSystem lws = new LightweightSystem(shell);
> Figure contents = new Figure();
> XYLayout contentsLayout = new XYLayout();
> contents.setLayoutManager(contentsLayout);
>
> Figure fig = new Figure() {
>
> @Override
> protected void paintClientArea(Graphics graphics) {
> graphics.setForegroundColor(ColorConstants.black);
> graphics.drawRoundRectangle(getBounds().shrink(1, 1), 50, 50);
> // graphics.fillGradient(getBounds(), true);
> }
>
>
> @Override
> public void paint(Graphics graphics) {
> graphics.setAntialias(SWT.ON);
> super.paint(graphics);
> }
>
> };
> fig.setBounds(new Rectangle(100, 100, 100, 100));
> contents.add(fig);
>
> lws.setContents(contents);
> shell.open();
> while (!shell.isDisposed())
> while (!d.readAndDispatch())
> d.sleep();
> }
> }
>
Re: drawRoundedRectangle doesn't work with AnitAlias activated [message #199827 is a reply to message #199771] Wed, 19 October 2005 15:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Eclipse 3.1 required and shipped Cairo 0.4.

"Max" <mbrigl@gmx.net> wrote in message
news:pan.2005.10.19.09.23.46.601488@gmx.net...
> Some methods on org.eclipse.draw2d.Graphics doesn't work on "Linux" if
> antialising has been activated. I had the problem with
> draw- & fillRoundedRectangle and with fillGradient.
> I'm using cairo-0.1.23!
>
Re: drawRoundedRectangle doesn't work with AnitAlias activated [message #200086 is a reply to message #199811] Thu, 20 October 2005 18:34 Go to previous messageGo to next message
Markus Brigl is currently offline Markus BriglFriend
Messages: 10
Registered: July 2009
Junior Member
Thank's it is working with cairo 1. It is possible to check if if
antialias (cairo) is available. In that way it would be possible to
activate antialias only if cairo has been installed.

regards

On Wed, 19 Oct 2005 11:04:59 -0400, Pratik Shah wrote:

> You need Cairo 1.0 with Eclipse 3.2 integration builds. BTW, you shouldn't
> be modifying the bounds directly as you do in the paintFigure() method.
> Instead, do getBounds().getExpanded(-1,-1).
>
> "Max" <mbrigl@gmx.net> wrote in message
> news:pan.2005.10.19.09.23.46.601488@gmx.net...
>> Some methods on org.eclipse.draw2d.Graphics doesn't work on "Linux" if
>> antialising has been activated. I had the problem with
>> draw- & fillRoundedRectangle and with fillGradient.
>> I'm using cairo-0.1.23!
>>
>> public class Snippet {
>>
>> public static void main(String args[]) {
>> Display d = new Display();
>> final Shell shell = new Shell(d);
>> shell.setSize(400, 400);
>> LightweightSystem lws = new LightweightSystem(shell);
>> Figure contents = new Figure();
>> XYLayout contentsLayout = new XYLayout();
>> contents.setLayoutManager(contentsLayout);
>>
>> Figure fig = new Figure() {
>>
>> @Override
>> protected void paintClientArea(Graphics graphics) {
>> graphics.setForegroundColor(ColorConstants.black);
>> graphics.drawRoundRectangle(getBounds().shrink(1, 1), 50, 50);
>> // graphics.fillGradient(getBounds(), true);
>> }
>>
>>
>> @Override
>> public void paint(Graphics graphics) {
>> graphics.setAntialias(SWT.ON);
>> super.paint(graphics);
>> }
>>
>> };
>> fig.setBounds(new Rectangle(100, 100, 100, 100));
>> contents.add(fig);
>>
>> lws.setContents(contents);
>> shell.open();
>> while (!shell.isDisposed())
>> while (!d.readAndDispatch())
>> d.sleep();
>> }
>> }
>>
Re: drawRoundedRectangle doesn't work with AnitAlias activated [message #200094 is a reply to message #200086] Thu, 20 October 2005 16:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

GC has a method setAdvanced() that you could manipulate to find out if
there's a

gc.setAdvanced(true);
boolean advancedGraphicsInstalled = gc.getAdvanced();
gc.setAdvanced(false);

These methods aren't reflected in the Graphics class yet, though.

"Max" <mbrigl@gmx.net> wrote in message
news:pan.2005.10.20.18.34.33.844620@gmx.net...
> Thank's it is working with cairo 1. It is possible to check if if
> antialias (cairo) is available. In that way it would be possible to
> activate antialias only if cairo has been installed.
>
> regards
>
> On Wed, 19 Oct 2005 11:04:59 -0400, Pratik Shah wrote:
>
> > You need Cairo 1.0 with Eclipse 3.2 integration builds. BTW, you
shouldn't
> > be modifying the bounds directly as you do in the paintFigure() method.
> > Instead, do getBounds().getExpanded(-1,-1).
> >
> > "Max" <mbrigl@gmx.net> wrote in message
> > news:pan.2005.10.19.09.23.46.601488@gmx.net...
> >> Some methods on org.eclipse.draw2d.Graphics doesn't work on "Linux" if
> >> antialising has been activated. I had the problem with
> >> draw- & fillRoundedRectangle and with fillGradient.
> >> I'm using cairo-0.1.23!
> >>
> >> public class Snippet {
> >>
> >> public static void main(String args[]) {
> >> Display d = new Display();
> >> final Shell shell = new Shell(d);
> >> shell.setSize(400, 400);
> >> LightweightSystem lws = new LightweightSystem(shell);
> >> Figure contents = new Figure();
> >> XYLayout contentsLayout = new XYLayout();
> >> contents.setLayoutManager(contentsLayout);
> >>
> >> Figure fig = new Figure() {
> >>
> >> @Override
> >> protected void paintClientArea(Graphics graphics) {
> >> graphics.setForegroundColor(ColorConstants.black);
> >> graphics.drawRoundRectangle(getBounds().shrink(1, 1), 50, 50);
> >> // graphics.fillGradient(getBounds(), true);
> >> }
> >>
> >>
> >> @Override
> >> public void paint(Graphics graphics) {
> >> graphics.setAntialias(SWT.ON);
> >> super.paint(graphics);
> >> }
> >>
> >> };
> >> fig.setBounds(new Rectangle(100, 100, 100, 100));
> >> contents.add(fig);
> >>
> >> lws.setContents(contents);
> >> shell.open();
> >> while (!shell.isDisposed())
> >> while (!d.readAndDispatch())
> >> d.sleep();
> >> }
> >> }
> >>
>
Re: drawRoundedRectangle doesn't work with AnitAlias activated [message #200109 is a reply to message #200094] Thu, 20 October 2005 19:17 Go to previous messageGo to next message
Markus Brigl is currently offline Markus BriglFriend
Messages: 10
Registered: July 2009
Junior Member
Hi Pratik,

how can I access the GC? The Graphic Context is hidden by SWTGraphics and
not accessible from outside.


On Thu, 20 Oct 2005 12:43:19 -0400, Pratik Shah wrote:

> GC has a method setAdvanced() that you could manipulate to find out if
> there's a
>
> gc.setAdvanced(true);
> boolean advancedGraphicsInstalled = gc.getAdvanced();
> gc.setAdvanced(false);
>
> These methods aren't reflected in the Graphics class yet, though.
>
> "Max" <mbrigl@gmx.net> wrote in message
> news:pan.2005.10.20.18.34.33.844620@gmx.net...
>> Thank's it is working with cairo 1. It is possible to check if if
>> antialias (cairo) is available. In that way it would be possible to
>> activate antialias only if cairo has been installed.
>>
>> regards
>>
>> On Wed, 19 Oct 2005 11:04:59 -0400, Pratik Shah wrote:
>>
>> > You need Cairo 1.0 with Eclipse 3.2 integration builds. BTW, you
> shouldn't
>> > be modifying the bounds directly as you do in the paintFigure() method.
>> > Instead, do getBounds().getExpanded(-1,-1).
>> >
>> > "Max" <mbrigl@gmx.net> wrote in message
>> > news:pan.2005.10.19.09.23.46.601488@gmx.net...
>> >> Some methods on org.eclipse.draw2d.Graphics doesn't work on "Linux" if
>> >> antialising has been activated. I had the problem with
>> >> draw- & fillRoundedRectangle and with fillGradient.
>> >> I'm using cairo-0.1.23!
>> >>
>> >> public class Snippet {
>> >>
>> >> public static void main(String args[]) {
>> >> Display d = new Display();
>> >> final Shell shell = new Shell(d);
>> >> shell.setSize(400, 400);
>> >> LightweightSystem lws = new LightweightSystem(shell);
>> >> Figure contents = new Figure();
>> >> XYLayout contentsLayout = new XYLayout();
>> >> contents.setLayoutManager(contentsLayout);
>> >>
>> >> Figure fig = new Figure() {
>> >>
>> >> @Override
>> >> protected void paintClientArea(Graphics graphics) {
>> >> graphics.setForegroundColor(ColorConstants.black);
>> >> graphics.drawRoundRectangle(getBounds().shrink(1, 1), 50, 50);
>> >> // graphics.fillGradient(getBounds(), true);
>> >> }
>> >>
>> >>
>> >> @Override
>> >> public void paint(Graphics graphics) {
>> >> graphics.setAntialias(SWT.ON);
>> >> super.paint(graphics);
>> >> }
>> >>
>> >> };
>> >> fig.setBounds(new Rectangle(100, 100, 100, 100));
>> >> contents.add(fig);
>> >>
>> >> lws.setContents(contents);
>> >> shell.open();
>> >> while (!shell.isDisposed())
>> >> while (!d.readAndDispatch())
>> >> d.sleep();
>> >> }
>> >> }
>> >>
>>
Re: drawRoundedRectangle doesn't work with AnitAlias activated [message #200170 is a reply to message #200109] Thu, 20 October 2005 21:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

https://bugs.eclipse.org/bugs/show_bug.cgi?id=103209

https://bugs.eclipse.org/bugs/show_bug.cgi?id=101504

"Max" <mbrigl@gmx.net> wrote in message
news:pan.2005.10.20.19.17.03.416219@gmx.net...
> Hi Pratik,
>
> how can I access the GC? The Graphic Context is hidden by SWTGraphics and
> not accessible from outside.
>
>
> On Thu, 20 Oct 2005 12:43:19 -0400, Pratik Shah wrote:
>
> > GC has a method setAdvanced() that you could manipulate to find out if
> > there's a
> >
> > gc.setAdvanced(true);
> > boolean advancedGraphicsInstalled = gc.getAdvanced();
> > gc.setAdvanced(false);
> >
> > These methods aren't reflected in the Graphics class yet, though.
> >
> > "Max" <mbrigl@gmx.net> wrote in message
> > news:pan.2005.10.20.18.34.33.844620@gmx.net...
> >> Thank's it is working with cairo 1. It is possible to check if if
> >> antialias (cairo) is available. In that way it would be possible to
> >> activate antialias only if cairo has been installed.
> >>
> >> regards
> >>
> >> On Wed, 19 Oct 2005 11:04:59 -0400, Pratik Shah wrote:
> >>
> >> > You need Cairo 1.0 with Eclipse 3.2 integration builds. BTW, you
> > shouldn't
> >> > be modifying the bounds directly as you do in the paintFigure()
method.
> >> > Instead, do getBounds().getExpanded(-1,-1).
> >> >
> >> > "Max" <mbrigl@gmx.net> wrote in message
> >> > news:pan.2005.10.19.09.23.46.601488@gmx.net...
> >> >> Some methods on org.eclipse.draw2d.Graphics doesn't work on "Linux"
if
> >> >> antialising has been activated. I had the problem with
> >> >> draw- & fillRoundedRectangle and with fillGradient.
> >> >> I'm using cairo-0.1.23!
> >> >>
> >> >> public class Snippet {
> >> >>
> >> >> public static void main(String args[]) {
> >> >> Display d = new Display();
> >> >> final Shell shell = new Shell(d);
> >> >> shell.setSize(400, 400);
> >> >> LightweightSystem lws = new LightweightSystem(shell);
> >> >> Figure contents = new Figure();
> >> >> XYLayout contentsLayout = new XYLayout();
> >> >> contents.setLayoutManager(contentsLayout);
> >> >>
> >> >> Figure fig = new Figure() {
> >> >>
> >> >> @Override
> >> >> protected void paintClientArea(Graphics graphics) {
> >> >> graphics.setForegroundColor(ColorConstants.black);
> >> >> graphics.drawRoundRectangle(getBounds().shrink(1, 1), 50, 50);
> >> >> // graphics.fillGradient(getBounds(), true);
> >> >> }
> >> >>
> >> >>
> >> >> @Override
> >> >> public void paint(Graphics graphics) {
> >> >> graphics.setAntialias(SWT.ON);
> >> >> super.paint(graphics);
> >> >> }
> >> >>
> >> >> };
> >> >> fig.setBounds(new Rectangle(100, 100, 100, 100));
> >> >> contents.add(fig);
> >> >>
> >> >> lws.setContents(contents);
> >> >> shell.open();
> >> >> while (!shell.isDisposed())
> >> >> while (!d.readAndDispatch())
> >> >> d.sleep();
> >> >> }
> >> >> }
> >> >>
> >>
>
Re: drawRoundedRectangle doesn't work with AnitAlias activated [message #200178 is a reply to message #200170] Thu, 20 October 2005 21:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

Until then, as a workaround, you can create your own GC.

"Pratik Shah" <none@unknown.com> wrote in message
news:dj910b$vs0$1@news.eclipse.org...
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=103209
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=101504
>
> "Max" <mbrigl@gmx.net> wrote in message
> news:pan.2005.10.20.19.17.03.416219@gmx.net...
> > Hi Pratik,
> >
> > how can I access the GC? The Graphic Context is hidden by SWTGraphics
and
> > not accessible from outside.
> >
> >
> > On Thu, 20 Oct 2005 12:43:19 -0400, Pratik Shah wrote:
> >
> > > GC has a method setAdvanced() that you could manipulate to find out if
> > > there's a
> > >
> > > gc.setAdvanced(true);
> > > boolean advancedGraphicsInstalled = gc.getAdvanced();
> > > gc.setAdvanced(false);
> > >
> > > These methods aren't reflected in the Graphics class yet, though.
> > >
> > > "Max" <mbrigl@gmx.net> wrote in message
> > > news:pan.2005.10.20.18.34.33.844620@gmx.net...
> > >> Thank's it is working with cairo 1. It is possible to check if if
> > >> antialias (cairo) is available. In that way it would be possible to
> > >> activate antialias only if cairo has been installed.
> > >>
> > >> regards
> > >>
> > >> On Wed, 19 Oct 2005 11:04:59 -0400, Pratik Shah wrote:
> > >>
> > >> > You need Cairo 1.0 with Eclipse 3.2 integration builds. BTW, you
> > > shouldn't
> > >> > be modifying the bounds directly as you do in the paintFigure()
> method.
> > >> > Instead, do getBounds().getExpanded(-1,-1).
> > >> >
> > >> > "Max" <mbrigl@gmx.net> wrote in message
> > >> > news:pan.2005.10.19.09.23.46.601488@gmx.net...
> > >> >> Some methods on org.eclipse.draw2d.Graphics doesn't work on
"Linux"
> if
> > >> >> antialising has been activated. I had the problem with
> > >> >> draw- & fillRoundedRectangle and with fillGradient.
> > >> >> I'm using cairo-0.1.23!
> > >> >>
> > >> >> public class Snippet {
> > >> >>
> > >> >> public static void main(String args[]) {
> > >> >> Display d = new Display();
> > >> >> final Shell shell = new Shell(d);
> > >> >> shell.setSize(400, 400);
> > >> >> LightweightSystem lws = new LightweightSystem(shell);
> > >> >> Figure contents = new Figure();
> > >> >> XYLayout contentsLayout = new XYLayout();
> > >> >> contents.setLayoutManager(contentsLayout);
> > >> >>
> > >> >> Figure fig = new Figure() {
> > >> >>
> > >> >> @Override
> > >> >> protected void paintClientArea(Graphics graphics) {
> > >> >> graphics.setForegroundColor(ColorConstants.black);
> > >> >> graphics.drawRoundRectangle(getBounds().shrink(1, 1), 50, 50);
> > >> >> // graphics.fillGradient(getBounds(), true);
> > >> >> }
> > >> >>
> > >> >>
> > >> >> @Override
> > >> >> public void paint(Graphics graphics) {
> > >> >> graphics.setAntialias(SWT.ON);
> > >> >> super.paint(graphics);
> > >> >> }
> > >> >>
> > >> >> };
> > >> >> fig.setBounds(new Rectangle(100, 100, 100, 100));
> > >> >> contents.add(fig);
> > >> >>
> > >> >> lws.setContents(contents);
> > >> >> shell.open();
> > >> >> while (!shell.isDisposed())
> > >> >> while (!d.readAndDispatch())
> > >> >> d.sleep();
> > >> >> }
> > >> >> }
> > >> >>
> > >>
> >
>
>
Re: drawRoundedRectangle doesn't work with AnitAlias activated [message #200186 is a reply to message #200178] Thu, 20 October 2005 22:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

"Pratik Shah" <none@unknown.com> wrote in message
news:dj9162$c0$1@news.eclipse.org...
> Until then, as a workaround, you can create your own GC.

..... Using the display instead of a Control.

new GC(Display.getCurrent());
Re: drawRoundedRectangle doesn't work with AnitAlias activated [message #200549 is a reply to message #200186] Tue, 25 October 2005 14:49 Go to previous messageGo to next message
Markus Brigl is currently offline Markus BriglFriend
Messages: 10
Registered: July 2009
Junior Member
With the latest release the problem doesn't appear anymore

On Thu, 20 Oct 2005 18:14:33 -0400, Randy Hudson wrote:

>
> "Pratik Shah" <none@unknown.com> wrote in message
> news:dj9162$c0$1@news.eclipse.org...
>> Until then, as a workaround, you can create your own GC.
>
> .... Using the display instead of a Control.
>
> new GC(Display.getCurrent());
Re: drawRoundedRectangle doesn't work with AnitAlias activated [message #200631 is a reply to message #200549] Tue, 25 October 2005 17:30 Go to previous message
Eclipse UserFriend
Originally posted by: none.unknown.com

Are you saying invoking setAntiAlias() fails gracefully if Cairo is not
installed?

"Max" <mbrigl@gmx.net> wrote in message
news:pan.2005.10.25.14.34.01.321931@gmx.net...
> With the latest release the problem doesn't appear anymore
>
> On Thu, 20 Oct 2005 18:14:33 -0400, Randy Hudson wrote:
>
> >
> > "Pratik Shah" <none@unknown.com> wrote in message
> > news:dj9162$c0$1@news.eclipse.org...
> >> Until then, as a workaround, you can create your own GC.
> >
> > .... Using the display instead of a Control.
> >
> > new GC(Display.getCurrent());
>
Previous Topic:Move/Resize children only in parent boundaries.
Next Topic:Smooth Rendering (SVG or OpenGL)
Goto Forum:
  


Current Time: Wed Dec 11 16:17:29 GMT 2024

Powered by FUDForum. Page generated in 0.04542 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top