• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdefx
 

tdefx

Public Types | Public Member Functions
KPixmap Class Reference

#include <kpixmap.h>

Inheritance diagram for KPixmap:
TQPixmap

List of all members.

Public Types

enum  ColorMode {
  Auto, Color, Mono, LowColor,
  WebColor
}
enum  GradientMode { Horizontal, Vertical, Diagonal, CrossDiagonal }

Public Member Functions

 KPixmap ()
 ~KPixmap ()
 KPixmap (const TQPixmap &pix)
bool convertFromImage (const TQImage &img, int conversion_flags)
bool convertFromImage (const TQImage &img, ColorMode mode=WebColor)
bool load (const TQString &fileName, const char *format, int conversion_flags)
bool load (const TQString &fileName, const char *format=0, ColorMode mode=WebColor)
bool checkColorTable (const TQImage &image)

Detailed Description

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.

Author:
Mark Donohoe (donohoe@kde.org)
Version:
$Id$

Definition at line 57 of file kpixmap.h.


Member Enumeration Documentation

enum KPixmap::ColorMode

This enumeration provides a color pallete specification.

See also:
KPixmap::convertFromImage(), KPixmap::load()
Enumerator:
Auto 

Convert to monochrome if possible.

Color 

Native display depth.

Mono 

Monochrome pixmap.

LowColor 

3x3x3 color cube (or monochrome)

WebColor 

Netscape pallete (or monochrome)

Definition at line 64 of file kpixmap.h.

enum KPixmap::GradientMode

This enumeration provides a gradient mode specification.

Definition at line 73 of file kpixmap.h.


Constructor & Destructor Documentation

KPixmap::KPixmap ( ) [inline]

Constructs a null pixmap.

Definition at line 82 of file kpixmap.h.

KPixmap::~KPixmap ( )

Destructs the pixmap.

### KDE 4: remove

Definition at line 160 of file kpixmap.cpp.

KPixmap::KPixmap ( const TQPixmap &  pix)

Copies the TQPixmap pix.

Definition at line 386 of file kpixmap.cpp.


Member Function Documentation

bool KPixmap::checkColorTable ( const TQImage &  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:
imagethe image to test

Definition at line 291 of file kpixmap.cpp.

bool KPixmap::convertFromImage ( const TQImage &  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:
imgthe image to convert
conversion_flagsbitmask, described above
Returns:
true if successful.

Reimplemented from TQPixmap.

Definition at line 223 of file kpixmap.cpp.

bool KPixmap::convertFromImage ( const TQImage &  img,
ColorMode  mode = WebColor 
)

This is an overloaded member function, provided for convenience.

It differs from the above function only in what argument(s) it accepts.

Parameters:
imgthe image to convert
modea ColorMode to apply
Returns:
true if successful.

Definition at line 201 of file kpixmap.cpp.

bool KPixmap::load ( const TQString &  fileName,
const char *  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 TQImageIO documentation lists the supported image formats and explains how to add extra formats.

Parameters:
fileNamethe name of the file to load the image from
formatthe format for the image
conversion_flagsa bitmask, as described in convertFromImage()
Returns:
true if successful, or false if the pixmap could not be loaded.

Reimplemented from TQPixmap.

Definition at line 164 of file kpixmap.cpp.

bool KPixmap::load ( const TQString &  fileName,
const char *  format = 0,
ColorMode  mode = WebColor 
)

This is an overloaded member function, provided for convenience.

It differs from the above function only in what argument(s) it accepts.

Parameters:
fileNamethe name of the file to load the image from
formatthe format for the image
modea ColorMode to apply
Returns:
true if successful, or false if the pixmap could not be loaded.

Definition at line 178 of file kpixmap.cpp.


The documentation for this class was generated from the following files:
  • kpixmap.h
  • kpixmap.cpp

tdefx

Skip menu "tdefx"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

tdefx

Skip menu "tdefx"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdefx by doxygen 1.7.6.1
This website is maintained by Timothy Pearson.