| |
| |
| #include "traster.h" |
| #include "tpixelutils.h" |
| |
| #include "trop.h" |
| |
| |
| |
| |
| |
| namespace { |
| |
| template <typename T> |
| struct RaylitFuncTraits { |
| typedef void (*function_type)(T *, T *, int, int, int, int, const TRect &, |
| const TRect &, const TRop::RaylitParams &); |
| }; |
| |
| |
| |
| template <typename T> |
| void performStandardRaylit(T *bufIn, T *bufOut, int dxIn, int dyIn, int dxOut, |
| int dyOut, const TRect &srcRect, |
| const TRect &dstRect, |
| const TRop::RaylitParams ¶ms) { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| int max = T::maxChannelValue; |
| |
| int transp_val = (params.m_invert) ? max : 0, opaque_val = max - transp_val; |
| int value, val_r, val_g, val_b, val_m; |
| double lightness, r_fac, g_fac, b_fac, m_fac; |
| |
| double factor = max / 255.0; |
| |
| |
| |
| |
| |
| |
| |
| |
| double scale = params.m_scale; |
| double decay = log(params.m_decay / 100.0 + 1.0) + 1.0; |
| double intensity = 1e8 * log(params.m_intensity / 100.0 + 1.0) / scale; |
| double smoothness = log(params.m_smoothness * 5.0 / 100.0 + 1.0); |
| double radius = params.m_radius; |
| |
| |
| |
| double neg_delta_p = smoothness * intensity; |
| |
| |
| double quot_delta_p = intensity / max; |
| |
| |
| |
| |
| |
| m_fac = (params.m_color.m / 255.0); |
| r_fac = m_fac * (params.m_color.r / 255.0); |
| g_fac = m_fac * (params.m_color.g / 255.0); |
| b_fac = m_fac * (params.m_color.b / 255.0); |
| |
| |
| int x, y, ray_final_y; |
| int octLx = dstRect.x1 - dstRect.x0; |
| |
| double rayPosIncrementX = 1.0 / scale; |
| |
| double sq_z = sq(params.m_lightOriginSrc.z); |
| |
| |
| |
| |
| T *pixIn, *pixOut; |
| |
| for (ray_final_y = 0; ray_final_y < octLx; ++ray_final_y) { |
| |
| lightness = 0.0; |
| |
| double rayPosIncrementY = rayPosIncrementX * (ray_final_y / (double)octLx); |
| |
| |
| |
| |
| int yIncrementCounter = 0, yIncrementThreshold = octLx - 1; |
| |
| |
| TPointD rayPos(rayPosIncrementX, rayPosIncrementY); |
| |
| for (x = dstRect.x0, y = dstRect.y0, pixIn = bufIn, pixOut = bufOut; |
| (x < dstRect.x1) && (y < dstRect.y1); ++x) { |
| bool insideSrc = (x >= srcRect.x0) && (x < srcRect.x1) && |
| (y >= srcRect.y0) && (y < srcRect.y1); |
| if (insideSrc) { |
| |
| if (pixIn->m == opaque_val) |
| lightness = std::max( |
| 0.0, lightness - neg_delta_p); |
| else { |
| if (pixIn->m == transp_val) |
| lightness += intensity; |
| else |
| lightness = std::max( |
| 0.0, lightness + |
| (params.m_invert ? pixIn->m : (max - pixIn->m)) * |
| quot_delta_p); |
| } |
| |
| if (params.m_includeInput) { |
| val_r = pixIn->r; |
| val_g = pixIn->g; |
| val_b = pixIn->b; |
| val_m = pixIn->m; |
| } else |
| val_r = val_g = val_b = val_m = 0; |
| } else { |
| if (!params.m_invert) |
| lightness += intensity; |
| else |
| lightness = std::max(0.0, lightness - neg_delta_p); |
| |
| val_r = val_g = val_b = val_m = 0; |
| } |
| |
| bool insideDst = (x >= 0) && (y >= 0); |
| if (insideDst) { |
| |
| if (lightness > 0.0) { |
| if (radius == 0.0) { |
| value = (int)(factor * lightness / |
| (rayPos.x * |
| pow((double)(sq(rayPos.x) + sq(rayPos.y) + sq_z), |
| decay)) + |
| 0.5); |
| } else { |
| double ratio = std::max(0.001, 1.0 - radius / norm(rayPos)); |
| value = (int)(factor * lightness / |
| (rayPos.x * ratio * |
| pow((double)(sq(rayPos.x * ratio) + |
| sq(rayPos.y * ratio) + sq_z), |
| decay)) + |
| 0.5); |
| } |
| } else |
| value = 0; |
| |
| |
| |
| |
| |
| |
| val_r += value * r_fac; |
| val_g += value * g_fac; |
| val_b += value * b_fac; |
| val_m += value * m_fac; |
| |
| pixOut->r = (val_r > max) ? max : val_r; |
| pixOut->g = (val_g > max) ? max : val_g; |
| pixOut->b = (val_b > max) ? max : val_b; |
| pixOut->m = (val_m > max) ? max : val_m; |
| } |
| |
| |
| pixIn += dxIn, pixOut += dxOut; |
| |
| rayPos.x += rayPosIncrementX, rayPos.y += rayPosIncrementY; |
| |
| |
| if ((yIncrementCounter += ray_final_y) >= yIncrementThreshold) { |
| ++y, pixIn += dyIn, pixOut += dyOut; |
| yIncrementCounter -= yIncrementThreshold; |
| } |
| } |
| } |
| } |
| |
| |
| |
| template <> |
| void performStandardRaylit<TPixelF>(TPixelF *bufIn, TPixelF *bufOut, int dxIn, |
| int dyIn, int dxOut, int dyOut, |
| const TRect &srcRect, const TRect &dstRect, |
| const TRop::RaylitParams ¶ms) { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| float max = TPixelF::maxChannelValue; |
| |
| float transp_val = (params.m_invert) ? max : 0.f, |
| opaque_val = max - transp_val; |
| float value, val_r, val_g, val_b, val_m; |
| double lightness, r_fac, g_fac, b_fac, m_fac; |
| |
| double factor = max / 255.0; |
| |
| |
| |
| |
| |
| |
| |
| |
| double scale = params.m_scale; |
| double decay = log(params.m_decay / 100.0 + 1.0) + 1.0; |
| double intensity = 1e8 * log(params.m_intensity / 100.0 + 1.0) / scale; |
| double smoothness = log(params.m_smoothness * 5.0 / 100.0 + 1.0); |
| double radius = params.m_radius; |
| |
| |
| |
| double neg_delta_p = smoothness * intensity; |
| |
| |
| double quot_delta_p = intensity / max; |
| |
| |
| |
| |
| |
| TPixelF colorF = toPixelF(params.m_color); |
| m_fac = colorF.m; |
| r_fac = m_fac * colorF.r; |
| g_fac = m_fac * colorF.g; |
| b_fac = m_fac * colorF.b; |
| |
| |
| int x, y, ray_final_y; |
| int octLx = dstRect.x1 - dstRect.x0; |
| |
| double rayPosIncrementX = 1.0 / scale; |
| |
| double sq_z = sq(params.m_lightOriginSrc.z); |
| |
| |
| |
| |
| TPixelF *pixIn, *pixOut; |
| |
| for (ray_final_y = 0; ray_final_y < octLx; ++ray_final_y) { |
| |
| lightness = 0.0; |
| |
| double rayPosIncrementY = rayPosIncrementX * (ray_final_y / (double)octLx); |
| |
| |
| |
| |
| int yIncrementCounter = 0, yIncrementThreshold = octLx - 1; |
| |
| |
| TPointD rayPos(rayPosIncrementX, rayPosIncrementY); |
| |
| for (x = dstRect.x0, y = dstRect.y0, pixIn = bufIn, pixOut = bufOut; |
| (x < dstRect.x1) && (y < dstRect.y1); ++x) { |
| bool insideSrc = (x >= srcRect.x0) && (x < srcRect.x1) && |
| (y >= srcRect.y0) && (y < srcRect.y1); |
| if (insideSrc) { |
| |
| if (areAlmostEqual((double)pixIn->m, (double)opaque_val)) |
| lightness = std::max( |
| 0.0, lightness - neg_delta_p); |
| else { |
| if (areAlmostEqual((double)pixIn->m, (double)transp_val)) |
| lightness += intensity; |
| else |
| lightness = std::max( |
| 0.0, lightness + |
| (params.m_invert ? pixIn->m : (max - pixIn->m)) * |
| quot_delta_p); |
| } |
| |
| if (params.m_includeInput) { |
| val_r = pixIn->r; |
| val_g = pixIn->g; |
| val_b = pixIn->b; |
| val_m = pixIn->m; |
| } else |
| val_r = val_g = val_b = val_m = 0.f; |
| } else { |
| if (!params.m_invert) |
| lightness += intensity; |
| else |
| lightness = std::max(0.0, lightness - neg_delta_p); |
| |
| val_r = val_g = val_b = val_m = 0.f; |
| } |
| |
| bool insideDst = (x >= 0) && (y >= 0); |
| if (insideDst) { |
| |
| if (lightness > 0.0) { |
| if (radius == 0.0) { |
| value = |
| factor * lightness / |
| (rayPos.x * pow((double)(sq(rayPos.x) + sq(rayPos.y) + sq_z), |
| decay)); |
| } else { |
| double ratio = std::max(0.001, 1.0 - radius / norm(rayPos)); |
| value = factor * lightness / |
| (rayPos.x * ratio * |
| pow((double)(sq(rayPos.x * ratio) + sq(rayPos.y * ratio) + |
| sq_z), |
| decay)); |
| } |
| } else |
| value = 0.f; |
| |
| |
| |
| |
| |
| |
| val_r += value * r_fac; |
| val_g += value * g_fac; |
| val_b += value * b_fac; |
| val_m += value * m_fac; |
| |
| pixOut->r = val_r; |
| pixOut->g = val_g; |
| pixOut->b = val_b; |
| pixOut->m = (val_m > max) ? max : val_m; |
| } |
| |
| |
| pixIn += dxIn, pixOut += dxOut; |
| |
| rayPos.x += rayPosIncrementX, rayPos.y += rayPosIncrementY; |
| |
| |
| if ((yIncrementCounter += ray_final_y) >= yIncrementThreshold) { |
| ++y, pixIn += dyIn, pixOut += dyOut; |
| yIncrementCounter -= yIncrementThreshold; |
| } |
| } |
| } |
| } |
| |
| |
| |
| template <typename T> |
| void performColorRaylit(T *bufIn, T *bufOut, int dxIn, int dyIn, int dxOut, |
| int dyOut, const TRect &srcRect, const TRect &dstRect, |
| const TRop::RaylitParams ¶ms) { |
| |
| int max = T::maxChannelValue; |
| |
| int val_r, val_g, val_b, val_m; |
| double lightness_r, lightness_g, lightness_b; |
| double factor = max / 255.0; |
| |
| |
| |
| |
| |
| |
| |
| |
| double scale = params.m_scale; |
| double decay = log(params.m_decay / 100.0 + 1.0) + 1.0; |
| double intensity = 1e8 * log(params.m_intensity / 100.0 + 1.0) / scale; |
| double smoothness = log(params.m_smoothness * 5.0 / 100.0 + 1.0); |
| double radius = params.m_radius; |
| |
| double neg_delta_p = |
| smoothness * |
| intensity; |
| double quot_delta_p = intensity / max; |
| |
| |
| |
| int x, y, ray_final_y; |
| int octLx = dstRect.x1 - dstRect.x0; |
| |
| double rayPosIncrementX = 1.0 / scale; |
| |
| double fac, sq_z = sq(params.m_lightOriginSrc.z); |
| |
| |
| |
| |
| T *pixIn, *pixOut; |
| |
| for (ray_final_y = 0; ray_final_y < octLx; ++ray_final_y) { |
| |
| lightness_r = lightness_g = lightness_b = 0.0; |
| int l, l_max; |
| |
| double rayPosIncrementY = rayPosIncrementX * (ray_final_y / (double)octLx); |
| |
| |
| |
| |
| int yIncrementCounter = 0, yIncrementThreshold = octLx - 1; |
| |
| |
| TPointD rayPos(rayPosIncrementX, rayPosIncrementY); |
| |
| for (x = dstRect.x0, y = dstRect.y0, pixIn = bufIn, pixOut = bufOut; |
| (x < dstRect.x1) && (y < dstRect.y1); ++x) { |
| bool insideSrc = (x >= srcRect.x0) && (x < srcRect.x1) && |
| (y >= srcRect.y0) && (y < srcRect.y1); |
| if (insideSrc) { |
| val_r = pixIn->r; |
| val_g = pixIn->g; |
| val_b = pixIn->b; |
| val_m = pixIn->m; |
| |
| lightness_r = std::max(0.0, val_r ? lightness_r + val_r * quot_delta_p |
| : lightness_r - neg_delta_p); |
| lightness_g = std::max(0.0, val_g ? lightness_g + val_g * quot_delta_p |
| : lightness_g - neg_delta_p); |
| lightness_b = std::max(0.0, val_b ? lightness_b + val_b * quot_delta_p |
| : lightness_b - neg_delta_p); |
| |
| if (!params.m_includeInput) val_r = val_g = val_b = val_m = 0; |
| } else { |
| lightness_r = std::max(0.0, lightness_r - neg_delta_p); |
| lightness_g = std::max(0.0, lightness_g - neg_delta_p); |
| lightness_b = std::max(0.0, lightness_b - neg_delta_p); |
| |
| val_r = val_g = val_b = val_m = 0; |
| } |
| |
| bool insideDst = (x >= 0) && (y >= 0); |
| if (insideDst) { |
| |
| if (radius == 0.0) { |
| fac = factor / |
| (rayPos.x * |
| pow((double)(sq(rayPos.x) + sq(rayPos.y) + sq_z), decay)); |
| } else { |
| double ratio = std::max(0.001, 1.0 - radius / norm(rayPos)); |
| fac = |
| factor / |
| (rayPos.x * ratio * |
| pow((double)(sq(rayPos.x * ratio) + sq(rayPos.y * ratio) + sq_z), |
| decay)); |
| } |
| |
| |
| |
| |
| |
| |
| val_r += l = (int)(fac * lightness_r + 0.5); |
| l_max = l; |
| val_g += l = (int)(fac * lightness_g + 0.5); |
| l_max = std::max(l, l_max); |
| val_b += l = (int)(fac * lightness_b + 0.5); |
| l_max = std::max(l, l_max); |
| val_m += l_max; |
| |
| pixOut->r = (val_r > max) ? max : val_r; |
| pixOut->g = (val_g > max) ? max : val_g; |
| pixOut->b = (val_b > max) ? max : val_b; |
| pixOut->m = (val_m > max) ? max : val_m; |
| } |
| |
| |
| pixIn += dxIn, pixOut += dxOut; |
| |
| rayPos.x += rayPosIncrementX, rayPos.y += rayPosIncrementY; |
| |
| |
| if ((yIncrementCounter += ray_final_y) >= yIncrementThreshold) { |
| ++y, pixIn += dyIn, pixOut += dyOut; |
| yIncrementCounter -= yIncrementThreshold; |
| } |
| } |
| } |
| } |
| |
| |
| |
| template <> |
| void performColorRaylit<TPixelF>(TPixelF *bufIn, TPixelF *bufOut, int dxIn, |
| int dyIn, int dxOut, int dyOut, |
| const TRect &srcRect, const TRect &dstRect, |
| const TRop::RaylitParams ¶ms) { |
| |
| float max = TPixelF::maxChannelValue; |
| |
| float val_r, val_g, val_b, val_m; |
| double lightness_r, lightness_g, lightness_b; |
| double factor = max / 255.0; |
| |
| |
| |
| |
| |
| |
| |
| |
| double scale = params.m_scale; |
| double decay = log(params.m_decay / 100.0 + 1.0) + 1.0; |
| double intensity = 1e8 * log(params.m_intensity / 100.0 + 1.0) / scale; |
| double smoothness = log(params.m_smoothness * 5.0 / 100.0 + 1.0); |
| double radius = params.m_radius; |
| |
| double neg_delta_p = |
| smoothness * |
| intensity; |
| double quot_delta_p = intensity / max; |
| |
| |
| |
| int x, y, ray_final_y; |
| int octLx = dstRect.x1 - dstRect.x0; |
| |
| double rayPosIncrementX = 1.0 / scale; |
| |
| double fac, sq_z = sq(params.m_lightOriginSrc.z); |
| |
| |
| |
| |
| TPixelF *pixIn, *pixOut; |
| |
| for (ray_final_y = 0; ray_final_y < octLx; ++ray_final_y) { |
| |
| lightness_r = lightness_g = lightness_b = 0.0; |
| double l, l_max; |
| |
| double rayPosIncrementY = rayPosIncrementX * (ray_final_y / (double)octLx); |
| |
| |
| |
| |
| int yIncrementCounter = 0, yIncrementThreshold = octLx - 1; |
| |
| |
| TPointD rayPos(rayPosIncrementX, rayPosIncrementY); |
| |
| for (x = dstRect.x0, y = dstRect.y0, pixIn = bufIn, pixOut = bufOut; |
| (x < dstRect.x1) && (y < dstRect.y1); ++x) { |
| bool insideSrc = (x >= srcRect.x0) && (x < srcRect.x1) && |
| (y >= srcRect.y0) && (y < srcRect.y1); |
| if (insideSrc) { |
| val_r = pixIn->r; |
| val_g = pixIn->g; |
| val_b = pixIn->b; |
| val_m = pixIn->m; |
| |
| lightness_r = std::max(0.0, val_r ? lightness_r + val_r * quot_delta_p |
| : lightness_r - neg_delta_p); |
| lightness_g = std::max(0.0, val_g ? lightness_g + val_g * quot_delta_p |
| : lightness_g - neg_delta_p); |
| lightness_b = std::max(0.0, val_b ? lightness_b + val_b * quot_delta_p |
| : lightness_b - neg_delta_p); |
| |
| if (!params.m_includeInput) val_r = val_g = val_b = val_m = 0.f; |
| } else { |
| lightness_r = std::max(0.0, lightness_r - neg_delta_p); |
| lightness_g = std::max(0.0, lightness_g - neg_delta_p); |
| lightness_b = std::max(0.0, lightness_b - neg_delta_p); |
| |
| val_r = val_g = val_b = val_m = 0.f; |
| } |
| |
| bool insideDst = (x >= 0) && (y >= 0); |
| if (insideDst) { |
| |
| if (radius == 0.0) { |
| fac = factor / |
| (rayPos.x * |
| pow((double)(sq(rayPos.x) + sq(rayPos.y) + sq_z), decay)); |
| } else { |
| double ratio = std::max(0.001, 1.0 - radius / norm(rayPos)); |
| fac = |
| factor / |
| (rayPos.x * ratio * |
| pow((double)(sq(rayPos.x * ratio) + sq(rayPos.y * ratio) + sq_z), |
| decay)); |
| } |
| |
| |
| |
| |
| |
| |
| val_r += l = fac * lightness_r; |
| l_max = l; |
| val_g += l = fac * lightness_g; |
| l_max = std::max(l, l_max); |
| val_b += l = fac * lightness_b; |
| l_max = std::max(l, l_max); |
| val_m += l_max; |
| |
| pixOut->r = val_r; |
| pixOut->g = val_g; |
| pixOut->b = val_b; |
| pixOut->m = (val_m > max) ? max : val_m; |
| } |
| |
| |
| pixIn += dxIn, pixOut += dxOut; |
| |
| rayPos.x += rayPosIncrementX, rayPos.y += rayPosIncrementY; |
| |
| |
| if ((yIncrementCounter += ray_final_y) >= yIncrementThreshold) { |
| ++y, pixIn += dyIn, pixOut += dyOut; |
| yIncrementCounter -= yIncrementThreshold; |
| } |
| } |
| } |
| } |
| |
| |
| template <typename T> |
| void computeOctant(const TRasterPT<T> &src, const TRasterPT<T> &dst, int octant, |
| const TRop::RaylitParams ¶ms, |
| typename RaylitFuncTraits<T>::function_type raylitFunc) { |
| |
| int x0, x1, lxIn, lxOut, dxIn, dxOut; |
| int y0, y1, lyIn, lyOut, dyIn, dyOut; |
| |
| const T3DPoint &pIn = params.m_lightOriginSrc, |
| &pOut = params.m_lightOriginDst; |
| int srcWrap = src->getWrap(), dstWrap = dst->getWrap(); |
| |
| T *bufIn = (T *)src->getRawData() + tfloor(pIn.y) * srcWrap + tfloor(pIn.x); |
| T *bufOut = |
| (T *)dst->getRawData() + tfloor(pOut.y) * dstWrap + tfloor(pOut.x); |
| |
| TRect srcRect(src->getBounds() + |
| TPoint(tround(pOut.x - pIn.x), tround(pOut.y - pIn.y))); |
| |
| lxIn = src->getLx(), lxOut = dst->getLx(); |
| lyIn = src->getLy(), lyOut = dst->getLy(); |
| |
| |
| |
| if (octant == 1 || octant == 8) |
| dxIn = 1, dxOut = 1, x0 = tfloor(pOut.x), x1 = lxOut; |
| if (octant == 2 || octant == 7) |
| dyIn = 1, dyOut = 1, y0 = tfloor(pOut.x), y1 = lxOut; |
| if (octant == 3 || octant == 6) |
| dyIn = -1, dyOut = -1, y0 = lxOut - tfloor(pOut.x) - 1, y1 = lxOut, |
| std::swap(srcRect.x0, srcRect.x1), srcRect.x0 = lxOut - srcRect.x0, |
| srcRect.x1 = lxOut - srcRect.x1; |
| if (octant == 4 || octant == 5) |
| dxIn = -1, dxOut = -1, x0 = lxOut - tfloor(pOut.x) - 1, x1 = lxOut, |
| std::swap(srcRect.x0, srcRect.x1), srcRect.x0 = lxOut - srcRect.x0, |
| srcRect.x1 = lxOut - srcRect.x1; |
| |
| |
| if (octant == 2 || octant == 3) |
| dxIn = srcWrap, dxOut = dstWrap, x0 = tfloor(pOut.y), x1 = lyOut; |
| if (octant == 1 || octant == 4) |
| dyIn = srcWrap, dyOut = dstWrap, y0 = tfloor(pOut.y), y1 = lyOut; |
| if (octant == 5 || octant == 8) |
| dyIn = -srcWrap, dyOut = -dstWrap, y0 = lyOut - tfloor(pOut.y) - 1, |
| y1 = lyOut, std::swap(srcRect.y0, srcRect.y1), |
| srcRect.y0 = lyOut - srcRect.y0, srcRect.y1 = lyOut - srcRect.y1; |
| if (octant == 6 || octant == 7) |
| dxIn = -srcWrap, dxOut = -dstWrap, x0 = lyOut - tfloor(pOut.y) - 1, |
| x1 = lyOut, std::swap(srcRect.y0, srcRect.y1), |
| srcRect.y0 = lyOut - srcRect.y0, srcRect.y1 = lyOut - srcRect.y1; |
| |
| |
| |
| |
| if (octant == 2 || octant == 3 || octant == 6 || octant == 7) { |
| std::swap(lxIn, lyIn), std::swap(lxOut, lyOut); |
| std::swap(srcRect.x0, srcRect.y0), std::swap(srcRect.x1, srcRect.y1); |
| } |
| |
| int octLx = (x1 - x0), octLy = (y1 - y0); |
| |
| assert(octLx > 0 && octLy > 0); |
| if (octLx <= 0 && octLy <= 0) return; |
| |
| raylitFunc(bufIn, bufOut, dxIn, dyIn, dxOut, dyOut, srcRect, |
| TRect(x0, y0, x1, y1), params); |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| template <typename T> |
| void doRaylit(const TRasterPT<T> &src, const TRasterPT<T> &dst, |
| const TRop::RaylitParams ¶ms, |
| typename RaylitFuncTraits<T>::function_type raylitFunc) { |
| int lxOut = dst->getLx(), lyOut = dst->getLy(); |
| const T3DPoint &p = params.m_lightOriginDst; |
| |
| src->lock(); |
| dst->lock(); |
| |
| |
| if (p.y < lyOut) { |
| if (p.x < lxOut) { |
| |
| computeOctant(src, dst, 1, params, raylitFunc); |
| computeOctant(src, dst, 2, params, raylitFunc); |
| } |
| |
| if (p.x >= 0) { |
| computeOctant(src, dst, 3, params, raylitFunc); |
| computeOctant(src, dst, 4, params, raylitFunc); |
| } |
| } |
| |
| if (p.y >= 0) { |
| if (p.x >= 0) { |
| computeOctant(src, dst, 5, params, raylitFunc); |
| computeOctant(src, dst, 6, params, raylitFunc); |
| } |
| |
| if (p.x < lxOut) { |
| computeOctant(src, dst, 7, params, raylitFunc); |
| computeOctant(src, dst, 8, params, raylitFunc); |
| } |
| } |
| |
| dst->unlock(); |
| src->unlock(); |
| } |
| |
| } |
| |
| |
| |
| |
| |
| void TRop::raylit(const TRasterP &dstRas, const TRasterP &srcRas, |
| const RaylitParams ¶ms) { |
| if ((TRaster32P)dstRas && (TRaster32P)srcRas) |
| doRaylit<TPixel32>(srcRas, dstRas, params, |
| &performStandardRaylit<TPixel32>); |
| else if ((TRaster64P)dstRas && (TRaster64P)srcRas) |
| doRaylit<TPixel64>(srcRas, dstRas, params, |
| &performStandardRaylit<TPixel64>); |
| else if ((TRasterFP)dstRas && (TRasterFP)srcRas) |
| doRaylit<TPixelF>(srcRas, dstRas, params, &performStandardRaylit<TPixelF>); |
| else |
| throw TException("TRop::raylit unsupported pixel type"); |
| } |
| |
| |
| |
| void TRop::glassRaylit(const TRasterP &dstRas, const TRasterP &srcRas, |
| const RaylitParams ¶ms) { |
| if ((TRaster32P)dstRas && (TRaster32P)srcRas) |
| doRaylit<TPixel32>(srcRas, dstRas, params, &performColorRaylit<TPixel32>); |
| else if ((TRaster64P)dstRas && (TRaster64P)srcRas) |
| doRaylit<TPixel64>(srcRas, dstRas, params, &performColorRaylit<TPixel64>); |
| else if ((TRasterFP)dstRas && (TRasterFP)srcRas) |
| doRaylit<TPixelF>(srcRas, dstRas, params, &performColorRaylit<TPixelF>); |
| else |
| throw TException("TRop::raylit unsupported pixel type"); |
| } |
| |