[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] need an efficient GC.setPixel( int, int )


Hello,

I'm using eclipse.2.1.0 on win32 system.
I want to draw a pixel with a color on a GC,
I know I can use GC.drawLine(x,y,x,y), that all users do...

But as we can see in GC source file drawLine (on win32)
do:
 - check various things...
 - OS.moveTo(...)
 - OS.lineTo(...)
 - OS.setPixel(...)

Here moveTo()/lineTo() spend time to do nothing.
As I test it in my code replacing drawPixel(x,y,x,y)
by OS.setPixel( ... ), I now this second solution
is 3 (or more times) faster !

So the question is, can GC class be upgraded to have
this kind of method ?
 - public void setPixel( int _x, int _y );
 - public void setPixel( int _x, int _y, Color _color );


If it's already done or planed to do in 3.0 ... forget me.

Thanks a lot!

Arnaud.

PS:
 Using setPixel() in conjonction to color creation, what is the speedest
 way to set a color and draw a pixel ?
 (I mean  create Color object each time I drawpixel is a total waste of
  memory and time ... ).