org.kde.koala
Class KPixmapEffect

java.lang.Object
  extended by org.kde.koala.KPixmapEffect
All Implemented Interfaces:
org.kde.qt.QtSupport

public class KPixmapEffect
extends java.lang.Object
implements org.kde.qt.QtSupport

This class includes various pixmap-based graphical effects. Everything is static, so there is no need to create an instance of this class. You can just call the static methods. They are encapsulated here merely to provide a common namespace.


Field Summary
static int Blue
           
static int CrossDiagonalGradient
           
static int DiagonalGradient
           
static int EastLite
           
static int EllipticGradient
           
static int Green
           
static int HorizontalGradient
           
static int NELite
           
static int NorthLite
           
static int NWLite
           
static int PipeCrossGradient
           
static int PyramidGradient
           
static int RectangleGradient
           
static int Red
           
static int SELite
           
static int SouthLite
           
static int SWLite
           
static int VerticalGradient
           
static int WestLite
           
 
Constructor Summary
  KPixmapEffect()
           
protected KPixmapEffect(java.lang.Class dummy)
           
 
Method Summary
static KPixmap blend(KPixmap pixmap, float initial_intensity, org.kde.qt.QColor bgnd, int eff)
           
static KPixmap blend(KPixmap pixmap, float initial_intensity, org.kde.qt.QColor bgnd, int eff, boolean anti_dir)
           
static KPixmap blend(KPixmap pixmap, float initial_intensity, org.kde.qt.QColor bgnd, int eff, boolean anti_dir, int ncols)
          Blends the provided pixmap into a background of the indicated color.
static KPixmap channelIntensity(KPixmap pixmap, float ratio, int channel)
          Modifies the intensity of a pixmap's RGB channel component.
static KPixmap contrast(KPixmap pixmap, int c)
          Modifies the contrast of a pixmap.
static KPixmap createTiled(KPixmap pixmap, org.kde.qt.QSize size)
          Creates a pixmap of a given size with the given pixmap.
static KPixmap desaturate(KPixmap pixmap)
           
static KPixmap desaturate(KPixmap pixmap, float desat)
          Desaturates a pixmap.
 void dispose()
          Delete the wrapped C++ instance ahead of finalize()
static KPixmap dither(KPixmap pixmap, org.kde.qt.QColor palette, int size)
          Dithers a pixmap using Floyd-Steinberg dithering for low-color situations.
static KPixmap fade(KPixmap pixmap, double val, org.kde.qt.QColor color)
          Fades a pixmap to a certain color.
protected  void finalize()
          Deletes the wrapped C++ instance
static KPixmap gradient(KPixmap pixmap, org.kde.qt.QColor ca, org.kde.qt.QColor cb, int type)
           
static KPixmap gradient(KPixmap pixmap, org.kde.qt.QColor ca, org.kde.qt.QColor cb, int type, int ncols)
          Creates a gradient from color a to color b of the specified type.
static KPixmap hash(KPixmap pixmap)
           
static KPixmap hash(KPixmap pixmap, int lite)
           
static KPixmap hash(KPixmap pixmap, int lite, int spacing)
           
static KPixmap hash(KPixmap pixmap, int lite, int spacing, int ncols)
          Builds a hash on any given pixmap.
static KPixmap intensity(KPixmap pixmap, float ratio)
          Either brightens or dims a pixmap by a specified ratio.
 boolean isDisposed()
          Has the wrapped C++ instance been deleted?
static KPixmap pattern(KPixmap pixmap, org.kde.qt.QSize size, org.kde.qt.QColor ca, org.kde.qt.QColor cb)
           
static KPixmap pattern(KPixmap pixmap, org.kde.qt.QSize size, org.kde.qt.QColor ca, org.kde.qt.QColor cb, int ncols)
          Creates a pattern from a pixmap.
static KPixmap selectedPixmap(KPixmap pixmap, org.kde.qt.QColor col)
          Calculate a 'selected' pixmap, for instance a selected icon on the desktop.
static KPixmap toGray(KPixmap pixmap)
           
static KPixmap toGray(KPixmap pixmap, boolean fast)
          Converts a pixmap to grayscale.
static KPixmap unbalancedGradient(KPixmap pixmap, org.kde.qt.QColor ca, org.kde.qt.QColor cb, int type)
           
static KPixmap unbalancedGradient(KPixmap pixmap, org.kde.qt.QColor ca, org.kde.qt.QColor cb, int type, int xfactor)
           
static KPixmap unbalancedGradient(KPixmap pixmap, org.kde.qt.QColor ca, org.kde.qt.QColor cb, int type, int xfactor, int yfactor)
           
static KPixmap unbalancedGradient(KPixmap pixmap, org.kde.qt.QColor ca, org.kde.qt.QColor cb, int type, int xfactor, int yfactor, int ncols)
          Creates an unbalanced gradient.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VerticalGradient

public static final int VerticalGradient
See Also:
Constant Field Values

HorizontalGradient

