org.kde.koala

Class KPixmap

public class KPixmap extends QPixmap

Off-screen paint device with extended features. KPixmap has two new color modes, WebColor and LowColor, applicable to 8bpp displays. In WebColor mode all images are dithered to the Netscape palette, even when they have their own color table. WebColor is the default mode for KPixmap so that standard applications can share the Netscape palette across the desktop. In LowColor mode images are checked to see if their color table matches the KDE icon palette. If the color tables do not match, the images are dithered to a minimal 3x3x3 color cube. LowColor mode can be used to load icons, background images etc. so that components of the desktop which are always present use no more than 40 colors.

Version: $Id: KPixmap.java 473384 2005-10-23 14:17:09Z rdale $

Author: Mark Donohoe (donohoe@kde.org)

UNKNOWN: Off-screen paint device with extended features.

Field Summary
static intAuto
This enumeration provides a color pallete specification
static intColor
static intCrossDiagonal
static intDiagonal
static intHorizontal
This enumeration provides a gradient mode specification
static intLowColor
static intMono
static intVertical
static intWebColor
Constructor Summary
protected KPixmap(Class dummy)
KPixmap()
Constructs a null pixmap.
KPixmap(QPixmap pix)
Copies the QPixmap pix.
Method Summary
booleancheckColorTable(QImage image)
Returns true if the image posesses a color table that matches the Icon palette or false otherwise.
booleanconvertFromImage(QImage img, int conversion_flags)
Converts an image and sets this pixmap.
booleanconvertFromImage(QImage img)
voiddispose()
Delete the wrapped C++ instance ahead of finalize()
protected voidfinalize()
Deletes the wrapped C++ instance
booleanisDisposed()
Has the wrapped C++ instance been deleted?
booleanload(String fileName, String format, int conversion_flags)
Loads a pixmap from the file fileName. If format is specified, the loader attempts to read the pixmap using the specified format.
booleanload(String fileName, String format)
booleanload(String fileName)

Field Detail

Auto

public static final int Auto
This enumeration provides a color pallete specification

See Also: KPixmap KPixmap

UNKNOWN: This enumeration provides a color pallete specification

Color

public static final int Color

CrossDiagonal

public static final int CrossDiagonal

Diagonal

public static final int Diagonal

Horizontal

public static final int Horizontal
This enumeration provides a gradient mode specification

UNKNOWN: This enumeration provides a gradient mode specification

LowColor

public static final int LowColor

Mono

public static final int Mono

Vertical

public static final int Vertical

WebColor

public static final int WebColor

Constructor Detail

KPixmap

protected KPixmap(Class dummy)

KPixmap

public KPixmap()
Constructs a null pixmap.

UNKNOWN: Constructs a null pixmap.

KPixmap

public KPixmap(QPixmap pix)
Copies the QPixmap pix.

UNKNOWN: Copies the QPixmap pix.

Method Detail

checkColorTable

public boolean checkColorTable(QImage image)
Returns true if the image posesses a color table that matches the Icon palette or false otherwise. An image with one color not found in the Icon palette is considered to be a match, since this extra color may be a transparent background.

Parameters: image the image to test

UNKNOWN: Returns true if the image posesses a color table that matches the Icon palette or false otherwise.

convertFromImage

public boolean convertFromImage(QImage img, int conversion_flags)
Converts an image and sets this pixmap. The conversion_flags argument is a bitwise-OR from the following choices. The options marked (default) are the choice if no other choice from the list is included (they are zero): Color/Mono preference
  • WebColor - If the image has depth 1 and contains only black and white pixels then the pixmap becomes monochrome. If the pixmap has a depth of 8 bits per pixel then the Netscape palette is used for the pixmap color table.
  • LowColor - If the image has depth 1 and contains only black and white pixels then the pixmap becomes monochrome. If the pixmap has a depth of 8 bits per pixel and the image does not posess a color table that matches the Icon palette a 3x3x3 color cube is used for the pixmap color table.
  • AutoColor (default) - If the image has depth 1 and contains only black and white pixels, then the pixmap becomes monochrome.
  • ColorOnly - The pixmap is dithered/converted to the native display depth.
  • MonoOnly - The pixmap becomes monochrome. If necessary, it is dithered using the chosen dithering algorithm.
  • Dithering mode preference, for RGB channels
  • DiffuseDither (default) - A high quality dither.
  • OrderedDither - A faster more ordered dither.
  • ThresholdDither - No dithering, closest color is used.
  • Dithering mode preference, for alpha channel
  • DiffuseAlphaDither - A high quality dither.
  • OrderedAlphaDither - A faster more ordered dither.
  • ThresholdAlphaDither (default) - No dithering.
  • Color matching versus dithering preference
  • PreferDither - Always dither 32-bit images when the image is being converted to 8-bits. This is the default when converting to a pixmap.
  • AvoidDither - Only dither 32-bit images if the image has more than 256 colors and it is being converted to 8-bits. This is the default when an image is converted for the purpose of saving to a file.
  • Passing 0 for conversion_flags gives all the default options.

    Parameters: img the image to convert conversion_flags bitmask, described above

    Returns: true if successful.

    UNKNOWN: Converts an image and sets this pixmap.

    convertFromImage

    public boolean convertFromImage(QImage img)

    dispose

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

    finalize

    protected void finalize()
    Deletes the wrapped C++ instance

    isDisposed

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

    load

    public boolean load(String fileName, String format, int conversion_flags)
    Loads a pixmap from the file fileName. If format is specified, the loader attempts to read the pixmap using the specified format. If format is not specified (default), the loader reads a few bytes from the header to guess the file format. The QImageIO documentation lists the supported image formats and explains how to add extra formats.

    Parameters: fileName the name of the file to load the image from format the format for the image conversion_flags a bitmask, as described in convertFromImage()

    Returns: true if successful, or false if the pixmap could not be loaded.

    UNKNOWN: Loads a pixmap from the file fileName.

    load

    public boolean load(String fileName, String format)

    load

    public boolean load(String fileName)