org.kde.koala
Class KPixmapSplitter

java.lang.Object
  extended by org.kde.koala.KPixmapSplitter
All Implemented Interfaces:
org.kde.qt.QtSupport

public class KPixmapSplitter
extends java.lang.Object
implements org.kde.qt.QtSupport

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

Constructor Summary
  KPixmapSplitter()
          Constructor, does nothing but initialize some default-values.
protected KPixmapSplitter(java.lang.Class dummy)
           
 
Method Summary
 org.kde.qt.QRect coordinates(char ch)
          Overloaded for convenience.
 org.kde.qt.QRect coordinates(int pos)
           
 void dispose()
          Delete the wrapped C++ instance ahead of finalize()
protected  void finalize()
          Deletes the wrapped C++ instance
 boolean isDisposed()
          Has the wrapped C++ instance been deleted?
 org.kde.qt.QSize itemSize()
           
 org.kde.qt.QPixmap pixmap()
           
 void setHSpacing(int spacing)
          If there is space between columns in the given pixmap, you have to specify how many pixels there are.
 void setItemSize(org.kde.qt.QSize size)
          Sets the size of the items you want to get out of the given pixmap.
 void setPixmap(org.kde.qt.QPixmap pixmap)
          Sets the pixmap to be split.
 void setVSpacing(int spacing)
          If there is space between rows in the given pixmap, you have to specify how many pixels there are.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KPixmapSplitter

protected KPixmapSplitter(java.lang.Class dummy)

KPixmapSplitter

public KPixmapSplitter()
Constructor, does nothing but initialize some default-values.

Method Detail

setPixmap

public void setPixmap(org.kde.qt.QPixmap pixmap)
Sets the pixmap to be split.


pixmap

public org.kde.qt.QPixmap pixmap()
Returns:
the pixmap that has been set via setPixmap().

setItemSize

public void setItemSize(org.kde.qt.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.


itemSize

public org.kde.qt.QSize itemSize()
Returns:
the set size of the items (coordinates) you want to get out of the given pixmap.

setVSpacing

public void setVSpacing(int spacing)
If there is space between rows in the given pixmap, you have to specify how many pixels there are.


setHSpacing

public void setHSpacing(int spacing)
If there is space between columns in the given pixmap, you have to specify how many pixels there are.


coordinates

public org.kde.qt.QRect coordinates(int pos)
Returns:
the coordinates of the item at position pos in the given pixmap.

coordinates

public org.kde.qt.QRect coordinates(char ch)
Overloaded for convenience. Returns the item at the position of the given character (when using a latin1 font-pixmap)


finalize

protected void finalize()
                 throws java.lang.InternalError
Deletes the wrapped C++ instance

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.InternalError

dispose

public void dispose()
Delete the wrapped C++ instance ahead of finalize()


isDisposed

public boolean isDisposed()
Has the wrapped C++ instance been deleted?