public static final int HorizontalGradient
See Also:
Constant Field Values

DiagonalGradient

public static final int DiagonalGradient
See Also:
Constant Field Values

CrossDiagonalGradient

public static final int CrossDiagonalGradient
See Also:
Constant Field Values

PyramidGradient

public static final int PyramidGradient
See Also:
Constant Field Values

RectangleGradient

public static final int RectangleGradient
See Also:
Constant Field Values

PipeCrossGradient

public static final int PipeCrossGradient
See Also:
Constant Field Values

EllipticGradient

public static final int EllipticGradient
See Also:
Constant Field Values

Red

public static final int Red
See Also:
Constant Field Values

Green

public static final int Green
See Also:
Constant Field Values

Blue

public static final int Blue
See Also:
Constant Field Values

NorthLite

public static final int NorthLite
See Also:
Constant Field Values

NWLite

public static final int NWLite
See Also:
Constant Field Values

WestLite

public static final int WestLite
See Also:
Constant Field Values

SWLite

public static final int SWLite
See Also:
Constant Field Values

SouthLite

public static final int SouthLite
See Also:
Constant Field Values

SELite

public static final int SELite
See Also:
Constant Field Values

EastLite

public static final int EastLite
See Also:
Constant Field Values

NELite

public static final int NELite
See Also:
Constant Field Values
Constructor Detail

KPixmapEffect

protected KPixmapEffect(java.lang.Class dummy)

KPixmapEffect

public KPixmapEffect()
Method Detail

gradient

public static KPixmap gradient(KPixmap pixmap,
                               org.kde.qt.QColor ca,
                               org.kde.qt.QColor cb,
                               int type,
                               int ncols)
Creates a gradient from color a to color b of the specified type.

Parameters:
pixmap - The pixmap to process.
ca - Color a.
cb - Color b.
type - The type of gradient.
ncols - The number of colors to use when not running on a truecolor display. The gradient will be dithered to this number of colors. Pass 0 to prevent dithering.
Returns:
Returns the generated pixmap, for convenience.

gradient

public static KPixmap gradient(KPixmap pixmap,
                               org.kde.qt.QColor ca,
                               org.kde.qt.QColor cb,
                               int type)

unbalancedGradient

public static KPixmap unbalancedGradient(KPixmap pixmap,
                                         org.kde.qt.QColor ca,
                                         org.kde.qt.QColor cb,
                                         int type,
                                         int xfactor,
                                         int yfactor,
                                         int ncols)
Creates an unbalanced gradient. An unbalanced gradient is a gradient where the transition from color a to color b is not linear, but in this case, exponential.

Parameters:
pixmap - The pixmap that should be written.
ca - Color a.
cb - Color b.
type - The type of gradient.
xfactor - The x decay length. Use a value between -200 and 200.
yfactor - The y decay length.
ncols - The number of colors. See #gradient.
Returns:
The generated pixmap, for convencience.

unbalancedGradient

public static KPixmap unbalancedGradient(KPixmap pixmap,
                                         org.kde.qt.QColor ca,
                                         org.kde.qt.QColor cb,
                                         int type,
                                         int xfactor,
                                         int yfactor)

unbalancedGradient

public static KPixmap unbalancedGradient(KPixmap pixmap,
                                         org.kde.qt.QColor ca,
                                         org.kde.qt.QColor cb,
                                         int type,
                                         int xfactor)

unbalancedGradient

public static KPixmap unbalancedGradient(KPixmap pixmap,
                                         org.kde.qt.QColor ca,
                                         org.kde.qt.QColor cb,
                                         int type)

createTiled

public static KPixmap createTiled(KPixmap pixmap,
                                  org.kde.qt.QSize size)
Creates a pixmap of a given size with the given pixmap. if the given size is bigger than the size of the pixmap, the pixmap is tiled.

Parameters:
pixmap - This is the source pixmap
size - The size the new pixmap should have.
Returns:
The generated, tiled pixmap.

intensity

public static KPixmap intensity(KPixmap pixmap,
                                float ratio)
Either brightens or dims a pixmap by a specified ratio.

Parameters:
pixmap - The pixmap to process.
ratio - The ratio to use. Use negative value to dim.
Returns:
Returns The pixmap(), provided for convenience.

channelIntensity

public static KPixmap channelIntensity(KPixmap pixmap,
                                       float ratio,
                                       int channel)
Modifies the intensity of a pixmap's RGB channel component.

Parameters:
pixmap - The pixmap to process.
ratio - value. Use negative value to dim.
channel - Which channel(s) should be modified
Returns:
Returns the pixmap(), provided for convenience.

blend

public static KPixmap blend(KPixmap pixmap,
                            float initial_intensity,
                            org.kde.qt.QColor bgnd,
                            int eff,
                            boolean anti_dir,
                            int ncols)
Blends the provided pixmap into a background of the indicated color.

