Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Will antialiasing API appear on IFigure?
Will antialiasing API appear on IFigure? [message #209088] Sat, 11 February 2006 00:06 Go to next message
Jason Grant is currently offline Jason Grant
Messages: 77
Registered: July 2009
Member
I'm using antialiasing on various Figures, as shown by an indicative code
snippet below. I was hoping that advanced graphics methods like
setAntialias(boolean) may appear in the IFigure API at some point, so that
I no longer need to create subclasses of all the Shapes/Layers, etc., that
I need to antialias. Is this on the radar?

(Note that sometimes, I just want to antialias a particular Shape, rather
than the whole layer. For example, if I antialias my feedback layer, it
ruins the appearance of my "magnifying glass" Figure.)

Apologies if this is already in the codebase or bugzilla. I've seen

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

but it doesn't give much insight into whether this is something the GEF
crew feel is warranted.

Thanks,

Jason.

------------------------------------------- /**
* An Ellipse that will use antialiasing if supported by * the platform.
*
* @author jas
*/
public class AntialiasedEllipse extends Ellipse {
/**
* Paint with antialiasing if the local environment supports it.
* @see org.eclipse.draw2d.Figure#paint(org.eclipse.draw2d.Graphics)
*/
public void paint(Graphics graphics) {
AntialiasUtil.setAntialias(graphics);
super.paint(graphics);
}
}

-------------------------------------------
public class AntialiasUtil {

private AntialiasUtil() {
super();
}

public static void setAntialias(Graphics graphics) {
if (Environment.hasAdvancedGraphics()) {
graphics.setAntialias(SWT.ON);
}
}

}
Re: Will antialiasing API appear on IFigure? [message #209148 is a reply to message #209088] Sun, 12 February 2006 03:16 Go to previous messageGo to next message
Eclipse User
Originally posted by: none.us.ibm.com

The current problem with Figure.java is that it declares too many fields
that are rarely used. For example:

-border
-cursor
-font
-fgcolor
-bgcolor
-prefsize
-minsize
-maxsize
-tooltip

These fields are null for the majority of instances. We have deprecated some
and some are private, so we may be able to switch over to a more efficient
way of storing style/layout attributes. This would allow us to then support
many more styles with no *additional* penalty in memory or lookup time.

The other side of the story is that we can't go making 25 checks for every
figure's paint method. We currently check bgcolor, fgcolor, and font. This
is already a waste of time for 95% of figures. If you want some other
inheritible or temporary change for a graphics, you need to subclass and
write the code. Perhaps a future style object could make changes to the GC.

Finally, antialiasing is slow and has many side-effects such as undesirable
font rendering. I guess that's probably why you're using it at your leaf
figures.

"Jason Grant" <junk@logular.com> wrote in message
news:pan.2006.02.11.00.06.34.562482@logular.com...
> I'm using antialiasing on various Figures, as shown by an indicative code
> snippet below. I was hoping that advanced graphics methods like
> setAntialias(boolean) may appear in the IFigure API at some point, so that
> I no longer need to create subclasses of all the Shapes/Layers, etc., that
> I need to antialias. Is this on the radar?
>
> (Note that sometimes, I just want to antialias a particular Shape, rather
> than the whole layer. For example, if I antialias my feedback layer, it
> ruins the appearance of my "magnifying glass" Figure.)
>
> Apologies if this is already in the codebase or bugzilla. I've seen
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=111842
>
> but it doesn't give much insight into whether this is something the GEF
> crew feel is warranted.
>
> Thanks,
>
> Jason.
>
> ------------------------------------------- /**
> * An Ellipse that will use antialiasing if supported by * the platform.
> *
> * @author jas
> */
> public class AntialiasedEllipse extends Ellipse {
> /**
> * Paint with antialiasing if the local environment supports it.
> * @see
> org.eclipse.draw2d.Figure#paint(org.eclipse.draw2d.Graphics)
> */
> public void paint(Graphics graphics) {
> AntialiasUtil.setAntialias(graphics);
> super.paint(graphics);
> }
> }
>
> -------------------------------------------
> public class AntialiasUtil {
>
> private AntialiasUtil() {
> super();
> }
>
> public static void setAntialias(Graphics graphics) {
> if (Environment.hasAdvancedGraphics()) {
> graphics.setAntialias(SWT.ON);
> }
> }
>
> }
>
Re: Will antialiasing API appear on IFigure? [message #218362 is a reply to message #209088] Fri, 23 June 2006 07:14 Go to previous message
Eclipse User
Originally posted by: adam.giemza.gmx.de

Hey Jason,

what is "Environment.hasAdvancedGraphics()" and where can I find it?


> public class AntialiasUtil {
>
> private AntialiasUtil() {
> super();
> }
>
> public static void setAntialias(Graphics graphics) {
> if (Environment.hasAdvancedGraphics()) {
> graphics.setAntialias(SWT.ON);
> }
> }
>
> }
>

Greets
Adam
Previous Topic:Put Connections into Background
Next Topic:IFileEditorInput not there
Goto Forum:
  


Current Time: Thu Oct 02 04:41:55 GMT 2014

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

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