Changeset View
Changeset View
Standalone View
Standalone View
pixmapfx/kpPixmapFX_GetSetPixmapParts.cpp
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 55 | void kpPixmapFX::setPixmapAt(QImage *destPtr, const QRect &destRect, | |||
---|---|---|---|---|---|
56 | const QImage &src) | 56 | const QImage &src) | ||
57 | { | 57 | { | ||
58 | qCDebug(kpLogPixmapfx) << "kpPixmapFX::setPixmapAt(destPixmap->rect=" | 58 | qCDebug(kpLogPixmapfx) << "kpPixmapFX::setPixmapAt(destPixmap->rect=" | ||
59 | << destPtr->rect () | 59 | << destPtr->rect () | ||
60 | << ",destRect=" | 60 | << ",destRect=" | ||
61 | << destRect | 61 | << destRect | ||
62 | << ",src.rect=" | 62 | << ",src.rect=" | ||
63 | << src.rect () | 63 | << src.rect () | ||
64 | << ")" | 64 | << ")"; | ||
65 | << endl; | | |||
66 | 65 | | |||
67 | Q_ASSERT (destPtr); | 66 | Q_ASSERT (destPtr); | ||
68 | 67 | | |||
69 | // You cannot copy more than what you have. | 68 | // You cannot copy more than what you have. | ||
70 | Q_ASSERT (destRect.width () <= src.width () && | 69 | Q_ASSERT (destRect.width () <= src.width () && | ||
71 | destRect.height () <= src.height ()); | 70 | destRect.height () <= src.height ()); | ||
72 | 71 | | |||
73 | QPainter painter(destPtr); | 72 | QPainter painter(destPtr); | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 115 | { | |||
117 | kpPixmapFX::paintPixmapAt(destPtr, QPoint (destX, destY), src); | 116 | kpPixmapFX::paintPixmapAt(destPtr, QPoint (destX, destY), src); | ||
118 | } | 117 | } | ||
119 | 118 | | |||
120 | //--------------------------------------------------------------------- | 119 | //--------------------------------------------------------------------- | ||
121 | 120 | | |||
122 | // public static | 121 | // public static | ||
123 | kpColor kpPixmapFX::getColorAtPixel (const QImage &img, const QPoint &at) | 122 | kpColor kpPixmapFX::getColorAtPixel (const QImage &img, const QPoint &at) | ||
124 | { | 123 | { | ||
125 | if (!img.valid (at.x (), at.y ())) | 124 | if (!img.valid (at.x (), at.y ())) { | ||
126 | return kpColor::Invalid; | 125 | return kpColor::Invalid; | ||
126 | } | ||||
127 | 127 | | |||
128 | QRgb rgba = img.pixel(at); | 128 | QRgb rgba = img.pixel(at); | ||
129 | return kpColor (rgba); | 129 | return kpColor (rgba); | ||
130 | } | 130 | } | ||
131 | 131 | | |||
132 | //--------------------------------------------------------------------- | 132 | //--------------------------------------------------------------------- | ||
133 | 133 | | |||
134 | // public static | 134 | // public static | ||
135 | kpColor kpPixmapFX::getColorAtPixel (const QImage &img, int x, int y) | 135 | kpColor kpPixmapFX::getColorAtPixel (const QImage &img, int x, int y) | ||
136 | { | 136 | { | ||
137 | return kpPixmapFX::getColorAtPixel (img, QPoint (x, y)); | 137 | return kpPixmapFX::getColorAtPixel (img, QPoint (x, y)); | ||
138 | } | 138 | } | ||
139 | 139 | | |||
140 | //--------------------------------------------------------------------- | 140 | //--------------------------------------------------------------------- |