Parameters:
pixmap - The pixmap to process.
initial_intensity - this parameter takes values from -1 to 1:
  • If positive, it tells how much to fade the image in its less affected spot.
  • If negative, it tells roughly indicates how much of the image remains unaffected
  • bgnd - Indicates the color of the background to blend in.
    eff - Lets you choose what kind of blending you like.
    anti_dir - Blend in the opposite direction (makes no much sense with concentric blending effects).
    ncols - The number of colors to dither the pixmap to. Only used for 8 bpp pixmaps.
    Returns:
    Returns the pixmap(), provided for convenience.

    blend

    public static KPixmap blend(KPixmap pixmap,
                                float initial_intensity,
                                org.kde.qt.QColor bgnd,
                                int eff,
                                boolean anti_dir)

    blend

    public static KPixmap blend(KPixmap pixmap,
                                float initial_intensity,
                                org.kde.qt.QColor bgnd,
                                int eff)

    hash

    public static KPixmap hash(KPixmap pixmap,
                               int lite,
                               int spacing,
                               int ncols)
    Builds a hash on any given pixmap.

    Parameters:
    pixmap - The pixmap to process.
    lite - The hash faces the indicated lighting (cardinal poles)
    spacing - How many unmodified pixels inbetween hashes.
    ncols - The number of colors to dither the pixmap to. Only used for 8 bpp pixmaps.
    Returns:
    Returns The pixmap(), provided for convenience.

    hash

    public static KPixmap hash(KPixmap pixmap,
                               int lite,
                               int spacing)

    hash

    public static KPixmap hash(KPixmap pixmap,
                               int lite)

    hash

    public static KPixmap hash(KPixmap pixmap)

    pattern

    public static KPixmap pattern(KPixmap pixmap,
                                  org.kde.qt.QSize size,
                                  org.kde.qt.QColor ca,
                                  org.kde.qt.QColor cb,
                                  int ncols)
    Creates a pattern from a pixmap. The given pixmap is "flattened" between color a to color b. Doesn't change the original pixmap.

    Parameters:
    pixmap - The pixmap to process.
    size - The size of the returned pixmap. If size is larger than the original, the resulting pixmap will be tiled.
    ca - Color a.
    cb - Color b.
    ncols - The number of colors to use. The image will be dithered to this depth. Pass zero to prevent dithering.
    Returns:
    The resulting pixmap.

    pattern

    public static KPixmap pattern(KPixmap pixmap,
                                  org.kde.qt.QSize size,
                                  org.kde.qt.QColor ca,
                                  org.kde.qt.QColor cb)

    fade

    public static KPixmap fade(KPixmap pixmap,
                               double val,
                               org.kde.qt.QColor color)
    Fades a pixmap to a certain color.

    Parameters:
    pixmap - The pixmap to process.
    val - The strength of the effect. 0 <= val <= 1.
    color - The color to blend to.
    Returns:
    Returns the pixmap(), provided for convenience.

    toGray

    public static KPixmap toGray(KPixmap pixmap,
                                 boolean fast)
    Converts a pixmap to grayscale.

    Parameters:
    pixmap - The pixmap to process.
    fast - Set to true in order to use a faster but non-photographic quality algorithm. Appropriate for things such as toolbar icons.
    Returns:
    Returns the pixmap(), provided for convenience.

    toGray

    public static KPixmap toGray(KPixmap pixmap)

    desaturate

    public static KPixmap desaturate(KPixmap pixmap,
                                     float desat)
    Desaturates a pixmap.

    Parameters:
    pixmap - The pixmap to process.
    desat - A value between 0 and 1 setting the degree of desaturation
    Returns:
    Returns The pixmap(), provided for convenience.

    desaturate

    public static KPixmap desaturate(KPixmap pixmap)

    contrast

    public static KPixmap contrast(KPixmap pixmap,
                                   int c)
    Modifies the contrast of a pixmap.

    Parameters:
    pixmap - The pixmap to process.
    c - A contrast value between -255 and 255.
    Returns:
    Returns the pixmap(), provided for convenience.

    dither

    public static KPixmap dither(KPixmap pixmap,
                                 org.kde.qt.QColor palette,
                                 int size)
    Dithers a pixmap using Floyd-Steinberg dithering for low-color situations.

    Parameters:
    pixmap - The pixmap to process.
    palette - The color palette to use.
    size - The size of the palette.
    Returns:
    Returns the pixmap(), provided for convenience.

    selectedPixmap

    public static KPixmap selectedPixmap(KPixmap pixmap,
                                         org.kde.qt.QColor col)
    Calculate a 'selected' pixmap, for instance a selected icon on the desktop.

    Parameters:
    pixmap - the pixmap to select
    col - the selected color, usually from QColorGroup.highlight().

    finalize

    protected void finalize()
                     throws java.lang.InternalError
    Deletes the wrapped C++ instance

    Overrides:
    finalize in class java.lang.Object
    Throws:
    java.lang.InternalError

    dispose

    public void dispose()
    Delete the wrapped C++ instance ahead of finalize()


    isDisposed

    public boolean isDisposed()
    Has the wrapped C++ instance been deleted?