com.tensegrity.graphics.device.swt
Class SWTGradientContext

java.lang.Object
  extended bycom.tensegrity.graphics.device.swt.SWTGradientContext

public class SWTGradientContext
extends java.lang.Object

Instances of SWTGradientContext allow the rendering of gradients on an ImageData object.

The only public method fill(ImageData, int, int, int, int) forwards its call to the various fillXXX(ImageData , int, int) methods, each of which is dedicated to a specific type of gradient. Please refer to these methods' documentation for more information.

Notice:
Transparency is not managed by this class and it is the caller's responsability to manage and adequately set it on the ImageData passed to the fill(ImageData, int, int, int, int) method.

Version:
$Id: SWTGradientContext.java,v 1.8 2005/07/06 12:14:14 SebastienGuyon Exp $
Author:
S�bastien Guyon

Constructor Summary
SWTGradientContext(Gradient gradient, org.eclipse.swt.graphics.Rectangle rcPaint)
           Initializes and returns instances of SWTGradientContext which will allow the creation of gradients going from the foreground color of gradient to its background color (see Gradient.getForeground() and Gradient.getBackground()).
 
Method Summary
 void fill(org.eclipse.swt.graphics.ImageData imageData, int x, int y, int w, int h)
          Method used to fill an ImageData with a specific Gradient.
protected  void fillCenterCircle(org.eclipse.swt.graphics.ImageData imageData, int w, int h)
          Renders a concentric gradient from the center to all corners for the width and height given by w and h into the ImageData given by imageData.
protected  void fillCenterSquared(org.eclipse.swt.graphics.ImageData imageData, int w, int h)
          Renders a squared gradient from the center to all corners for the width and height given by w and h into the ImageData imageData.
protected  void fillDown(org.eclipse.swt.graphics.ImageData imageData, int w, int h)
          Renders the gradient from the left/top corner to the right/bottom corner for the width and height given by w and h into the ImageData given by imageData.
protected  void fillDownCenter(org.eclipse.swt.graphics.ImageData imageData, int w, int h)
          Renders the gradient from the left/top corner to the center and vice versa from the center to the right/bottom corner for the width and height given by w and h into the ImageData given by imageData.
protected  void fillHorizontalCenter(org.eclipse.swt.graphics.ImageData imageData, int w, int h)
          Renders the gradient from top to the center and vice versa from the center to bottom for the width and height given by w and h into the ImageData given by imageData.
protected  void fillLeftBottom(org.eclipse.swt.graphics.ImageData imageData, int w, int h)
          Renders a squared gradient from the left/bottom corner to the left/top and right/bottom corner for the width and height given by w and h into the ImageData given by imageData.
protected  void fillLeftTop(org.eclipse.swt.graphics.ImageData imageData, int w, int h)
          Renders a squared gradient from the left/top corner to the left/bottom and right/top corner for the width and height given by w and h into the ImageData given by imageData.
protected  void fillLeftTopCircle(org.eclipse.swt.graphics.ImageData imageData, int w, int h)
          Renders a concentric gradient from the left/top corner to the left/bottom and right/top corner for the width and height given by w and h into the ImageData given by imageData.
protected  void fillRightBottom(org.eclipse.swt.graphics.ImageData imageData, int w, int h)
          Renders a squared gradient from the right/bottom corner to the right/top and left/bottom corner for the width and height given by w and h into the ImageData given by imageData.
protected  void fillRightLeft(org.eclipse.swt.graphics.ImageData imageData, int w, int h)
          Renders the gradient from right to left for the width and height given by w and h into the ImageData given by imageData.
protected  void fillRightTop(org.eclipse.swt.graphics.ImageData imageData, int w, int h)
          Renders a squared gradient from the right/top corner to the left/top and right/bottom corner for the width and height given by w and h into the ImageData given by imageData.
protected  void fillRightTopCircle(org.eclipse.swt.graphics.ImageData imageData, int w, int h)
          Renders a concentric gradient from the right/top corner to the right/bottom and left/top corner for the width and height given by w and h into the ImageData given by imageData.
