\section{KPixmap Class Reference}
\label{classKPixmap}\index{KPixmap@{KPixmap}}
Off-screen paint device with extended features.  


{\tt \#include $<$kpixmap.h$>$}

Inheritance diagram for KPixmap:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=46pt]{classKPixmap__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KPixmap:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=46pt]{classKPixmap__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum {\bf Color\-Mode} \{ \par
{\bf Auto}, 
{\bf Color}, 
{\bf Mono}, 
{\bf Low\-Color}, 
\par
{\bf Web\-Color}
 \}
\item 
enum {\bf Gradient\-Mode} \{ {\bf Horizontal}, 
{\bf Vertical}, 
{\bf Diagonal}, 
{\bf Cross\-Diagonal}
 \}
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KPixmap} ()
\item 
{\bf $\sim$KPixmap} ()
\item 
{\bf KPixmap} (const {\bf QPixmap} \&pix)
\item 
bool {\bf convert\-From\-Image} (const {\bf QImage} \&img, int conversion\_\-flags)
\item 
bool {\bf convert\-From\-Image} (const {\bf QImage} \&img, {\bf Color\-Mode} mode=Web\-Color)
\item 
bool {\bf load} (const {\bf QString} \&file\-Name, const char $\ast$format, int conversion\_\-flags)
\item 
bool {\bf load} (const {\bf QString} \&file\-Name, const char $\ast$format=0, {\bf Color\-Mode} mode=Web\-Color)
\item 
bool {\bf check\-Color\-Table} (const {\bf QImage} \&image)
\end{CompactItemize}


\subsection{Detailed Description}
Off-screen paint device with extended features. 

KPixmap has two new color modes, Web\-Color and Low\-Color, applicable to 8bpp displays.

In Web\-Color mode all images are dithered to the Netscape palette, even when they have their own color table. Web\-Color is the default mode for KPixmap so that standard applications can share the Netscape palette across the desktop.

In Low\-Color mode images are checked to see if their color table matches the {\bf KDE} icon palette. If the color tables do not match, the images are dithered to a minimal 3x3x3 color cube. Low\-Color 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.

\begin{Desc}
\item[Author:]Mark Donohoe ({\tt donohoe@kde.org}) \end{Desc}
\begin{Desc}
\item[Version:]\begin{Desc}
\item[Id]{\bf kpixmap.h}{\rm (p.\,\pageref{kpixmap_8h})} 345302 2004-09-09 20:44:57Z staniek \end{Desc}
\end{Desc}




Definition at line 57 of file kpixmap.h.

\subsection{Member Enumeration Documentation}
\index{KPixmap@{KPixmap}!ColorMode@{ColorMode}}
\index{ColorMode@{ColorMode}!KPixmap@{KPixmap}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf enum} {\bf KPixmap::Color\-Mode}}\label{classKPixmap_w9}


This enumeration provides a color pallete specification. 

\begin{Desc}
\item[See also:]{\bf KPixmap::convert\-From\-Image()}{\rm (p.\,\pageref{classKPixmap_a3})}, {\bf KPixmap::load()}{\rm (p.\,\pageref{classKPixmap_a5})}\end{Desc}
\begin{Desc}
\item[Enumeration values: ]\par
\begin{description}
\index{Auto@{Auto}!KPixmap@{KPixmap}}\index{KPixmap@{KPixmap}!Auto@{Auto}}\item[{\em 
Auto\label{classKPixmap_w9w0}
}]Convert to monochrome if possible. \index{Color@{Color}!KPixmap@{KPixmap}}\index{KPixmap@{KPixmap}!Color@{Color}}\item[{\em 
Color\label{classKPixmap_w9w1}
}]Native display depth. \index{Mono@{Mono}!KPixmap@{KPixmap}}\index{KPixmap@{KPixmap}!Mono@{Mono}}\item[{\em 
Mono\label{classKPixmap_w9w2}
}]Monochrome pixmap. \index{LowColor@{LowColor}!KPixmap@{KPixmap}}\index{KPixmap@{KPixmap}!LowColor@{LowColor}}\item[{\em 
Low\-Color\label{classKPixmap_w9w3}
}]3x3x3 color cube (or monochrome) \index{WebColor@{WebColor}!KPixmap@{KPixmap}}\index{KPixmap@{KPixmap}!WebColor@{WebColor}}\item[{\em 
Web\-Color\label{classKPixmap_w9w4}
}]Netscape pallete (or monochrome). \end{description}
\end{Desc}



Definition at line 64 of file kpixmap.h.\index{KPixmap@{KPixmap}!GradientMode@{GradientMode}}
\index{GradientMode@{GradientMode}!KPixmap@{KPixmap}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf enum} {\bf KPixmap::Gradient\-Mode}}\label{classKPixmap_w10}


This enumeration provides a gradient mode specification. 



Definition at line 73 of file kpixmap.h.

\subsection{Constructor \& Destructor Documentation}
\index{KPixmap@{KPixmap}!KPixmap@{KPixmap}}
\index{KPixmap@{KPixmap}!KPixmap@{KPixmap}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KPixmap::KPixmap ()\hspace{0.3cm}{\tt  [inline]}}\label{classKPixmap_a0}


Constructs a null pixmap. 



Definition at line 82 of file kpixmap.h.\index{KPixmap@{KPixmap}!~KPixmap@{$\sim$KPixmap}}
\index{~KPixmap@{$\sim$KPixmap}!KPixmap@{KPixmap}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KPixmap::$\sim${\bf KPixmap} ()}\label{classKPixmap_a1}


Destructs the pixmap. 

\#\#\# {\bf KDE} 4: remove

