63 const QRect &selectionRect,
72 const QRect dataRect =
kisGrowRect(selectionRect, 1);
74 const int dataRowSize = dataRect.width() *
sizeof(quint8);
75 const int selectionRowSize = selectionRect.width() *
sizeof(quint8);
76 QScopedArrayPointer<quint8> dstRow(
new quint8[selectionRowSize]);
78 QScopedArrayPointer<quint8> bmRow1(
new quint8[dataRowSize]);
79 QScopedArrayPointer<quint8> bmRow2(
new quint8[dataRowSize]);
80 QScopedArrayPointer<quint8> bmRow3(
new quint8[dataRowSize]);
82 device->
readBytes(bmRow1.data(), dataRect.left(), dataRect.top(), dataRect.width(), 1);
83 device->
readBytes(bmRow2.data(), dataRect.left(), dataRect.top() + 1, dataRect.width(), 1);
84 device->
readBytes(bmRow3.data(), dataRect.left(), dataRect.top() + 2, dataRect.width(), 1);
90 for (
int row = selectionRect.top();
91 row < selectionRect.top() + selectionRect.height(); row++) {
93 bumpmap_row (bmvals, dstRow.data(), selectionRect.width(),
94 bmRow1.data() + 1, bmRow2.data() + 1, bmRow3.data() + 1,
97 device->
writeBytes(dstRow.data(), selectionRect.left(), row, selectionRect.width(), 1);
102 device->
readBytes(bmRow3.data(), dataRect.left(), row + 1, dataRect.width(), 1);
174 for (x = 0; x < width; x++) {
185 nx = (bm_row1[xofs1] + bm_row2[xofs1] + bm_row3[xofs1] -
186 bm_row1[xofs3] - bm_row2[xofs3] - bm_row3[xofs3]);
187 ny = (bm_row3[xofs1] + bm_row3[xofs2] + bm_row3[xofs3] -
188 bm_row1[xofs1] - bm_row1[xofs2] - bm_row1[xofs3]);
192 if ((nx == 0) && (ny == 0)) {
195 gint ndotl = nx * params->
lx + ny * params->
ly + params->
nzlz;
200 shade = ndotl / sqrt (nx * nx + ny * ny + params->
nz2);
211 *dest++ =
MIN(255, result);
void bumpmap_row(const bumpmap_vals_t &bmvals, guchar *dest, gint width, const guchar *bm_row1, const guchar *bm_row2, const guchar *bm_row3, bumpmap_params_t *params)