• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

libkdegames

  • sources
  • kde-4.14
  • kdegames
  • libkdegames
colorproxy_p.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright 2010 Stefan Majewsky <majewsky@gmx.net> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU Library General Public License *
6  * version 2 as published by the Free Software Foundation *
7  * *
8  * This program is distributed in the hope that it will be useful, *
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
11  * GNU Library General Public License for more details. *
12  * *
13  * You should have received a copy of the GNU Library General Public *
14  * License along with this program; if not, write to the *
15  * Free Software Foundation, Inc., *
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
17  ***************************************************************************/
18 
19 #ifndef LIBKDEGAMES_COLORPROXY_P_H
20 #define LIBKDEGAMES_COLORPROXY_P_H
21 
22 #include <QtCore/QHash>
23 #include <QtGui/QPaintDevice>
24 #include <QtGui/QPaintEngine>
25 
26 class QPaintEngineColorProxy;
27 
28 #ifndef KDEGAMES_QCOLOR_QHASH
29 # define KDEGAMES_QCOLOR_QHASH
30  inline uint qHash(const QColor& color)
31  {
32  return color.rgba();
33  }
34 #endif // KDEGAMES_QCOLOR_QHASH
35 
46 class QPaintDeviceColorProxy : public QPaintDevice
47 {
48  public:
51  QPaintDeviceColorProxy(QPaintDevice* proxiedDevice, const QHash<QColor, QColor>& replacements);
52  ~QPaintDeviceColorProxy();
53 
54  QPaintDevice* proxiedDevice() const;
55  virtual QPaintEngine* paintEngine() const;
56 
57  QBrush map(const QBrush& brush) const;
58  inline QColor map(const QColor& color) const;
59  QPen map(const QPen& pen) const;
60  protected:
61  virtual int metric(PaintDeviceMetric metric) const;
62  private:
63  QPaintDevice* m_proxiedDevice;
64  QPaintEngine* m_engine;
65  QHash<QColor, QColor> m_replacements;
66 };
67 
68 class QPaintEngineColorProxy : public QPaintEngine
69 {
70  public:
71  QPaintEngineColorProxy();
72  ~QPaintEngineColorProxy();
73 
74  virtual bool begin(QPaintDevice* device);
75  virtual bool end();
76  virtual void drawEllipse(const QRectF& rect);
77  virtual void drawEllipse(const QRect& rect);
78  virtual void drawImage(const QRectF& rectangle, const QImage& image, const QRectF& sr, Qt::ImageConversionFlags flags = Qt::AutoColor);
79  virtual void drawLines(const QLineF* lines, int lineCount);
80  virtual void drawLines(const QLine* lines, int lineCount);
81  virtual void drawPath(const QPainterPath& path);
82  virtual void drawPixmap(const QRectF& r, const QPixmap& pm, const QRectF& sr);
83  virtual void drawPoints(const QPointF* points, int pointCount);
84  virtual void drawPoints(const QPoint* points, int pointCount);
85  virtual void drawPolygon(const QPointF* points, int pointCount, PolygonDrawMode mode);
86  virtual void drawPolygon(const QPoint* points, int pointCount, PolygonDrawMode mode);
87  virtual void drawRects(const QRectF* rects, int rectCount);
88  virtual void drawRects(const QRect* rects, int rectCount);
89  virtual void drawTextItem(const QPointF& p, const QTextItem& textItem);
90  virtual void drawTiledPixmap(const QRectF& rect, const QPixmap& pixmap, const QPointF& p);
91  virtual Type type() const;
92  virtual void updateState(const QPaintEngineState& state);
93  private:
94  QPaintDeviceColorProxy* m_proxy;
95  QPainter* m_painter;
96 };
97 
98 #endif // LIBKDEGAMES_COLORPROXY_P_H
QPaintDeviceColorProxy
This QPaintDevice forwards all painting operations performed on it to the contained QPaintDevice...
Definition: colorproxy_p.h:46
QPaintEngineColorProxy::drawTextItem
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem)
QPaintEngineColorProxy::end
virtual bool end()
QPaintEngine
QPaintDeviceColorProxy::QPaintDeviceColorProxy
QPaintDeviceColorProxy(QPaintDevice *proxiedDevice, const QHash< QColor, QColor > &replacements)
QLine
QPaintDeviceColorProxy::map
QBrush map(const QBrush &brush) const
QPaintDeviceColorProxy::proxiedDevice
QPaintDevice * proxiedDevice() const
QPaintDeviceColorProxy::~QPaintDeviceColorProxy
~QPaintDeviceColorProxy()
QPaintDevice
QBrush
QPoint
QPaintEngineColorProxy::begin
virtual bool begin(QPaintDevice *device)
QPaintEngineColorProxy::drawRects
virtual void drawRects(const QRectF *rects, int rectCount)
QPaintEngineColorProxy::drawEllipse
virtual void drawEllipse(const QRectF &rect)
QPaintEngineColorProxy::QPaintEngineColorProxy
QPaintEngineColorProxy()
QPointF
QTextItem
QPaintEngineColorProxy::type
virtual Type type() const
QRect
QPaintEngineColorProxy::drawPoints
virtual void drawPoints(const QPointF *points, int pointCount)
QHash< QColor, QColor >
QPaintDeviceColorProxy::paintEngine
virtual QPaintEngine * paintEngine() const
QPainter
QPaintEngineColorProxy
Definition: colorproxy_p.h:68
QPaintEngineColorProxy::~QPaintEngineColorProxy
~QPaintEngineColorProxy()
QPaintEngineColorProxy::drawPolygon
virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
QColor
QLineF
qHash
uint qHash(const QColor &color)
Definition: colorproxy_p.h:30
QPixmap
Qt::ImageConversionFlags
typedef ImageConversionFlags
QPaintEngineState
QImage
QPainterPath
QPaintEngineColorProxy::drawTiledPixmap
virtual void drawTiledPixmap(const QRectF &rect, const QPixmap &pixmap, const QPointF &p)
QRectF
QPaintEngineColorProxy::drawLines
virtual void drawLines(const QLineF *lines, int lineCount)
QPen
QPaintEngineColorProxy::drawPath
virtual void drawPath(const QPainterPath &path)
QPaintDeviceColorProxy::metric
virtual int metric(PaintDeviceMetric metric) const
QPaintEngineColorProxy::drawPixmap
virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
QPaintEngineColorProxy::updateState
virtual void updateState(const QPaintEngineState &state)
QPaintEngineColorProxy::drawImage
virtual void drawImage(const QRectF &rectangle, const QImage &image, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor)
QColor::rgba
QRgb rgba() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:42 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkdegames

Skip menu "libkdegames"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal