void TRop::over(const TRasterP &out, const TRasterP &dn, const TRasterP &up, const TRasterGR8P &mask) { out->lock(); up->lock(); dn->lock(); TRaster32P out32 = out; TRaster32P dn32 = dn; TRaster32P up32 = up; if (out32 && dn32 && up32) do_over<TPixel32, TPixel32, TPixel32>(out32, dn32, up32, mask); else { TRaster64P out64 = out; TRaster64P dn64 = dn; TRaster64P up64 = up; if (out64 && dn64 && up64) do_over<TPixel64, TPixel64, TPixel64>(out64, dn64, up64, mask); else throw TRopException("unsupported pixel type"); } out->unlock(); up->unlock(); dn->unlock(); }
void TRop::over(const TRasterP &rout, const TRasterP &rdn, const TRasterP &rup) { TRect rect = rout->getBounds() * rdn->getBounds() * rup->getBounds(); if (rect.isEmpty()) return; TRasterP cRout = rout->extract(rect); TRasterP cRdn = rdn->extract(rect); TRasterP cRup = rup->extract(rect); rout->lock(); rdn->lock(); rup->lock(); TRaster32P rout32 = cRout, rdn32 = cRdn, rup32 = cRup; TRaster64P rout64 = cRout, rdn64 = cRdn, rup64 = cRup; if (rout32 && rdn32 && rup32) do_overT3<TPixel32>(rout32, rdn32, rup32); else if (rout64 && rdn64 && rup64) do_overT3<TPixel64>(rout64, rdn64, rup64); else { rout->unlock(); rdn->unlock(); rup->unlock(); throw TRopException("unsupported pixel type"); } rout->unlock(); rdn->unlock(); rup->unlock(); }
void TRop::addBackground(TRasterP ras, const TPixel32 &col) { TRaster32P ras32 = ras; if (ras32) addBackground32(ras32, col); else throw TRopException("unsupported pixel type"); }
bool TRop::isOpaque(TRasterP ras) { TRaster32P ras32 = ras; if (ras32) return isOpaque32(ras32); else if (TRasterGR8P(ras)) return true; else throw TRopException("isOpaque: unsupported pixel type"); }
void TRop::over(const TRasterP &rout, const TRasterP &rup, const TPoint &pos) { TRect outRect(rout->getBounds()); TRect upRect(rup->getBounds() + pos); TRect intersection = outRect * upRect; if (intersection.isEmpty()) return; TRasterP cRout = rout->extract(intersection); TRect r = intersection - pos; TRasterP cRup = rup->extract(r); TRaster32P rout32 = cRout, rup32 = cRup; TRaster64P rout64 = cRout, rup64 = cRup; TRasterGR8P rout8 = cRout, rup8 = cRup; TRasterCM32P routCM32 = cRout, rupCM32 = cRup; rout->lock(); rup->lock(); // TRaster64P rout64 = rout, rin64 = rin; if (rout32 && rup32) { #ifdef _WIN32 if (TSystem::getCPUExtensions() & TSystem::CpuSupportsSse2) do_over_SSE2(rout32, rup32); else #endif do_overT2<TPixel32, UCHAR>(rout32, rup32); } else if (rout64) { if (!rup64) { TRaster64P raux(cRup->getSize()); TRop::convert(raux, cRup); rup64 = raux; } do_overT2<TPixel64, USHORT>(rout64, rup64); } else if (rout32 && rup8) do_over(rout32, rup8); else if (rout8 && rup32) do_over(rout8, rup32); else if (rout8 && rup8) TRop::copy(rout8, rup8); else if (routCM32 && rupCM32) do_over(routCM32, rupCM32); else { rout->unlock(); rup->unlock(); throw TRopException("unsupported pixel type"); } rout->unlock(); rup->unlock(); }
void TRop::gammaCorrect(TRasterP raster, double gamma) { if (gamma <= 0) gamma = 0.01; raster->lock(); if ((TRaster32P)raster) doGammaCorrect<TPixel32, UCHAR>(raster, gamma); else if ((TRaster64P)raster) doGammaCorrect<TPixel64, USHORT>(raster, gamma); else { raster->unlock(); throw TRopException("isOpaque: unsupported pixel type"); } raster->unlock(); }
void TRop::makeStereoRaster(const TRasterP &left, const TRasterP &right) { assert(left->getSize() == right->getSize()); left->lock(); if ((TRaster32P)left && (TRaster32P)right) doMakeStereoRaster<TPixel32>(left, right); else if ((TRaster64P)left && (TRaster64P)right) doMakeStereoRaster<TPixel64>(left, right); else { left->unlock(); throw TRopException("setChannel: unsupported pixel type"); } left->unlock(); }
void TRop::setChannel(const TRasterP &rin, TRasterP rout, UCHAR chan, bool greytones) { assert(rin->getSize() == rout->getSize()); rout->lock(); if ((TRaster32P)rin && (TRaster32P)rout) doSetChannel<TPixel32>(rin, rout, chan, greytones); else if ((TRaster64P)rin && (TRaster64P)rout) doSetChannel<TPixel64>(rin, rout, chan, greytones); else { rout->unlock(); throw TRopException("setChannel: unsupported pixel type"); } rout->unlock(); }
void TRop::gammaCorrectRGBM(TRasterP raster, double gammar, double gammag, double gammab, double gammam) { if (gammar <= 0) gammar = 0.01; if (gammag <= 0) gammag = 0.01; if (gammab <= 0) gammab = 0.01; if (gammam <= 0) gammam = 0.01; raster->lock(); if ((TRaster32P)raster) doGammaCorrectRGBM<TPixel32, UCHAR>(raster, gammar, gammag, gammab, gammam); else if ((TRaster64P)raster) doGammaCorrectRGBM<TPixel64, USHORT>(raster, gammar, gammag, gammab, gammam); else { raster->unlock(); throw TRopException("isOpaque: unsupported pixel type"); } raster->unlock(); }