DESY ACOP Beans Home

com.cosylab.gui.components.ledder
Class LedPaintContext

java.lang.Object
  extended by com.cosylab.gui.components.ledder.LedPaintContext
All Implemented Interfaces:
java.awt.PaintContext

public class LedPaintContext
extends java.lang.Object
implements java.awt.PaintContext

Renderer for Leds. Implements ray tracing with specular highlighting and antialiasing.

Version:
$id$
Author:
Ales Pucelj

Constructor Summary
LedPaintContext(int x, int y, LedPaintParameters parameters)
          Creates a new LedPaintContext object.
 
Method Summary
 void createOffsetArray(int factor, int width)
          Creates array for antialiasing.
 void dispose()
          Destroys this context.
 java.awt.image.ColorModel getColorModel()
          Returns color model used by this context: ColorModel.getRGBdefault().
 java.awt.image.Raster getRaster(int x, int y, int w, int h)
          Creates buffer, renders the led and antialiases the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LedPaintContext

public LedPaintContext(int x,
                       int y,
                       LedPaintParameters parameters)
Creates a new LedPaintContext object.

Parameters:
x - horizontal size.
y - vertical size.
parameters - defining the context.
Method Detail

dispose

public void dispose()
Destroys this context.

Specified by:
dispose in interface java.awt.PaintContext

getColorModel

public java.awt.image.ColorModel getColorModel()
Returns color model used by this context: ColorModel.getRGBdefault().

Specified by:
getColorModel in interface java.awt.PaintContext
Returns:
RGB Color model.

createOffsetArray

public void createOffsetArray(int factor,
                              int width)
Creates array for antialiasing.

Parameters:
factor - by which to scale the array.
width - original width of the array.

getRaster

public java.awt.image.Raster getRaster(int x,
                                       int y,
                                       int w,
                                       int h)
Creates buffer, renders the led and antialiases the result.

Specified by:
getRaster in interface java.awt.PaintContext
Parameters:
x - offset.
y - offset.
w - width of area to render.
h - height of area to render.
Returns:
Raster of rendered pixels.


Copyright © 2010. All Rights Reserved.