MythTV  master
mythpainter.cpp
Go to the documentation of this file.
1 #include <algorithm>
2 #include <complex>
3 #include <cstdint>
4 
5 // QT headers
6 #include <QRect>
7 #include <QPainter>
8 #include <QPainterPath>
9 
10 // libmythbase headers
11 #include "libmythbase/compat.h"
14 
15 // libmythui headers
16 #include "mythfontproperties.h"
17 #include "mythimage.h"
18 #include "mythuianimation.h" // UIEffects
19 
20 // Own header
21 #include "mythpainter.h"
22 
24 {
25  SetMaximumCacheSizes(64, 48);
26 }
27 
29 {
30  ExpireImages(0);
31 
32  QMutexLocker locker(&m_allocationLock);
33 
34  if (!m_allocatedImages.isEmpty())
35  {
36  LOG(VB_GENERAL, LOG_WARNING,
37  QString("MythPainter: %1 images not yet de-allocated.")
38  .arg(m_allocatedImages.size()));
39  }
40 
41  for (auto *image : std::as_const(m_allocatedImages))
42  image->SetParent(nullptr);
43  m_allocatedImages.clear();
44 }
45 
46 void MythPainter::SetClipRect(const QRect /*clipRect*/)
47 {
48 }
49 
50 void MythPainter::SetClipRegion(const QRegion & /*clipRegion*/)
51 {
52 }
53 
54 void MythPainter::Clear(QPaintDevice */*device*/, const QRegion &/*region*/)
55 {
56 }
57 
58 void MythPainter::DrawImage(int x, int y, MythImage *im, int alpha)
59 {
60  if (!im)
61  {
62  LOG(VB_GENERAL, LOG_ERR,
63  "Null image pointer passed to MythPainter::DrawImage()");
64  return;
65  }
66  QRect dest = QRect(x, y, im->width(), im->height());
67  QRect src = im->rect();
68  DrawImage(dest, im, src, alpha);
69 }
70 
71 void MythPainter::DrawImage(const QPoint topLeft, MythImage *im, int alpha)
72 {
73  DrawImage(topLeft.x(), topLeft.y(), im, alpha);
74 }
75 
76 void MythPainter::DrawText(const QRect r, const QString &msg,
77  int flags, const MythFontProperties &font,
78  int alpha, const QRect boundRect)
79 {
80  MythImage *im = GetImageFromString(msg, flags, r, font);
81  if (!im)
82  return;
83 
84  QRect destRect(boundRect);
85  QRect srcRect(0,0,r.width(),r.height());
86  if (!boundRect.isEmpty() && boundRect != r)
87  {
88  int x = 0;
89  int y = 0;
90  int width = boundRect.width();
91  int height = boundRect.height();
92 
93  if (boundRect.x() > r.x())
94  {
95  x = boundRect.x()-r.x();
96  }
97  else if (r.x() > boundRect.x())
98  {
99  destRect.setX(r.x());
100  width = (boundRect.x() + boundRect.width()) - r.x();
101  }
102 
103  if (boundRect.y() > r.y())
104  {
105  y = boundRect.y()-r.y();
106  }
107  else if (r.y() > boundRect.y())
108  {
109  destRect.setY(r.y());
110  height = (boundRect.y() + boundRect.height()) - r.y();
111  }
112 
113  if (width <= 0 || height <= 0)
114  return;
115 
116  srcRect.setRect(x,y,width,height);
117  }
118 
119  DrawImage(destRect, im, srcRect, alpha);
120  im->DecrRef();
121 }
122 
123 void MythPainter::DrawTextLayout(const QRect canvasRect,
124  const LayoutVector & layouts,
125  const FormatVector & formats,
126  const MythFontProperties & font, int alpha,
127  const QRect destRect)
128 {
129  if (canvasRect.isNull())
130  return;
131 
132  QRect canvas(canvasRect);
133  QRect dest(destRect);
134 
135  MythImage *im = GetImageFromTextLayout(layouts, formats, font,
136  canvas, dest);
137  if (!im)
138  {
139  LOG(VB_GENERAL, LOG_ERR, QString("MythPainter::DrawTextLayout: "
140  "Unable to create image."));
141  return;
142  }
143  if (im->isNull())
144  {
145  LOG(VB_GENERAL, LOG_DEBUG, QString("MythPainter::DrawTextLayout: "
146  "Rendered image is null."));
147  im->DecrRef();
148  return;
149  }
150 
151  QRect srcRect(0, 0, dest.width(), dest.height());
152  DrawImage(dest, im, srcRect, alpha);
153 
154  im->DecrRef();
155 }
156 
157 void MythPainter::DrawRect(const QRect area, const QBrush &fillBrush,
158  const QPen &linePen, int alpha)
159 {
160  MythImage *im = GetImageFromRect(area, 0, 0, fillBrush, linePen);
161  if (im)
162  {
163  DrawImage(area.x(), area.y(), im, alpha);
164  im->DecrRef();
165  }
166 }
167 
168 void MythPainter::DrawRoundRect(const QRect area, int cornerRadius,
169  const QBrush &fillBrush, const QPen &linePen,
170  int alpha)
171 {
172  MythImage *im = GetImageFromRect(area, cornerRadius, 0, fillBrush, linePen);
173  if (im)
174  {
175  DrawImage(area.x(), area.y(), im, alpha);
176  im->DecrRef();
177  }
178 }
179 
180 void MythPainter::DrawEllipse(const QRect area, const QBrush &fillBrush,
181  const QPen &linePen, int alpha)
182 {
183  MythImage *im = GetImageFromRect(area, 0, 1, fillBrush, linePen);
184  if (im)
185  {
186  DrawImage(area.x(), area.y(), im, alpha);
187  im->DecrRef();
188  }
189 }
190 
191 void MythPainter::DrawTextPriv(MythImage *im, const QString &msg, int flags,
192  const QRect r, const MythFontProperties &font)
193 {
194  if (!im)
195  return;
196 
197  QColor outlineColor;
198  int outlineSize = 0;
199  int outlineAlpha = 255;
200  if (font.hasOutline())
201  font.GetOutline(outlineColor, outlineSize, outlineAlpha);
202 
203  QPoint shadowOffset(0, 0);
204  QColor shadowColor;
205  int shadowAlpha = 255;
206  if (font.hasShadow())
207  font.GetShadow(shadowOffset, shadowColor, shadowAlpha);
208 
209  QFontMetrics fm(font.face());
210  int totalHeight = fm.height() + outlineSize +
211  std::max(outlineSize, std::abs(shadowOffset.y()));
212 
213  // initialPaddingX is the number of pixels from the left of the
214  // input QRect to the left of the actual text. It is always 0
215  // because we don't add padding to the text rectangle.
216  int initialPaddingX = 0;
217 
218  // initialPaddingY is the number of pixels from the top of the
219  // input QRect to the top of the actual text. It may be nonzero
220  // because of extra vertical padding.
221  int initialPaddingY = (r.height() - totalHeight) / 2;
222  // Hack. Normally we vertically center the text due to some
223  // (solvable) issues in the SubtitleScreen code - the text rect
224  // and the background rect are both created with PAD_WIDTH extra
225  // padding, and to honor Qt::AlignTop, the text rect needs to be
226  // without padding. This doesn't work for Qt::TextWordWrap, since
227  // the first line will be vertically centered with subsequence
228  // lines below. So if Qt::TextWordWrap is set, we do top
229  // alignment.
230  if (flags & Qt::TextWordWrap)
231  initialPaddingY = 0;
232 
233  // textOffsetX is the number of pixels from r.left() to the left
234  // edge of the core text. This assumes that flags contains
235  // Qt::AlignLeft.
236  int textOffsetX =
237  initialPaddingX + std::max(outlineSize, -shadowOffset.x());
238 
239  // textOffsetY is the number of pixels from r.top() to the top
240  // edge of the core text. This assumes that flags contains
241  // Qt::AlignTop.
242  int textOffsetY =
243  initialPaddingY + std::max(outlineSize, -shadowOffset.y());
244 
245  QImage pm(r.size(), QImage::Format_ARGB32);
246  QColor fillcolor = font.color();
247  if (font.hasOutline())
248  fillcolor = outlineColor;
249  fillcolor.setAlpha(0);
250  pm.fill(fillcolor.rgba());
251 
252  QPainter tmp(&pm);
253  QFont tmpfont = font.face();
254  tmp.setFont(tmpfont);
255 
256  QPainterPath path;
257  if (font.hasOutline())
258  path.addText(0, 0, tmpfont, msg);
259 
260  if (font.hasShadow())
261  {
262  QRect a = QRect(0, 0, r.width(), r.height());
263  a.translate(shadowOffset.x() + textOffsetX,
264  shadowOffset.y() + textOffsetY);
265 
266  shadowColor.setAlpha(shadowAlpha);
267  tmp.setPen(shadowColor);
268  tmp.drawText(a, flags, msg);
269  }
270 
271  if (font.hasOutline())
272  {
273  // QPainter::drawText() treats the Y coordinate as the top of
274  // the text (when Qt::AlignTop is used). However,
275  // QPainterPath::addText() treats the Y coordinate as the base
276  // line of the text. To translate from the top to the base
277  // line, we need to add QFontMetrics::ascent().
278  int adjX = 0;
279  int adjY = fm.ascent();
280 
281  outlineColor.setAlpha(outlineAlpha);
282  tmp.setPen(outlineColor);
283 
284  path.translate(adjX + textOffsetX, adjY + textOffsetY);
285  QPen pen = tmp.pen();
286  pen.setWidth((outlineSize * 2) + 1);
287  pen.setCapStyle(Qt::RoundCap);
288  pen.setJoinStyle(Qt::RoundJoin);
289  tmp.setPen(pen);
290  tmp.drawPath(path);
291 
292  path.translate(outlineSize, outlineSize);
293  }
294 
295  tmp.setPen(QPen(font.GetBrush(), 0));
296  tmp.setBrush(font.GetBrush());
297  tmp.drawText(textOffsetX, textOffsetY, r.width(), r.height(),
298  flags, msg);
299  tmp.end();
300  im->Assign(pm);
301 }
302 
303 void MythPainter::DrawRectPriv(MythImage *im, const QRect area, int radius,
304  int ellipse,
305  const QBrush &fillBrush, const QPen &linePen)
306 {
307  if (!im)
308  return;
309 
310  QImage image(QSize(area.width(), area.height()), QImage::Format_ARGB32);
311  image.fill(0x00000000);
312  QPainter painter(&image);
313  painter.setRenderHint(QPainter::Antialiasing);
314  painter.setPen(linePen);
315  painter.setBrush(fillBrush);
316 
317  radius = std::min(area.width() / 2, radius);
318  radius = std::min(area.height() / 2, radius);
319 
320  int lineWidth = linePen.width();
321  QRect r(lineWidth, lineWidth,
322  area.width() - (lineWidth * 2), area.height() - (lineWidth * 2));
323 
324  if (ellipse)
325  painter.drawEllipse(r);
326  else if (radius == 0)
327  painter.drawRect(r);
328  else
329  painter.drawRoundedRect(r, (qreal)radius, qreal(radius));
330 
331  painter.end();
332  im->Assign(image);
333 }
334 
336  int flags, const QRect r,
337  const MythFontProperties &font)
338 {
339  QString incoming = font.GetHash() + QString::number(r.width()) +
340  QString::number(r.height()) +
341  QString::number(flags) +
342  QString::number(font.color().rgba()) + msg;
343 
344  MythImage *im = nullptr;
345  if (m_stringToImageMap.contains(incoming))
346  {
347  m_stringExpireList.remove(incoming);
348  m_stringExpireList.push_back(incoming);
349  im = m_stringToImageMap[incoming];
350  if (im)
351  im->IncrRef();
352  }
353  else
354  {
355  im = GetFormatImage();
356  im->SetFileName(QString("GetImageFromString: %1").arg(msg));
357  DrawTextPriv(im, msg, flags, r, font);
358 
359  im->IncrRef();
360  m_softwareCacheSize += im->GetSize();
361  m_stringToImageMap[incoming] = im;
362  m_stringExpireList.push_back(incoming);
364  }
365  return im;
366 }
367 
369  const FormatVector &formats,
370  const MythFontProperties &font,
371  QRect &canvas, QRect &dest)
372 {
373  QString incoming = QString::number(canvas.x()) +
374  QString::number(canvas.y()) +
375  QString::number(canvas.width()) +
376  QString::number(canvas.height()) +
377  QString::number(dest.width()) +
378  QString::number(dest.height()) +
379  font.GetHash();
380 
381  for (auto *layout : std::as_const(layouts))
382  incoming += layout->text();
383 
384  MythImage *im = nullptr;
385  if (m_stringToImageMap.contains(incoming))
386  {
387  m_stringExpireList.remove(incoming);
388  m_stringExpireList.push_back(incoming);
389  im = m_stringToImageMap[incoming];
390  if (im)
391  im->IncrRef();
392  }
393  else
394  {
395  im = GetFormatImage();
396  im->SetFileName("GetImageFromTextLayout");
397 
398  QImage pm(canvas.size(), QImage::Format_ARGB32_Premultiplied);
399  pm.fill(0);
400 
401  QPainter painter(&pm);
402  if (!painter.isActive())
403  {
404  LOG(VB_GENERAL, LOG_ERR, "MythPainter::GetImageFromTextLayout: "
405  "Invalid canvas.");
406  return im;
407  }
408 
409  QRect clip;
410  clip.setSize(canvas.size());
411 
412  QFont tmpfont = font.face();
413  painter.setFont(tmpfont);
414  painter.setRenderHint(QPainter::Antialiasing);
415 
416  if (font.hasShadow())
417  {
418  QRect shadowRect;
419  QPoint shadowOffset;
420  QColor shadowColor;
421  int shadowAlpha = 255;
422 
423  font.GetShadow(shadowOffset, shadowColor, shadowAlpha);
424  shadowColor.setAlpha(shadowAlpha);
425 
426  MythPoint shadow(shadowOffset);
427  shadow.NormPoint(); // scale it to screen resolution
428 
429  shadowRect = canvas;
430  shadowRect.translate(shadow.x(), shadow.y());
431 
432  painter.setPen(shadowColor);
433  for (auto *layout : std::as_const(layouts))
434  layout->draw(&painter, shadowRect.topLeft(), formats, clip);
435  }
436 
437  painter.setPen(QPen(font.GetBrush(), 0));
438  for (auto *layout : std::as_const(layouts))
439  {
440  layout->draw(&painter, canvas.topLeft(),
441  layout->formats(), clip);
442  }
443  painter.end();
444 
445  pm.setOffset(canvas.topLeft());
446  im->Assign(pm.copy(0, 0, dest.width(), dest.height()));
447 
448  im->IncrRef();
449  m_softwareCacheSize += im->GetSize();
450  m_stringToImageMap[incoming] = im;
451  m_stringExpireList.push_back(incoming);
453  }
454  return im;
455 }
456 
457 MythImage* MythPainter::GetImageFromRect(const QRect area, int radius,
458  int ellipse,
459  const QBrush &fillBrush,
460  const QPen &linePen)
461 {
462  if (area.width() <= 0 || area.height() <= 0)
463  return nullptr;
464 
465  uint64_t hash1 = ((0xfff & (uint64_t)area.width())) +
466  ((0xfff & (uint64_t)area.height()) << 12) +
467  ((0xff & (uint64_t)fillBrush.style()) << 24) +
468  ((0xff & (uint64_t)linePen.width()) << 32) +
469  ((0xff & (uint64_t)radius) << 40) +
470  ((0xff & (uint64_t)linePen.style()) << 48) +
471  ((0xff & (uint64_t)ellipse) << 56);
472  uint64_t hash2 = ((0xffffffff & (uint64_t)linePen.color().rgba())) +
473  ((0xffffffff & (uint64_t)fillBrush.color().rgba()) << 32);
474 
475  QString incoming("R");
476  if (fillBrush.style() == Qt::LinearGradientPattern && fillBrush.gradient())
477  {
478  // The Q*Gradient classes are not polymorohic, and therefore
479  // dynamic_cast can't be used here.
480  // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast)
481  const auto *gradient = static_cast<const QLinearGradient*>(fillBrush.gradient());
482  if (gradient)
483  {
484  incoming = QString::number(
485  ((0xfff & (uint64_t)gradient->start().x())) +
486  ((0xfff & (uint64_t)gradient->start().y()) << 12) +
487  ((0xfff & (uint64_t)gradient->finalStop().x()) << 24) +
488  ((0xfff & (uint64_t)gradient->finalStop().y()) << 36));
489  QGradientStops stops = gradient->stops();
490  for (const auto & stop : std::as_const(stops))
491  {
492  incoming += QString::number(
493  ((0xfff * (uint64_t)(stop.first * 100))) +
494  ((uint64_t)stop.second.rgba() << 12));
495  }
496  }
497  }
498 
499  incoming += QString::number(hash1) + QString::number(hash2);
500 
501  MythImage *im = nullptr;
502  if (m_stringToImageMap.contains(incoming))
503  {
504  m_stringExpireList.remove(incoming);
505  m_stringExpireList.push_back(incoming);
506  im = m_stringToImageMap[incoming];
507  if (im)
508  im->IncrRef();
509  }
510  else
511  {
512  im = GetFormatImage();
513  im->SetFileName("GetImageFromRect");
514  DrawRectPriv(im, area, radius, ellipse, fillBrush, linePen);
515 
516  im->IncrRef();
517  m_softwareCacheSize += im->GetSize();
518  m_stringToImageMap[incoming] = im;
519  m_stringExpireList.push_back(incoming);
521  }
522  return im;
523 }
524 
526 {
527  QMutexLocker locker(&m_allocationLock);
528  MythImage *result = GetFormatImagePriv();
529  result->SetFileName("GetFormatImage");
530  m_allocatedImages.insert(result);
531  return result;
532 }
533 
535 {
536  QMutexLocker locker(&m_allocationLock);
538  m_allocatedImages.remove(im);
539 }
540 
542 {
543  if (im && !im->GetParent())
544  {
545  QMutexLocker locker(&m_allocationLock);
546  m_allocatedImages.insert(im);
547  im->SetParent(this);
548  }
549 }
550 
551 void MythPainter::ExpireImages(int64_t max)
552 {
553  bool recompute = false;
554  while (!m_stringExpireList.empty())
555  {
556  if (m_softwareCacheSize < max)
557  break;
558 
559  QString oldmsg = m_stringExpireList.front();
560  m_stringExpireList.pop_front();
561 
562  QMap<QString, MythImage*>::iterator it =
563  m_stringToImageMap.find(oldmsg);
564  if (it == m_stringToImageMap.end())
565  {
566  recompute = true;
567  continue;
568  }
569  MythImage *oldim = *it;
570  it = m_stringToImageMap.erase(it);
571 
572  if (oldim)
573  {
574  m_softwareCacheSize -= oldim->GetSize();
575  if (m_softwareCacheSize < 0)
576  {
578  recompute = true;
579  }
580  oldim->DecrRef();
581  }
582  }
583  if (recompute)
584  {
586  for (auto *img : std::as_const(m_stringToImageMap))
587  m_softwareCacheSize += img->GetSize();
588  }
589 }
590 
591 // the following assume graphics hardware operates natively at 32bpp
592 void MythPainter::SetMaximumCacheSizes(int hardware, int software)
593 {
594  static constexpr int64_t kOneMeg = 1LL * 1024 * 1024;
595  m_maxHardwareCacheSize = kOneMeg * hardware;
596  m_maxSoftwareCacheSize = kOneMeg * software;
597 
598  bool err = false;
599  if (m_maxHardwareCacheSize < 0)
600  {
602  err = true;
603  }
604  if (m_maxSoftwareCacheSize < 0)
605  {
606  m_maxSoftwareCacheSize = kOneMeg * 48;
607  err = true;
608  }
609 
610  LOG((err) ? VB_GENERAL : VB_GUI, (err) ? LOG_ERR : LOG_INFO,
611  QString("MythPainter cache sizes: Hardware %1MB, Software %2MB")
612  .arg(m_maxHardwareCacheSize / kOneMeg)
613  .arg(m_maxSoftwareCacheSize / kOneMeg));
614 }
MythPainter::m_allocatedImages
QSet< MythImage * > m_allocatedImages
Definition: mythpainter.h:144
FormatVector
QVector< QTextLayout::FormatRange > FormatVector
Definition: mythpainter.h:31
build_compdb.dest
dest
Definition: build_compdb.py:9
MythPainter::m_allocationLock
QMutex m_allocationLock
Definition: mythpainter.h:143
MythPainter::m_stringExpireList
std::list< QString > m_stringExpireList
Definition: mythpainter.h:147
MythPainter::SetMaximumCacheSizes
void SetMaximumCacheSizes(int hardware, int software)
Definition: mythpainter.cpp:592
MythPainter::GetFormatImage
MythImage * GetFormatImage()
Returns a blank reference counted image in the format required for the Draw functions for this painte...
Definition: mythpainter.cpp:525
MythPainter::DrawTextPriv
static void DrawTextPriv(MythImage *im, const QString &msg, int flags, QRect r, const MythFontProperties &font)
Definition: mythpainter.cpp:191
MythPainter::GetImageFromRect
MythImage * GetImageFromRect(QRect area, int radius, int ellipse, const QBrush &fillBrush, const QPen &linePen)
Definition: mythpainter.cpp:457
MythFontProperties::GetHash
QString GetHash(void) const
Definition: mythfontproperties.h:35
MythPainter::DrawRectPriv
static void DrawRectPriv(MythImage *im, QRect area, int radius, int ellipse, const QBrush &fillBrush, const QPen &linePen)
Definition: mythpainter.cpp:303
MythFontProperties::face
QFont face(void) const
Definition: mythfontproperties.cpp:40
MythPainter::SetClipRegion
virtual void SetClipRegion(const QRegion &clipRegion)
Definition: mythpainter.cpp:50
MythFontProperties::hasShadow
bool hasShadow(void) const
Definition: mythfontproperties.h:29
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
MythPainter::DrawRect
virtual void DrawRect(QRect area, const QBrush &fillBrush, const QPen &linePen, int alpha)
Definition: mythpainter.cpp:157
MythPainter::m_maxHardwareCacheSize
int m_maxHardwareCacheSize
Definition: mythpainter.h:137
MythPainter::m_softwareCacheSize
int64_t m_softwareCacheSize
Definition: mythpainter.h:140
MythImage::SetFileName
void SetFileName(QString fname)
Definition: mythimage.h:90
MythPainter::m_stringToImageMap
QMap< QString, MythImage * > m_stringToImageMap
Definition: mythpainter.h:146
MythPainter::DrawTextLayout
virtual void DrawTextLayout(QRect canvasRect, const LayoutVector &layouts, const FormatVector &formats, const MythFontProperties &font, int alpha, QRect destRect)
Definition: mythpainter.cpp:123
MythPainter::ExpireImages
void ExpireImages(int64_t max=0)
Definition: mythpainter.cpp:551
MythPainter::Clear
virtual void Clear(QPaintDevice *device, const QRegion &region)
Definition: mythpainter.cpp:54
MythPainter::DeleteFormatImage
void DeleteFormatImage(MythImage *im)
Definition: mythpainter.cpp:534
MythPainter::DeleteFormatImagePriv
virtual void DeleteFormatImagePriv(MythImage *im)=0
tmp
static guint32 * tmp
Definition: goom_core.cpp:26
MythFontProperties::hasOutline
bool hasOutline(void) const
Definition: mythfontproperties.h:32
MythPainter::GetImageFromTextLayout
MythImage * GetImageFromTextLayout(const LayoutVector &layouts, const FormatVector &formats, const MythFontProperties &font, QRect &canvas, QRect &dest)
Definition: mythpainter.cpp:368
MythPainter::MythPainter
MythPainter()
Definition: mythpainter.cpp:23
MythPainter::GetImageFromString
MythImage * GetImageFromString(const QString &msg, int flags, QRect r, const MythFontProperties &font)
Definition: mythpainter.cpp:335
mythfontproperties.h
mythlogging.h
MythPainter::GetFormatImagePriv
virtual MythImage * GetFormatImagePriv(void)=0
Creates a reference counted image, call DecrRef() to delete.
compat.h
MythFontProperties
Definition: mythfontproperties.h:13
formats
const std::array< const std::string, 8 > formats
Definition: vbilut.cpp:189
MythFontProperties::GetBrush
QBrush GetBrush(void) const
Definition: mythfontproperties.h:27
MythFontProperties::color
QColor color(void) const
Definition: mythfontproperties.h:26
MythImage::DecrRef
int DecrRef(void) override
Decrements reference count and deletes on 0.
Definition: mythimage.cpp:52
MythFontProperties::GetOutline
void GetOutline(QColor &color, int &size, int &alpha) const
Definition: mythfontproperties.cpp:82
MythPainter::DrawImage
virtual void DrawImage(QRect dest, MythImage *im, QRect src, int alpha)=0
mythpainter.h
MythPoint::NormPoint
void NormPoint(void)
Definition: mythrect.cpp:471
MythFontProperties::GetShadow
void GetShadow(QPoint &offset, QColor &color, int &alpha) const
Definition: mythfontproperties.cpp:75
MythImage::IncrRef
int IncrRef(void) override
Increments reference count.
Definition: mythimage.cpp:44
MythImage::SetParent
void SetParent(MythPainter *parent)
Definition: mythimage.h:45
mythimage.h
MythImage::GetSize
int64_t GetSize(void)
Definition: mythimage.h:69
mythcorecontext.h
LayoutVector
QVector< QTextLayout * > LayoutVector
Definition: mythpainter.h:30
MythImage
Definition: mythimage.h:36
MythPainter::DrawText
virtual void DrawText(QRect r, const QString &msg, int flags, const MythFontProperties &font, int alpha, QRect boundRect)
Definition: mythpainter.cpp:76
MythImage::GetParent
MythPainter * GetParent(void)
Definition: mythimage.h:44
MythPainter::SetClipRect
virtual void SetClipRect(QRect clipRect)
Definition: mythpainter.cpp:46
mythuianimation.h
MythPainter::Teardown
virtual void Teardown(void)
Definition: mythpainter.cpp:28
MythImage::Assign
void Assign(const QImage &img)
Definition: mythimage.cpp:77
MythPainter::DrawEllipse
virtual void DrawEllipse(QRect area, const QBrush &fillBrush, const QPen &linePen, int alpha)
Definition: mythpainter.cpp:180
MythPainter::CheckFormatImage
void CheckFormatImage(MythImage *im)
Definition: mythpainter.cpp:541
MythPainter::DrawRoundRect
virtual void DrawRoundRect(QRect area, int cornerRadius, const QBrush &fillBrush, const QPen &linePen, int alpha)
Definition: mythpainter.cpp:168
MythPoint
Wrapper around QPoint allowing us to handle percentage and other relative values for positioning in m...
Definition: mythrect.h:88
MythPainter::m_maxSoftwareCacheSize
int64_t m_maxSoftwareCacheSize
Definition: mythpainter.h:141