#include <BitmapFactory.h>
Public Types | |
enum | Position { TopLeft , TopRight , BottomLeft , BottomRight } |
Public Member Functions | |
void | addPath (const QString &path) |
Adds a path where pixmaps can be found. More... | |
void | addPixmapToCache (const char *name, const QPixmap &icon) |
Adds a build in XPM pixmap under a given name. More... | |
void | addXPM (const char *name, const char **pXPM) |
Adds a build in XPM pixmap under a given name. More... | |
void | convert (const QImage &img, SoSFImage &out) const |
Converts a QImage into a SoSFImage to use it inside a SoImage node. More... | |
void | convert (const SoSFImage &img, QImage &out) const |
Converts a SoSFImage into a QImage. More... | |
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. More... | |
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. More... | |
QStringList | findIconFiles () const |
Returns the absolute file names of icons found in the given search paths. More... | |
bool | findPixmapInCache (const char *name, QPixmap &icon) const |
Checks whether the pixmap is already registered. More... | |
QStringList | getPaths () const |
Returns the list of search paths. More... | |
QIcon | iconFromTheme (const char *name, const QIcon &fallback=QIcon()) |
Returns the QIcon corresponding to name in the current icon theme. More... | |
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. More... | |
QPixmap | merge (const QPixmap &p1, const QPixmap &p2, Position pos=BitmapFactoryInst::BottomLeft) const |
Merges the two pixmaps p1 and p2 to one pixmap. More... | |
QPixmap | pixmap (const char *name) const |
Retrieves a pixmap by name. More... | |
QPixmap | pixmapFromSvg (const char *name, const QSizeF &size, const std::map< unsigned long, unsigned long > &colorMapping=std::map< unsigned long, unsigned long >()) const |
Retrieves a pixmap by name and size created by an scalable vector graphics (SVG). More... | |
QPixmap | pixmapFromSvg (const QByteArray &contents, const QSizeF &size, const std::map< unsigned long, unsigned long > &colorMapping=std::map< unsigned long, unsigned long >()) 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. More... | |
QStringList | pixmapNames () const |
Returns the names of all registered pixmaps. More... | |
void | removePath (const QString &path) |
Removes a path from the list of pixmap paths. More... | |
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. More... | |
Public Member Functions inherited from Base::Factory | |
void | AddProducer (const char *sClassName, AbstractProducer *pcProducer) |
Adds a new prducer instance. More... | |
std::list< std::string > | CanProduce () const |
returns a list of all registered producer More... | |
bool | CanProduce (const char *sClassName) const |
returns true if there is a producer for this class registered More... | |
Static Public Member Functions | |
static void | destruct (void) |
static BitmapFactoryInst & | instance (void) |
static QIcon | mergePixmap (const QIcon &base, const QPixmap &px, Gui::BitmapFactoryInst::Position position) |
Helper method to merge a pixmap into one corner of a QIcon. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Base::Factory | |
Factory () | |
construction More... | |
void * | Produce (const char *sClassName) const |
produce a class with the given name More... | |
virtual | ~Factory () |
destruction More... | |
void BitmapFactoryInst::addPath | ( | const QString & | path | ) |
Adds a path where pixmaps can be found.
Referenced by 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.
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.
References Gui::BitmapFactoryInstP::xpmMap.
void BitmapFactoryInst::convert | ( | const QImage & | img, |
SoSFImage & | out | ||
) | const |
Converts a QImage into a SoSFImage to use it inside a SoImage node.
Referenced by Gui::ViewProviderAnnotationLabel::drawImage(), Gui::AlignmentView::setupHeadUpDisplay(), ImageGui::ViewProviderImagePlane::updateData(), and Gui::SoFCOffscreenRenderer::writeToImage().
void BitmapFactoryInst::convert | ( | const SoSFImage & | img, |
QImage & | out | ||
) | const |
Converts a SoSFImage into a QImage.
|
static |
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.
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.
QStringList BitmapFactoryInst::findIconFiles | ( | ) | const |
Returns the absolute file names of icons found in the given search paths.
Referenced by Gui::Dialog::IconDialog::IconDialog().
bool BitmapFactoryInst::findPixmapInCache | ( | const char * | name, |
QPixmap & | icon | ||
) | const |
Checks whether the pixmap is already registered.
References Gui::BitmapFactoryInstP::xpmCache.
QStringList BitmapFactoryInst::getPaths | ( | ) | const |
Returns the list of search paths.
QIcon BitmapFactoryInst::iconFromTheme | ( | const char * | name, |
const QIcon & | fallback = QIcon() |
||
) |
Returns the QIcon corresponding to name in the current icon theme.
If no such icon is found in the current theme fallback is returned instead.
References pixmap().
Referenced by PartGui::ViewProviderBoolean::getIcon(), PartGui::ViewProviderMultiFuse::getIcon(), PartGui::ViewProviderMultiCommon::getIcon(), and Gui::PythonGroupCommand::languageChange().
|
static |
References App::Application::Config(), App::GetApplication(), App::Application::getHomePath(), and App::Application::getUserAppDataDir().
Referenced by Gui::BitmapFactory().
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.
Referenced by mergePixmap(), Gui::Thumbnail::SaveDocFile(), Gui::CallTipsList::showTips(), and Gui::DocumentObjectItem::testStatus().
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 pixmap p2 is drawn into the given position pos of the bigger pixmap p1. This method does not resize the resulting pixmap.
References BottomLeft, BottomRight, fillRect(), TopLeft, and TopRight.
|
static |
Helper method to merge a pixmap into one corner of a QIcon.
References Gui::BitmapFactory(), and merge().
Referenced by PartGui::ViewProviderAttachExtension::extensionMergeColorfullOverlayIcons(), PartDesignGui::ViewProvider::mergeColorfulOverlayIcons(), and SketcherGui::ViewProviderSketch::mergeColorfulOverlayIcons().
QPixmap BitmapFactoryInst::pixmap | ( | const char * | name | ) | const |
Retrieves a pixmap by name.
References Base::Console(), Base::ConsoleSingleton::Warning(), Gui::BitmapFactoryInstP::xpmCache, and Gui::BitmapFactoryInstP::xpmMap.
Referenced by Gui::MainWindow::aboutImage(), StdViewScreenShot::activated(), Gui::ElementColors::Private::addItem(), SurfaceGui::GeomFillSurface::flipOrientation(), MeshGui::ViewProviderMesh::getIcon(), MeshGui::ViewProviderMeshCurvature::getIcon(), PartGui::ViewProviderSpline::getIcon(), PathGui::ViewProviderPath::getIcon(), PathGui::ViewProviderPathCompound::getIcon(), PathGui::ViewProviderPathShape::getIcon(), SurfaceGui::ViewProviderFilling::getIcon(), SurfaceGui::ViewProviderGeomFillSurface::getIcon(), SurfaceGui::ViewProviderSections::getIcon(), SurfaceGui::ViewProviderExtend::getIcon(), Gui::ViewProviderLink::getIcon(), femcommands.manager.CommandManager::GetResources(), iconFromTheme(), Gui::Dialog::DlgCustomActionsImp::on_actionListWidget_itemActivated(), Gui::Dialog::DlgCustomActionsImp::on_buttonReplaceAction_clicked(), Gui::Thumbnail::SaveDocFile(), SurfaceGui::GeomFillSurface::setEditedObject(), Gui::Application::sGetIcon(), Gui::DockWnd::ComboView::showDialog(), Gui::CallTipsList::showTips(), Gui::MainWindow::splashImage(), Gui::TaskView::TaskWatcherPython::TaskWatcherPython(), and Gui::Application::workbenchIcon().
QPixmap BitmapFactoryInst::pixmapFromSvg | ( | const char * | name, |
const QSizeF & | size, | ||
const std::map< unsigned long, unsigned long > & | colorMapping = std::map<unsigned long, unsigned long>() |
||
) | const |
Retrieves a pixmap by name and size created by an scalable vector graphics (SVG).
colorMapping | - a dictionary of substitute colors. Can be used to customize icon color scheme, e.g. crosshair color |
References pixmapFromSvg().
Referenced by Gui::ExpressionBinding::getIcon(), ExpressionDelegate::getIcon(), Gui::ViewProviderLink::getOverlayPixmap(), pixmapFromSvg(), TechDrawGui::QGVPage::prepareCursorPixmap(), and SketcherGui::DrawSketchHandler::suggestedConstraintsPixmaps().
QPixmap BitmapFactoryInst::pixmapFromSvg | ( | const QByteArray & | contents, |
const QSizeF & | size, | ||
const std::map< unsigned long, unsigned long > & | colorMapping = std::map<unsigned long, unsigned long>() |
||
) | 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.
colorMapping | - see above. |
References Base::ConsoleSingleton::MsgType_Wrn.
QStringList BitmapFactoryInst::pixmapNames | ( | ) | const |
Returns the names of all registered pixmaps.
To get the appropriate pixmaps call pixmap() for each name.
References Gui::BitmapFactoryInstP::xpmCache, and Gui::BitmapFactoryInstP::xpmMap.
void BitmapFactoryInst::removePath | ( | const QString & | path | ) |
Removes a path from the list of pixmap paths.
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.
References fillRect().