class KPixmapSplitter

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

Definition#include <kpixmapsplitter.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods


Detailed Description

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 );

 KPixmapSplitter ()

KPixmapSplitter

Constructor, does nothing but initializing some default-values.

 ~KPixmapSplitter ()

~KPixmapSplitter

void  setPixmap ( const QPixmap& pixmap )

setPixmap

Sets the pixmap to be splitted.

const QPixmap&  pixmap ()

pixmap

[const]

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

void  setItemSize ( const QSize& size )

setItemSize

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.

QSize  itemSize ()

itemSize

[const]

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

void  setVSpacing ( int spacing )

setVSpacing

If there is space between rows in the given pixmap, you have to specify how many pixels there are.

void  setHSpacing ( int spacing )

setHSpacing

If there is space between columns in the given pixmap, you have to specify how many pixels there are.

QRect  coordinates ( int pos )

coordinates

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

QRect  coordinates ( const QChar& ch )

coordinates

Overloaded for convenience. Returns the item at the position of the given character (when using a latin1 font-pixmap)