Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Using antialiasing in a cross-platform product
Using antialiasing in a cross-platform product [message #463346] Fri, 04 November 2005 02:19 Go to next message
Jason Grant is currently offline Jason Grant
Messages: 77
Registered: July 2009
Member
[Eclipse 3.1]

I've just turned on antialiasing in a cross-platform RCP
application. I don't have the ability to test it under Mac & all varieties
of Windows, and am keen to understand the ramifications of using
GC.setAntialias(SWT.ON). I know, for example that if the cairo library is
not installed properly under linux, then exceptions are thrown. So a
couple of questions:

1) Should antialiasing work 'out of the box' across operating systems, or
are some not supported, and others require set-up work like the cairo
thing above?

2) I'm thinking of including a 'fail early' test to avoid the exceptions -
maybe create a GC at plugin load time, and if an exception is caught
during rendering, then the product will not setAntialias. Does this sound
like a good practice? Are there better ways?

3) How does setAntialias(SWT.DEFAULT) work? Does each SWT
implementation just simply translate this to yes/no based on whether
there is 'out of the box' support for the relevant OS?

Thanks for any tips,

Jason.
Re: Using antialiasing in a cross-platform product [message #463355 is a reply to message #463346] Fri, 04 November 2005 07:42 Go to previous messageGo to next message
Fabian Wolf is currently offline Fabian Wolf
Messages: 96
Registered: July 2009
Member
Jason Grant wrote:

> ...
> 2) I'm thinking of including a 'fail early' test to avoid the exceptions -
> maybe create a GC at plugin load time, and if an exception is caught
> during rendering, then the product will not setAntialias. Does this sound
> like a good practice? Are there better ways?
> ...

An early test to check wheter advanced graphics are available on your
platform:

GC gc = new GC(Display.getCurrent());
gc.setAdvanced(true);

if (gc.getAdvanced()) {
// advanced graphics are available
} else {
// advanced graphics are NOT available
}
gc.dispose();
Re: Using antialiasing in a cross-platform product [message #463387 is a reply to message #463355] Fri, 04 November 2005 19:16 Go to previous message
Veronika Irvine is currently offline Veronika Irvine
Messages: 1272
Registered: July 2009
Senior Member
AntiAliasing is part of teh advanced graphics suport in SWT and there are
some requirements before it will work:

SWT 3.1
GDI+ on Windows, Cairo on Linux

It works on Mac OS X always.

As far as SWT.DEFAULT goes, some platforms such as Mac OS X have
anitaliasing turned on by default and some do not. Using SWT.DEFAULT will
give you the default behaviour for the platform. The default behaviour can
be overridden using SWT.ON and SWT.OFF.

"Fabian Wolf" <Fabian.Wolf@informatik.uni-ulm.de> wrote in message
news:dkf3ef$m9j$1@news.eclipse.org...
> Jason Grant wrote:
>
>> ...
>> 2) I'm thinking of including a 'fail early' test to avoid the
>> exceptions -
>> maybe create a GC at plugin load time, and if an exception is caught
>> during rendering, then the product will not setAntialias. Does this
>> sound
>> like a good practice? Are there better ways?
>> ...
>
> An early test to check wheter advanced graphics are available on your
> platform:
>
> GC gc = new GC(Display.getCurrent());
> gc.setAdvanced(true);
>
> if (gc.getAdvanced()) {
> // advanced graphics are available
> } else {
> // advanced graphics are NOT available
> }
> gc.dispose();
>
Previous Topic:GC.drawArc/fillArc results in different effects when antialias on/off?
Next Topic:Update font size immediately
Goto Forum:
  


Current Time: Wed Sep 03 02:27:43 GMT 2014

Powered by FUDForum. Page generated in 0.04344 seconds