# HG changeset patch # User Sebastien Jodogne # Date 1726055019 -7200 # Node ID f611fb47d0e8e0e9e5bb86a0d692b67549864741 # Parent 51ef122c1882281010f62c4b9d30a4f35041b975 reuse base class members in OpenSlidePyramid diff -r 51ef122c1882 -r f611fb47d0e8 Framework/Inputs/OpenSlidePyramid.cpp --- a/Framework/Inputs/OpenSlidePyramid.cpp Mon Sep 09 20:13:36 2024 +0200 +++ b/Framework/Inputs/OpenSlidePyramid.cpp Wed Sep 11 13:43:39 2024 +0200 @@ -55,6 +55,10 @@ source->GetFormat() == Orthanc::PixelFormat_BGRA32) { // Implements alpha blending: https://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending + + uint8_t backgroundRed, backgroundGreen, backgroundBlue; + GetBackgroundColor(backgroundRed, backgroundGreen, backgroundBlue); + for (unsigned int y = 0; y < height; y++) { const uint8_t* p = reinterpret_cast(source->GetConstRow(y)); @@ -71,9 +75,9 @@ **/ uint16_t alpha = p[3]; - q[0] = static_cast(((255 - alpha) * backgroundColor_[0] + alpha * p[2]) / 255); - q[1] = static_cast(((255 - alpha) * backgroundColor_[1] + alpha * p[1]) / 255); - q[2] = static_cast(((255 - alpha) * backgroundColor_[2] + alpha * p[0]) / 255); + q[0] = static_cast(((255 - alpha) * backgroundRed + alpha * p[2]) / 255); + q[1] = static_cast(((255 - alpha) * backgroundGreen + alpha * p[1]) / 255); + q[2] = static_cast(((255 - alpha) * backgroundBlue + alpha * p[0]) / 255); p += 4; q += 3; @@ -94,9 +98,6 @@ tileWidth_(tileWidth), tileHeight_(tileHeight) { - backgroundColor_[0] = 255; - backgroundColor_[1] = 255; - backgroundColor_[2] = 255; } @@ -122,14 +123,4 @@ return false; } } - - - void OpenSlidePyramid::SetBackgroundColor(uint8_t red, - uint8_t green, - uint8_t blue) - { - backgroundColor_[0] = red; - backgroundColor_[1] = green; - backgroundColor_[2] = blue; - } } diff -r 51ef122c1882 -r f611fb47d0e8 Framework/Inputs/OpenSlidePyramid.h --- a/Framework/Inputs/OpenSlidePyramid.h Mon Sep 09 20:13:36 2024 +0200 +++ b/Framework/Inputs/OpenSlidePyramid.h Wed Sep 11 13:43:39 2024 +0200 @@ -34,7 +34,6 @@ OpenSlideLibrary::Image image_; unsigned int tileWidth_; unsigned int tileHeight_; - uint8_t backgroundColor_[3]; protected: virtual void ReadRegion(Orthanc::ImageAccessor& target, @@ -84,9 +83,5 @@ bool LookupImagedVolumeSize(float& width, float& height) const; - - void SetBackgroundColor(uint8_t red, - uint8_t green, - uint8_t blue); }; }