protected  void fillTopBottom(org.eclipse.swt.graphics.ImageData imageData, int w, int h)
          Renders the gradient from top to bottom for the width and height given by w and h into the ImageData given by imageData.
protected  void fillUp(org.eclipse.swt.graphics.ImageData imageData, int w, int h)
          Renders the gradient from the left/bottom corner to the right/top corner for the width and height given by w and h into the ImageData given by imageData.
protected  void fillUpCenter(org.eclipse.swt.graphics.ImageData imageData, int w, int h)
          Renders the gradient from the left/bottom corner to the center and vice versa from the center to the right/top corner for the width and height given by w and h into the ImageData given by imageData.
protected  void fillVerticalCenter(org.eclipse.swt.graphics.ImageData imageData, int w, int h)
          Renders the gradient from right to the center and vice versa from the center to the left for the width and height given by w and h into the ImageData given by imageData.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SWTGradientContext

public SWTGradientContext(Gradient gradient,
                          org.eclipse.swt.graphics.Rectangle rcPaint)

Initializes and returns instances of SWTGradientContext which will allow the creation of gradients going from the foreground color of gradient to its background color (see Gradient.getForeground() and Gradient.getBackground()).

Parameters:
gradient - the Gradient used in this context.
rcPaint - the area which will be painted on.
Method Detail

fillRightLeft

protected void fillRightLeft(org.eclipse.swt.graphics.ImageData imageData,
                             int w,
                             int h)
Renders the gradient from right to left for the width and height given by w and h into the ImageData given by imageData.

Parameters:
imageData - the ImageData to render the gradient into
w - the width for the gradient
h - the height for the gradient

fillVerticalCenter

protected void fillVerticalCenter(org.eclipse.swt.graphics.ImageData imageData,
                                  int w,
                                  int h)
Renders the gradient from right to the center and vice versa from the center to the left for the width and height given by w and h into the ImageData given by imageData.

Parameters:
imageData - the ImageData to render the gradient into
w - the width for the gradient
h - the height for the gradient

fillTopBottom

protected void fillTopBottom(org.eclipse.swt.graphics.ImageData imageData,
                             int w,
                             int h)
Renders the gradient from top to bottom for the width and height given by w and h into the ImageData given by imageData.

Parameters:
imageData - the ImageData to render the gradient into
w - the width for the gradient
h - the height for the gradient

fillHorizontalCenter

protected void fillHorizontalCenter(org.eclipse.swt.graphics.ImageData imageData,
                                    int w,
                                    int h)
Renders the gradient from top to the center and vice versa from the center to bottom for the width and height given by w and h into the ImageData given by imageData.

Parameters:
imageData - the ImageData to render the gradient into
w - the width for the gradient
h - the height for the gradient

fillUp

protected void fillUp(org.eclipse.swt.graphics.ImageData imageData,
                      int w,
                      int h)
Renders the gradient from the left/bottom corner to the right/top corner for the width and height given by w and h into the ImageData given by imageData.

Parameters:
imageData - the ImageData to render the gradient into
w - the width for the gradient
h - the height for the gradient

fillUpCenter

protected void fillUpCenter(org.eclipse.swt.graphics.ImageData imageData,
                            int w,
                            int h)
Renders the gradient from the left/bottom corner to the center and vice versa from the center to the right/top corner for the width and height given by w and h into the ImageData given by imageData.

Parameters:
imageData - the ImageData to render the gradient into
w - the width for the gradient
h - the height for the gradient

fillDown

protected void fillDown(org.eclipse.swt.graphics.ImageData imageData,
                        int w,
                        int h)
Renders the gradient from the left/top corner to the right/bottom corner for the width and height given by w and h into the ImageData given by imageData.

Parameters:
imageData - the ImageData to render the gradient into
w - the width for the gradient
h - the height for the gradient

fillDownCenter

