class KPixmapSplitter

If you have a pixmap containing several items (icons), you can use this class to get the coordinates of each item. 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 );

 @short A class to split a pixmap into several items.
 @author Carsten Pfeiffer <pfeiffer@kde.org>
 

 KPixmapSplitter ()

Constructor, does nothing but initializing some default-values.

 ~KPixmapSplitter ()

void  setPixmap ( const QPixmap& pixmap )

Set the pixmap to be splitted.

const QPixmap&  pixmap ()

[const]

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

void  setItemSize ( const QSize& size )

Set the size of the items you want to get out of the given pixmap. The QRect of coordinate will have the width and height of exactly this size.

QSize  itemSize ()

[const]

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

void  setVSpacing ( int spacing )

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

void  setHSpacing ( int spacing )

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

QRect  coordinates ( int pos )

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

QRect  coordinates ( const QChar& ch )

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


Generated by: marc@yogi on Tue Mar 27 13:06:25 2001, using kdoc 2.0a48.