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 : qAsConst(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::PushTransformation(const UIEffects &zoom, QPointF center)
192 {
193  (void)zoom;
194  (void)center;
195 }
196 
197 void MythPainter::DrawTextPriv(MythImage *im, const QString &msg, int flags,
198  const QRect r, const MythFontProperties &font)
199 {
200  if (!im)
201  return;
202 
203  QColor outlineColor;
204  int outlineSize = 0;
205  int outlineAlpha = 255;
206  if (font.hasOutline())
207  font.GetOutline(outlineColor, outlineSize, outlineAlpha);
208 
209  QPoint shadowOffset(0, 0);
210  QColor shadowColor;
211  int shadowAlpha = 255;
212  if (font.hasShadow())
213  font.GetShadow(shadowOffset, shadowColor, shadowAlpha);
214 
215  QFontMetrics fm(font.face());
216  int totalHeight = fm.height() + outlineSize +
217  std::max(outlineSize, std::abs(shadowOffset.y()));
218 
219  // initialPaddingX is the number of pixels from the left of the
220  // input QRect to the left of the actual text. It is always 0
221  // because we don't add padding to the text rectangle.
222  int initialPaddingX = 0;
223 
224  // initialPaddingY is the number of pixels from the top of the
225  // input QRect to the top of the actual text. It may be nonzero
226  // because of extra vertical padding.
227  int initialPaddingY = (r.height() - totalHeight) / 2;
228  // Hack. Normally we vertically center the text due to some
229  // (solvable) issues in the SubtitleScreen code - the text rect
230  // and the background rect are both created with PAD_WIDTH extra
231  // padding, and to honor Qt::AlignTop, the text rect needs to be
232  // without padding. This doesn't work for Qt::TextWordWrap, since
233  // the first line will be vertically centered with subsequence
234  // lines below. So if Qt::TextWordWrap is set, we do top
235  // alignment.
236  if (flags & Qt::TextWordWrap)
237  initialPaddingY = 0;
238 
239  // textOffsetX is the number of pixels from r.left() to the left
240  // edge of the core text. This assumes that flags contains
241  // Qt::AlignLeft.
242  int textOffsetX =
243  initialPaddingX + std::max(outlineSize, -shadowOffset.x());
244 
245  // textOffsetY is the number of pixels from r.top() to the top
246  // edge of the core text. This assumes that flags contains
247  // Qt::AlignTop.
248  int textOffsetY =
249  initialPaddingY + std::max(outlineSize, -shadowOffset.y());
250 
251  QImage pm(r.size(), QImage::Format_ARGB32);
252  QColor fillcolor = font.color();
253  if (font.hasOutline())
254  fillcolor = outlineColor;
255  fillcolor.setAlpha(0);
256  pm.fill(fillcolor.rgba());
257 
258  QPainter tmp(&pm);
259  QFont tmpfont = font.face();
260 #if QT_VERSION < QT_VERSION_CHECK(5,15,0)
261  tmpfont.setStyleStrategy(QFont::OpenGLCompatible);
262 #endif
263  tmp.setFont(tmpfont);
264 
265  QPainterPath path;
266  if (font.hasOutline())
267  path.addText(0, 0, tmpfont, msg);
268 
269  if (font.hasShadow())
270  {
271  QRect a = QRect(0, 0, r.width(), r.height());
272  a.translate(shadowOffset.x() + textOffsetX,
273  shadowOffset.y() + textOffsetY);
274 
275  shadowColor.setAlpha(shadowAlpha);
276  tmp.setPen(shadowColor);
277  tmp.drawText(a, flags, msg);
278  }
279 
280  if (font.hasOutline())
281  {
282  // QPainter::drawText() treats the Y coordinate as the top of
283  // the text (when Qt::AlignTop is used). However,
284  // QPainterPath::addText() treats the Y coordinate as the base
285  // line of the text. To translate from the top to the base
286  // line, we need to add QFontMetrics::ascent().
287  int adjX = 0;
288  int adjY = fm.ascent();
289 
290  outlineColor.setAlpha(outlineAlpha);
291  tmp.setPen(outlineColor);
292 
293  path.translate(adjX + textOffsetX, adjY + textOffsetY);
294  QPen pen = tmp.pen();
295  pen.setWidth(outlineSize * 2 + 1);
296  pen.setCapStyle(Qt::RoundCap);
297  pen.setJoinStyle(Qt::RoundJoin);
298  tmp.setPen(pen);
299  tmp.drawPath(path);
300 
301  path.translate(outlineSize, outlineSize);
302  }
303 
304  tmp.setPen(QPen(font.GetBrush(), 0));
305  tmp.setBrush(font.GetBrush());
306  tmp.drawText(textOffsetX, textOffsetY, r.width(), r.height(),
307  flags, msg);
308  tmp.end();
309  im->Assign(pm);
310 }
311 
312 void MythPainter::DrawRectPriv(MythImage *im, const QRect area, int radius,
313  int ellipse,
314  const QBrush &fillBrush, const QPen &linePen)
315 {
316  if (!im)
317  return;
318 
319  QImage image(QSize(area.width(), area.height()), QImage::Format_ARGB32);
320  image.fill(0x00000000);
321  QPainter painter(&image);
322  painter.setRenderHint(QPainter::Antialiasing);
323  painter.setPen(linePen);
324  painter.setBrush(fillBrush);
325 
326  if ((area.width() / 2) < radius)
327  radius = area.width() / 2;
328 
329  if ((area.height() / 2) < radius)
330  radius = area.height() / 2;
331 
332  int lineWidth = linePen.width();
333  QRect r(lineWidth, lineWidth,
334  area.width() - (lineWidth * 2), area.height() - (lineWidth * 2));
335 
336  if (ellipse)
337  painter.drawEllipse(r);
338  else if (radius == 0)
339  painter.drawRect(r);
340  else
341  painter.drawRoundedRect(r, (qreal)radius, qreal(radius));
342 
343  painter.end();
344  im->Assign(image);
345 }
346 
348  int flags, const QRect r,
349  const MythFontProperties &font)
350 {
351  QString incoming = font.GetHash() + QString::number(r.width()) +
352  QString::number(r.height()) +
353  QString::number(flags) +
354  QString::number(font.color().rgba()) + msg;
355 
356  MythImage *im = nullptr;
357  if (m_stringToImageMap.contains(incoming))
358  {
359  m_stringExpireList.remove(incoming);
360  m_stringExpireList.push_back(incoming);
361  im = m_stringToImageMap[incoming];
362  if (im)
363  im->IncrRef();
364  }
365  else
366  {
367  im = GetFormatImage();
368  im->SetFileName(QString("GetImageFromString: %1").arg(msg));
369  DrawTextPriv(im, msg, flags, r, font);
370 
371  im->IncrRef();
372  m_softwareCacheSize += im->GetSize();
373  m_stringToImageMap[incoming] = im;
374  m_stringExpireList.push_back(incoming);
376  }
377  return im;
378 }
379 
381  const FormatVector &formats,
382  const MythFontProperties &font,
383  QRect &canvas, QRect &dest)
384 {
385  QString incoming = QString::number(canvas.x()) +
386  QString::number(canvas.y()) +
387  QString::number(canvas.width()) +
388  QString::number(canvas.height()) +
389  QString::number(dest.width()) +
390  QString::number(dest.height()) +
391  font.GetHash();
392 
393  for (auto *layout : qAsConst(layouts))
394  incoming += layout->text();
395 
396  MythImage *im = nullptr;
397  if (m_stringToImageMap.contains(incoming))
398  {
399  m_stringExpireList.remove(incoming);
400  m_stringExpireList.push_back(incoming);
401  im = m_stringToImageMap[incoming];
402  if (im)
403  im->IncrRef();
404  }
405  else
406  {
407  im = GetFormatImage();
408  im->SetFileName("GetImageFromTextLayout");
409 
410  QImage pm(canvas.size(), QImage::Format_ARGB32_Premultiplied);
411  pm.fill(0);
412 
413  QPainter painter(&pm);
414  if (!painter.isActive())
415  {
416  LOG(VB_GENERAL, LOG_ERR, "MythPainter::GetImageFromTextLayout: "
417  "Invalid canvas.");
418  return im;
419  }
420 
421  QRect clip;
422  clip.setSize(canvas.size());
423 
424  QFont tmpfont = font.face();
425 #if QT_VERSION < QT_VERSION_CHECK(5,15,0)
426  tmpfont.setStyleStrategy(QFont::OpenGLCompatible);
427 #endif
428  painter.setFont(tmpfont);
429  painter.setRenderHint(QPainter::Antialiasing);
430 
431  if (font.hasShadow())
432  {
433  QRect shadowRect;
434  QPoint shadowOffset;
435  QColor shadowColor;
436  int shadowAlpha = 255;
437 
438  font.GetShadow(shadowOffset, shadowColor, shadowAlpha);
439  shadowColor.setAlpha(shadowAlpha);
440 
441  MythPoint shadow(shadowOffset);
442  shadow.NormPoint(); // scale it to screen resolution
443 
444  shadowRect = canvas;
445  shadowRect.translate(shadow.x(), shadow.y());
446 
447  painter.setPen(shadowColor);
448  for (auto *layout : qAsConst(layouts))
449  layout->draw(&painter, shadowRect.topLeft(), formats, clip);
450  }
451 
452  painter.setPen(QPen(font.GetBrush(), 0));
453  for (auto *layout : qAsConst(layouts))
454  {
455  layout->draw(&painter, canvas.topLeft(),
456  layout->formats(), clip);
457  }
458  painter.end();
459 
460  pm.setOffset(canvas.topLeft());
461  im->Assign(pm.copy(0, 0, dest.width(), dest.height()));
462 
463  im->IncrRef();
464  m_softwareCacheSize += im->GetSize();
465  m_stringToImageMap[incoming] = im;
466  m_stringExpireList.push_back(incoming);
468  }
469  return im;
470 }
471 
472 MythImage* MythPainter::GetImageFromRect(const QRect area, int radius,
473  int ellipse,
474  const QBrush &fillBrush,
475  const QPen &linePen)
476 {
477  if (area.width() <= 0 || area.height() <= 0)
478  return nullptr;
479 
480  uint64_t hash1 = ((0xfff & (uint64_t)area.width())) +
481  ((0xfff & (uint64_t)area.height()) << 12) +
482  ((0xff & (uint64_t)fillBrush.style()) << 24) +
483  ((0xff & (uint64_t)linePen.width()) << 32) +
484  ((0xff & (uint64_t)radius) << 40) +
485  ((0xff & (uint64_t)linePen.style()) << 48) +
486  ((0xff & (uint64_t)ellipse) << 56);
487  uint64_t hash2 = ((0xffffffff & (uint64_t)linePen.color().rgba())) +
488  ((0xffffffff & (uint64_t)fillBrush.color().rgba()) << 32);
489 
490  QString incoming("R");
491  if (fillBrush.style() == Qt::LinearGradientPattern && fillBrush.gradient())
492  {
493  // The Q*Gradient classes are not polymorohic, and therefore
494  // dynamic_cast can't be used here.
495  // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast)
496  const auto *gradient = static_cast<const QLinearGradient*>(fillBrush.gradient());
497  if (gradient)
498  {
499  incoming = QString::number(
500  ((0xfff & (uint64_t)gradient->start().x())) +
501  ((0xfff & (uint64_t)gradient->start().y()) << 12) +
502  ((0xfff & (uint64_t)gradient->finalStop().x()) << 24) +
503  ((0xfff & (uint64_t)gradient->finalStop().y()) << 36));
504  QGradientStops stops = gradient->stops();
505  for (const auto & stop : qAsConst(stops))
506  {
507  incoming += QString::number(
508  ((0xfff * (uint64_t)(stop.first * 100))) +
509  ((uint64_t)stop.second.rgba() << 12));
510  }
511  }
512  }
513 
514  incoming += QString::number(hash1) + QString::number(hash2);
515 
516  MythImage *im = nullptr;
517  if (m_stringToImageMap.contains(incoming))
518  {
519  m_stringExpireList.remove(incoming);
520  m_stringExpireList.push_back(incoming);
521  im = m_stringToImageMap[incoming];
522  if (im)
523  im->IncrRef();
524  }
525  else
526  {
527  im = GetFormatImage();
528  im->SetFileName("GetImageFromRect");
529  DrawRectPriv(im, area, radius, ellipse, fillBrush, linePen);
530 
531  im->IncrRef();
532  m_softwareCacheSize += im->GetSize();
533  m_stringToImageMap[incoming] = im;
534  m_stringExpireList.push_back(incoming);
536  }
537  return im;
538 }
539 
541 {
542  QMutexLocker locker(&m_allocationLock);
543  MythImage *result = GetFormatImagePriv();
544  result->SetFileName("GetFormatImage");
545  m_allocatedImages.insert(result);
546  return result;
547 }
548 
550 {
551  QMutexLocker locker(&m_allocationLock);
553  m_allocatedImages.remove(im);
554 }
555 
557 {
558  if (im && !im->GetParent())
559  {
560  QMutexLocker locker(&m_allocationLock);
561  m_allocatedImages.insert(im);
562  im->SetParent(this);
563  }
564 }
565 
566 void MythPainter::ExpireImages(int64_t max)
567 {
568  bool recompute = false;
569  while (!m_stringExpireList.empty())
570  {
571  if (m_softwareCacheSize < max)
572  break;
573 
574  QString oldmsg = m_stringExpireList.front();
575  m_stringExpireList.pop_front();
576 
577  QMap<QString, MythImage*>::iterator it =
578  m_stringToImageMap.find(oldmsg);
579  if (it == m_stringToImageMap.end())
580  {
581  recompute = true;
582  continue;
583  }
584  MythImage *oldim = *it;
585  it = m_stringToImageMap.erase(it);
586 
587  if (oldim)
588  {
589  m_softwareCacheSize -= oldim->GetSize();
590  if (m_softwareCacheSize < 0)
591  {
593  recompute = true;
594  }
595  oldim->DecrRef();
596  }
597  }
598  if (recompute)
599  {
601  for (auto *img : qAsConst(m_stringToImageMap))
602  m_softwareCacheSize += img->GetSize();
603  }
604 }
605 
606 // the following assume graphics hardware operates natively at 32bpp
607 void MythPainter::SetMaximumCacheSizes(int hardware, int software)
608 {
609  static constexpr int64_t kOneMeg = 1LL * 1024 * 1024;
610  m_maxHardwareCacheSize = kOneMeg * hardware;
611  m_maxSoftwareCacheSize = kOneMeg * software;
612 
613  bool err = false;
614  if (m_maxHardwareCacheSize < 0)
615  {
617  err = true;
618  }
619  if (m_maxSoftwareCacheSize < 0)
620  {
621  m_maxSoftwareCacheSize = kOneMeg * 48;
622  err = true;
623  }
624 
625  LOG((err) ? VB_GENERAL : VB_GUI, (err) ? LOG_ERR : LOG_INFO,
626  QString("MythPainter cache sizes: Hardware %1MB, Software %2MB")
627  .arg(m_maxHardwareCacheSize / kOneMeg)
628  .arg(m_maxSoftwareCacheSize / kOneMeg));
629 }
MythPainter::m_allocatedImages
QSet< MythImage * > m_allocatedImages
Definition: mythpainter.h:143
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:142
MythPainter::m_stringExpireList
std::list< QString > m_stringExpireList
Definition: mythpainter.h:146
MythPainter::SetMaximumCacheSizes
void SetMaximumCacheSizes(int hardware, int software)
Definition: mythpainter.cpp:607
MythPainter::GetFormatImage
MythImage * GetFormatImage()
Returns a blank reference counted image in the format required for the Draw functions for this painte...
Definition: mythpainter.cpp:540
MythPainter::DrawTextPriv
static void DrawTextPriv(MythImage *im, const QString &msg, int flags, QRect r, const MythFontProperties &font)
Definition: mythpainter.cpp:197
MythPainter::GetImageFromRect
MythImage * GetImageFromRect(QRect area, int radius, int ellipse, const QBrush &fillBrush, const QPen &linePen)
Definition: mythpainter.cpp:472
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:312
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:136
MythPainter::m_softwareCacheSize
int64_t m_softwareCacheSize
Definition: mythpainter.h:139
MythImage::SetFileName
void SetFileName(QString fname)
Definition: mythimage.h:90
MythPainter::m_stringToImageMap
QMap< QString, MythImage * > m_stringToImageMap
Definition: mythpainter.h:145
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:566
MythPainter::PushTransformation
virtual void PushTransformation(const UIEffects &zoom, QPointF center=QPointF())
Definition: mythpainter.cpp:191
MythPainter::Clear
virtual void Clear(QPaintDevice *device, const QRegion &region)
Definition: mythpainter.cpp:54
MythPainter::DeleteFormatImage
void DeleteFormatImage(MythImage *im)
Definition: mythpainter.cpp:549
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:380
MythPainter::MythPainter
MythPainter()
Definition: mythpainter.cpp:23
MythPainter::GetImageFromString
MythImage * GetImageFromString(const QString &msg, int flags, QRect r, const MythFontProperties &font)
Definition: mythpainter.cpp:347
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
UIEffects
Definition: mythuianimation.h:13
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:556
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:140