#include <BitmapFactory.h>
Public Types | |
enum | Position { TopLeft, TopRight, BottomLeft, BottomRight } |
Public Member Functions | |
void | addCustomPath (const QString &) |
void | addPath (const QString &path) |
Adds a path where pixmaps can be found. | |
void | addPixmapToCache (const char *name, const QPixmap &icon) |
Adds a build in XPM pixmap under a given name. | |
void | addXPM (const char *name, const char **pXPM) |
Adds a build in XPM pixmap under a given name. | |
void | convert (const SoSFImage &img, QImage &out) const |
Converts a SoSFImage into a QImage. | |
void | convert (const QImage &img, SoSFImage &out) const |
Converts a QImage into a SoSFImage to use it inside a SoImage node. | |
QPixmap | disabled (const QPixmap &p) const |
Creates a disabled pixmap of the given pixmap p by changing the brightness of all opaque pixels to a higher value. | |
QPixmap | fillRect (int x, int y, int w, int h, const QPixmap &p, Qt::BGMode) const |
Creates an opaque or transparent area in a pixmap If the background mode is opaque then this method can be used for drawing a smaller pixmap into pixmap p. | |
QStringList | findIconFiles () const |
Returns the absolute file names of icons found in the given search paths. | |
bool | findPixmapInCache (const char *name, QPixmap &icon) const |
Checks whether the pixmap is already registered. | |
QPixmap | merge (const QPixmap &p1, const QPixmap &p2, Position pos=BitmapFactoryInst::BottomLeft) const |
Merges the two pixmaps p1 and p2 to one pixmap. | |
QPixmap | merge (const QPixmap &p1, const QPixmap &p2, bool vertical) const |
Merges the two pixmaps p1 and p2 to one pixmap in vertical order if vertical is true, in horizontal order otherwise. | |
QPixmap | pixmap (const char *name) const |
Retrieves a pixmap by name. | |
QPixmap | pixmapFromSvg (const QByteArray &contents, const QSize &size) const |
This method is provided for convenience and does the same as the method above except that it creates the pixmap from a byte array. | |
QPixmap | pixmapFromSvg (const char *name, const QSize &size) const |
Retrieves a pixmap by name and size created by an scalable vector graphics (SVG). | |
QStringList | pixmapNames () const |
Returns the names of all registered pixmaps. | |
void | removePath (const QString &path) |
Removes a path from the list of pixmap paths. | |
QPixmap | resize (int w, int h, const QPixmap &p, Qt::BGMode bgmode) const |
Resizes the area of a pixmap If the new size is greater than the old one the pixmap will be placed in the center. | |
Static Public Member Functions | |
static void | destruct (void) |
static BitmapFactoryInst & | instance (void) |
Definition at line 43 of file BitmapFactory.h.
TopLeft |
Place to the top left corner. |
TopRight |
Place to the top right corner. |
BottomLeft |
Place to the bottom left corner. |
BottomRight |
Place to the bottom right corner. |
Definition at line 46 of file BitmapFactory.h.
void BitmapFactoryInst::addCustomPath | ( | const QString & | path | ) |
Definition at line 109 of file BitmapFactory.cpp.
References App::GetApplication(), App::Application::GetParameterGroupByPath(), and group.
void BitmapFactoryInst::addPath | ( | const QString & | path | ) |
Adds a path where pixmaps can be found.
Definition at line 129 of file BitmapFactory.cpp.
References Gui::BitmapFactoryInstP::paths.
Referenced by instance(), Gui::Application::sAddIconPath(), and Gui::Application::sAddResPath().
void BitmapFactoryInst::addPixmapToCache | ( | const char * | name, | |
const QPixmap & | icon | |||
) |
Adds a build in XPM pixmap under a given name.
Definition at line 167 of file BitmapFactory.cpp.
References Gui::BitmapFactoryInstP::xpmCache.
Referenced by Gui::Application::sAddIcon(), and Gui::Application::workbenchIcon().
void BitmapFactoryInst::addXPM | ( | const char * | name, | |
const char ** | pXPM | |||
) |
Adds a build in XPM pixmap under a given name.
Definition at line 162 of file BitmapFactory.cpp.
References Gui::BitmapFactoryInstP::xpmMap.
Referenced by initPartGui(), and RegisterIcons().
void BitmapFactoryInst::convert | ( | const SoSFImage & | img, | |
QImage & | out | |||
) | const |
Converts a SoSFImage into a QImage.
Definition at line 558 of file BitmapFactory.cpp.
References Py::int, MovieTool::x, and MovieTool::y.
void BitmapFactoryInst::convert | ( | const QImage & | img, | |
SoSFImage & | out | |||
) | const |
Converts a QImage into a SoSFImage to use it inside a SoImage node.
Definition at line 504 of file BitmapFactory.cpp.
References Py::int, MovieTool::x, and MovieTool::y.
Referenced by Gui::ViewProviderAnnotationLabel::drawImage(), ImageGui::ViewProviderImagePlane::updateData(), and Gui::SoFCOffscreenRenderer::writeToImage().
void BitmapFactoryInst::destruct | ( | void | ) | [static] |
Definition at line 91 of file BitmapFactory.cpp.
Referenced by Gui::Application::~Application().
QPixmap BitmapFactoryInst::disabled | ( | const QPixmap & | p | ) | const |
Creates a disabled pixmap of the given pixmap p by changing the brightness of all opaque pixels to a higher value.
Definition at line 497 of file BitmapFactory.cpp.
QPixmap BitmapFactoryInst::fillRect | ( | int | x, | |
int | y, | |||
int | w, | |||
int | h, | |||
const QPixmap & | p, | |||
Qt::BGMode | bgmode | |||
) | const |
Creates an opaque or transparent area in a pixmap If the background mode is opaque then this method can be used for drawing a smaller pixmap into pixmap p.
Note: To draw a smaller pixmap into another one the area in the resulting pixmap for the small pixmapmust be opaque in every pixel, otherwise the drawing may fail.
If the background mode is transparent then this method can be used for resizing the pixmap p and make the new space transparent.
Definition at line 402 of file BitmapFactory.cpp.
References FemExample::b.
QStringList BitmapFactoryInst::findIconFiles | ( | ) | const |
Returns the absolute file names of icons found in the given search paths.
Definition at line 140 of file BitmapFactory.cpp.
References Gui::BitmapFactoryInstP::paths.
Referenced by Gui::Dialog::IconDialog::IconDialog().
bool BitmapFactoryInst::findPixmapInCache | ( | const char * | name, | |
QPixmap & | icon | |||
) | const |
Checks whether the pixmap is already registered.
Definition at line 172 of file BitmapFactory.cpp.
References Gui::BitmapFactoryInstP::xpmCache.
BitmapFactoryInst & BitmapFactoryInst::instance | ( | void | ) | [static] |
Definition at line 75 of file BitmapFactory.cpp.
References addPath(), App::GetApplication(), and RegisterIcons().
Referenced by Gui::BitmapFactory().
QPixmap BitmapFactoryInst::merge | ( | const QPixmap & | p1, | |
const QPixmap & | p2, | |||
Position | pos = BitmapFactoryInst::BottomLeft | |||
) | const |
Merges the two pixmaps p1 and p2 to one pixmap.
The position of the smaller pimxap p2 is drawn into the given position pos of the bigger pixmap p1. This method does not resize the resulting pixmap.
Definition at line 463 of file BitmapFactory.cpp.
References fillRect(), draftTools::p, MovieTool::x, and MovieTool::y.
QPixmap BitmapFactoryInst::merge | ( | const QPixmap & | p1, | |
const QPixmap & | p2, | |||
bool | vertical | |||
) | const |
Merges the two pixmaps p1 and p2 to one pixmap in vertical order if vertical is true, in horizontal order otherwise.
The method resizes the resulting pixmap.
Definition at line 424 of file BitmapFactory.cpp.
References MovieTool::x, and MovieTool::y.
Referenced by Gui::Thumbnail::SaveDocFile(), and Gui::CallTipsList::showTips().
QPixmap BitmapFactoryInst::pixmap | ( | const char * | name | ) | const |
Retrieves a pixmap by name.
Definition at line 182 of file BitmapFactory.cpp.
References Base::Console(), Gui::BitmapFactoryInstP::paths, pixmapFromSvg(), px, Gui::BitmapFactoryInstP::xpmCache, and Gui::BitmapFactoryInstP::xpmMap.
Referenced by Gui::PythonCommand::createAction(), Gui::Dialog::CommandModel::data(), Gui::ViewProvider::getIcon(), Gui::Dialog::DlgCustomActionsImp::on_actionListWidget_itemActivated(), Gui::Dialog::DlgCustomActionsImp::on_buttonReplaceAction_clicked(), Gui::Thumbnail::SaveDocFile(), Gui::CallTipsList::showTips(), Gui::MainWindow::splashImage(), Gui::TaskView::TaskWatcherPython::TaskWatcherPython(), and Gui::Application::workbenchIcon().
QPixmap BitmapFactoryInst::pixmapFromSvg | ( | const QByteArray & | contents, | |
const QSize & | size | |||
) | const |
This method is provided for convenience and does the same as the method above except that it creates the pixmap from a byte array.
Definition at line 280 of file BitmapFactory.cpp.
References MovieTool::Background, Base::Console(), Base::ConsoleSingleton::MsgType_Wrn, draftTools::p, and RobotExample::w.
QPixmap BitmapFactoryInst::pixmapFromSvg | ( | const char * | name, | |
const QSize & | size | |||
) | const |
Retrieves a pixmap by name and size created by an scalable vector graphics (SVG).
Definition at line 242 of file BitmapFactory.cpp.
References DrawingExample::file, and Gui::BitmapFactoryInstP::paths.
Referenced by pixmap().
QStringList BitmapFactoryInst::pixmapNames | ( | ) | const |
Returns the names of all registered pixmaps.
To get the appropriate pixmaps call pixmap() for each name.
Definition at line 329 of file BitmapFactory.cpp.
References Gui::BitmapFactoryInstP::xpmCache, and Gui::BitmapFactoryInstP::xpmMap.
void BitmapFactoryInst::removePath | ( | const QString & | path | ) |
Removes a path from the list of pixmap paths.
Definition at line 134 of file BitmapFactory.cpp.
References Gui::BitmapFactoryInstP::paths, and RobotExample::pos.
QPixmap BitmapFactoryInst::resize | ( | int | w, | |
int | h, | |||
const QPixmap & | p, | |||
Qt::BGMode | bgmode | |||
) | const |
Resizes the area of a pixmap If the new size is greater than the old one the pixmap will be placed in the center.
The border area will be made depending on bgmode transparent or opaque.
Definition at line 342 of file BitmapFactory.cpp.
References fillRect(), MovieTool::x, and MovieTool::y.