# kdefx Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# KPixmapSplitter Class Reference

A class to split a pixmap into several items. More...

`#include <kpixmapsplitter.h>`

Collaboration diagram for KPixmapSplitter:

[legend]
List of all members.

## Public Member Functions

| KPixmapSplitter ()
void | setPixmap (const QPixmap &pixmap)
const QPixmap & | pixmap () const
void | setItemSize (const QSize &size)
QSize | itemSize () const
void | setVSpacing (int spacing)
void | setHSpacing (int spacing)
QRect | coordinates (int pos)
QRect | coordinates (const QChar &ch)

## Detailed Description

A class to split a pixmap into several items.

If you have a pixmap containing several items (icons), you can use this class to get the coordinates of each item.

For example, if you have a pixmap with 25 items and you want to get the 4th item as a pixmap (every item being 20x10 pixels):

     KPixmapSplitter splitter;
     splitter.setPixmap( somePixmap );
     splitter.setItemSize( QSize( 20, 10 ));

     QPixmap item( 20, 10 );
     item.fill( Qt::white );
     QRect rect = splitter.coordinates( 4 );
     if ( !rect.isEmpty() )
         bitBlt( &item, QPoint(0,0), &somePixmap, rect, CopyROP );

Author:
  Carsten Pfeiffer <pfeiffer@kde.org>

Definition at line 53 of file kpixmapsplitter.h.

## Constructor & Destructor Documentation

KPixmapSplitter::KPixmapSplitter | ( |  | ) |

| Constructor, does nothing but initialize some default-values. Definition at line 22 of file kpixmapsplitter.cpp.

## Member Function Documentation

void KPixmapSplitter::setPixmap | ( | const QPixmap & | pixmap | ) |

| Sets the pixmap to be split. Definition at line 36 of file kpixmapsplitter.cpp. References pixmap().

const QPixmap& KPixmapSplitter::pixmap | ( |  | ) | const`[inline]`

Returns:
  the pixmap that has been set via setPixmap().

Definition at line 70 of file kpixmapsplitter.h.

Referenced by setPixmap().

void KPixmapSplitter::setItemSize | ( | const QSize & | size | ) |

| Sets the size of the items you want to get out of the given pixmap. The QRect of coordinates(int) will have the width and height of exactly this `size`. Definition at line 42 of file kpixmapsplitter.cpp.

QSize KPixmapSplitter::itemSize | ( |  | ) | const`[inline]`

Returns:
  the set size of the items (coordinates) you want to get out of the given pixmap.

Definition at line 83 of file kpixmapsplitter.h.

void KPixmapSplitter::setVSpacing | ( | int | spacing | ) |

| If there is space between rows in the given pixmap, you have to specify how many pixels there are. Definition at line 50 of file kpixmapsplitter.cpp.

void KPixmapSplitter::setHSpacing | ( | int | spacing | ) |

| If there is space between columns in the given pixmap, you have to specify how many pixels there are. Definition at line 58 of file kpixmapsplitter.cpp.

QRect KPixmapSplitter::coordinates | ( | int | pos | ) |

Returns:
  the coordinates of the item at position pos in the given pixmap.

Definition at line 67 of file kpixmapsplitter.cpp.

References QSize::height(), QPixmap::height(), QPixmap::isNull(), QSize::width(), and QPixmap::width().

Referenced by coordinates().

QRect KPixmapSplitter::coordinates | ( | const QChar & | ch | ) |

| Overloaded for convenience. Returns the item at the position of the given character (when using a latin1 font-pixmap) Definition at line 91 of file kpixmapsplitter.cpp. References coordinates().

The documentation for this class was generated from the following files:

- kpixmapsplitter.h
- kpixmapsplitter.cpp

This file is part of the documentation for kdefx Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:17:11 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003