protected void fillDownCenter(org.eclipse.swt.graphics.ImageData imageData,
                              int w,
                              int h)
Renders the gradient from the left/top corner to the center and vice versa from the center to the right/bottom corner for the width and height given by w and h into the ImageData given by imageData.

Parameters:
imageData - the ImageData to render the gradient into
w - the width for the gradient
h - the height for the gradient

fillLeftBottom

protected void fillLeftBottom(org.eclipse.swt.graphics.ImageData imageData,
                              int w,
                              int h)
Renders a squared gradient from the left/bottom corner to the left/top and right/bottom corner for the width and height given by w and h into the ImageData given by imageData.

Parameters:
imageData - the ImageData to render the gradient into
w - the width for the gradient
h - the height for the gradient

fillRightBottom

protected void fillRightBottom(org.eclipse.swt.graphics.ImageData imageData,
                               int w,
                               int h)
Renders a squared gradient from the right/bottom corner to the right/top and left/bottom corner for the width and height given by w and h into the ImageData given by imageData.

Parameters:
imageData - the ImageData to render the gradient into
w - the width for the gradient
h - the height for the gradient

fillLeftTop

protected void fillLeftTop(org.eclipse.swt.graphics.ImageData imageData,
                           int w,
                           int h)
Renders a squared gradient from the left/top corner to the left/bottom and right/top corner for the width and height given by w and h into the ImageData given by imageData.

Parameters:
imageData - the ImageData to render the gradient into
w - the width for the gradient
h - the height for the gradient

fillRightTop

protected void fillRightTop(org.eclipse.swt.graphics.ImageData imageData,
                            int w,
                            int h)
Renders a squared gradient from the right/top corner to the left/top and right/bottom corner for the width and height given by w and h into the ImageData given by imageData.

Parameters:
imageData - the ImageData to render the gradient into
w - the width for the gradient
h - the height for the gradient

fillCenterSquared

protected void fillCenterSquared(org.eclipse.swt.graphics.ImageData imageData,
                                 int w,
                                 int h)
Renders a squared gradient from the center to all corners for the width and height given by w and h into the ImageData imageData.

Parameters:
imageData - the ImageData to render the gradient into
w - the width for the gradient
h - the height for the gradient

fill

public void fill(org.eclipse.swt.graphics.ImageData imageData,
                 int x,
                 int y,
                 int w,
                 int h)
Method used to fill an ImageData with a specific Gradient. It delegates its code to one of the fillXXX() methods, depending on the type of the internal Gradient instance. It is the caller's responsability to manage and adequately set the transparency on the passed ImageData.

Parameters:
imageData - the ImageData to render the gradient into
x - the x coordinate of the area in device space for which colors are generated.
y - the y coordinate of the area in device space for which colors are generated.
w - the width of the area in device space
h - the height of the area in device space

fillCenterCircle

protected void fillCenterCircle(org.eclipse.swt.graphics.ImageData imageData,
                                int w,
                                int h)
Renders a concentric gradient from the center to all corners for the width and height given by w and h into the ImageData given by imageData.

Parameters:
imageData - the ImageData to render the gradient into
w - the width for the gradient
h - the height for the gradient

fillLeftTopCircle

protected void fillLeftTopCircle(org.eclipse.swt.graphics.ImageData imageData,
                                 int w,
                                 int h)
Renders a concentric gradient from the left/top corner to the left/bottom and right/top corner for the width and height given by w and h into the ImageData given by imageData.

Parameters:
imageData - the ImageData to render the gradient into
w - the width for the gradient
h - the height for the gradient

fillRightTopCircle

protected void fillRightTopCircle(org.eclipse.swt.graphics.ImageData imageData,
                                  int w,
                                  int h)
Renders a concentric gradient from the right/top corner to the right/bottom and left/top corner for the width and height given by w and h into the ImageData given by imageData.

Parameters:
imageData - the ImageData to render the gradient into
w - the width for the gradient
h - the height for the gradient


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.