Definition at line 186 of file kpixmap.cpp.\index{KPixmap@{KPixmap}!KPixmap@{KPixmap}}
\index{KPixmap@{KPixmap}!KPixmap@{KPixmap}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KPixmap::KPixmap (const {\bf QPixmap} \& {\em pix})}\label{classKPixmap_a2}


Copies the {\bf QPixmap} {\tt pix}. 



Definition at line 412 of file kpixmap.cpp.

\subsection{Member Function Documentation}
\index{KPixmap@{KPixmap}!convertFromImage@{convertFromImage}}
\index{convertFromImage@{convertFromImage}!KPixmap@{KPixmap}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KPixmap::convert\-From\-Image (const {\bf QImage} \& {\em img}, int {\em conversion\_\-flags})}\label{classKPixmap_a3}


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

\begin{itemize}
\item Web\-Color - 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. \item Low\-Color - 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. \item Auto\-Color (default) - If the image has depth 1 and contains only black and white pixels, then the pixmap becomes monochrome. \item Color\-Only - The pixmap is dithered/converted to the native display depth. \item Mono\-Only - The pixmap becomes monochrome. If necessary, it is dithered using the chosen dithering algorithm.\end{itemize}
Dithering mode preference, for RGB channels

\begin{itemize}
\item Diffuse\-Dither (default) - A high quality dither. \item Ordered\-Dither - A faster more ordered dither. \item Threshold\-Dither - No dithering, closest color is used.\end{itemize}
Dithering mode preference, for alpha channel

\begin{itemize}
\item Diffuse\-Alpha\-Dither - A high quality dither. \item Ordered\-Alpha\-Dither - A faster more ordered dither. \item Threshold\-Alpha\-Dither (default) - No dithering.\end{itemize}
Color matching versus dithering preference

\begin{itemize}
\item Prefer\-Dither - Always dither 32-bit images when the image is being converted to 8-bits. This is the default when converting to a pixmap. \item Avoid\-Dither - 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.\end{itemize}
Passing 0 for {\tt conversion\_\-flags} gives all the default options.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em img}]the image to convert \item[{\em conversion\_\-flags}]bitmask, described above \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]{\tt true} if successful. \end{Desc}


Reimplemented from {\bf QPixmap}.

Definition at line 249 of file kpixmap.cpp.

References Auto, check\-Color\-Table(), QPixmap::convert\-From\-Image(), QPixmap::default\-Depth(), QPixmap::detach(), QImage::height(), QImage::set\-Alpha\-Buffer(), QPixmap::set\-Mask(), and QImage::width().

Referenced by convert\-From\-Image(), load(), KPixmap\-Effect::pattern(), and KPixmap\-Effect::selected\-Pixmap().\index{KPixmap@{KPixmap}!convertFromImage@{convertFromImage}}
\index{convertFromImage@{convertFromImage}!KPixmap@{KPixmap}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KPixmap::convert\-From\-Image (const {\bf QImage} \& {\em img}, {\bf Color\-Mode} {\em mode} = {\tt WebColor})}\label{classKPixmap_a4}


This is an overloaded member function, provided for convenience. 

It differs from the above function only in what argument(s) it accepts. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em img}]the image to convert \item[{\em mode}]a Color\-Mode to apply \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]{\tt true} if successful. \end{Desc}


Reimplemented from {\bf QPixmap}.

Definition at line 227 of file kpixmap.cpp.

References Color, convert\-From\-Image(), Low\-Color, Mono, and Web\-Color.\index{KPixmap@{KPixmap}!load@{load}}
\index{load@{load}!KPixmap@{KPixmap}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KPixmap::load (const {\bf QString} \& {\em file\-Name}, const char $\ast$ {\em format}, int {\em conversion\_\-flags})}\label{classKPixmap_a5}


Loads a pixmap from the file {\tt file\-Name}. 

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 {\bf QImage\-IO} documentation lists the supported image formats and explains how to add extra formats.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em file\-Name}]the name of the file to load the image from \item[{\em format}]the format for the image \item[{\em conversion\_\-flags}]a bitmask, as described in {\bf convert\-From\-Image()}{\rm (p.\,\pageref{classKPixmap_a3})} \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]{\tt true} if successful, or false if the pixmap could not be loaded. \end{Desc}


Reimplemented from {\bf QPixmap}.

Definition at line 190 of file kpixmap.cpp.

References convert\-From\-Image(), QPixmap::detach(), QImage\-IO::image(), and QImage\-IO::read().

Referenced by load().\index{KPixmap@{KPixmap}!load@{load}}
\index{load@{load}!KPixmap@{KPixmap}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KPixmap::load (const {\bf QString} \& {\em file\-Name}, const char $\ast$ {\em format} = {\tt 0}, {\bf Color\-Mode} {\em mode} = {\tt WebColor})}\label{classKPixmap_a6}


This is an overloaded member function, provided for convenience. 

It differs from the above function only in what argument(s) it accepts. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em file\-Name}]the name of the file to load the image from \item[{\em format}]the format for the image \item[{\em mode}]a Color\-Mode to apply \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]{\tt true} if successful, or false if the pixmap could not be loaded. \end{Desc}


Reimplemented from {\bf QPixmap}.

Definition at line 204 of file kpixmap.cpp.

References Color, load(), Low\-Color, Mono, and Web\-Color.\index{KPixmap@{KPixmap}!checkColorTable@{checkColorTable}}
\index{checkColorTable@{checkColorTable}!KPixmap@{KPixmap}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KPixmap::check\-Color\-Table (const {\bf QImage} \& {\em image})}\label{classKPixmap_a7}


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. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em image}]the image to test \end{description}
\end{Desc}


Definition at line 317 of file kpixmap.cpp.

Referenced by convert\-From\-Image().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kpixmap.h\item 
kpixmap.cpp\end{CompactItemize}
