diff --git a/Src/libCZI/SingleChannelTileAccessor.cpp b/Src/libCZI/SingleChannelTileAccessor.cpp index 443d7c7d..36da0cf6 100644 --- a/Src/libCZI/SingleChannelTileAccessor.cpp +++ b/Src/libCZI/SingleChannelTileAccessor.cpp @@ -38,9 +38,10 @@ CSingleChannelTileAccessor::CSingleChannelTileAccessor(const std::shared_ptrInternalGet(xPos, yPos, pDest, planeCoordinate, pOptions); + const IntPoint point_raw_sub_block_cs = this->sbBlkRepository->TransformPoint(position, CZIFrameOfReference::RawSubBlockCoordinateSystem).point; + this->InternalGet(point_raw_sub_block_cs.x, point_raw_sub_block_cs.y, pDest, planeCoordinate, pOptions); } void CSingleChannelTileAccessor::ComposeTiles(libCZI::IBitmapData* pBm, int xPos, int yPos, const std::vector& subBlocksSet, const ISingleChannelTileAccessor::Options& options) diff --git a/Src/libCZI/SingleChannelTileAccessor.h b/Src/libCZI/SingleChannelTileAccessor.h index e58da6ce..007550c0 100644 --- a/Src/libCZI/SingleChannelTileAccessor.h +++ b/Src/libCZI/SingleChannelTileAccessor.h @@ -18,7 +18,7 @@ class CSingleChannelTileAccessor : public CSingleChannelAccessorBase, public lib public: // interface ISingleChannelTileAccessor std::shared_ptr Get(const libCZI::IntRectAndFrameOfReference& roi, const libCZI::IDimCoordinate* planeCoordinate, const libCZI::ISingleChannelTileAccessor::Options* pOptions) override; std::shared_ptr Get(libCZI::PixelType pixeltype, const libCZI::IntRectAndFrameOfReference& roi, const libCZI::IDimCoordinate* planeCoordinate, const Options* pOptions) override; - void Get(libCZI::IBitmapData* pDest, int xPos, int yPos, const libCZI::IDimCoordinate* planeCoordinate, const Options* pOptions) override; + void Get(libCZI::IBitmapData* pDest, const libCZI::IntPointAndFrameOfReference& position, const libCZI::IDimCoordinate* planeCoordinate, const Options* pOptions) override; private: void InternalGet(int xPos, int yPos, libCZI::IBitmapData* pBm, const libCZI::IDimCoordinate* planeCoordinate, const libCZI::ISingleChannelTileAccessor::Options* pOptions); void GetAllSubBlocks(const libCZI::IntRect& roi, const libCZI::IDimCoordinate* planeCoordinate, const std::function& appender) const; diff --git a/Src/libCZI/libCZI_Compositor.h b/Src/libCZI/libCZI_Compositor.h index 555bac46..fc152012 100644 --- a/Src/libCZI/libCZI_Compositor.h +++ b/Src/libCZI/libCZI_Compositor.h @@ -221,47 +221,35 @@ namespace libCZI }; public: - virtual std::shared_ptr Get(const libCZI::IntRectAndFrameOfReference& roi, const IDimCoordinate* planeCoordinate, const Options* pOptions) = 0; /// Gets the tile composite of the specified plane and the specified ROI. The pixeltype is - /// determined by examing the first subblock found in the specified plane (which is an + /// determined by examining the first subblock found in the specified plane (which is an /// arbitrary subblock). A newly allocated bitmap is returned. /// - /// \param roi The ROI (given in _raw-subblock-coordinate-system_, c.f. @ref coordinatesystems). + /// \param roi The ROI and the coordinate system it is defined in. /// \param planeCoordinate The plane coordinate. /// \param pOptions Options for controlling the operation. /// /// \returns A std::shared_ptr containing the tile-composite. - /// - /// ### remarks It needs to be defined what is supposed to happen if there is no subblock found - /// in the specified plane. - std::shared_ptr Get(const libCZI::IntRect& roi, const IDimCoordinate* planeCoordinate, const Options* pOptions) - { - return this->Get(libCZI::IntRectAndFrameOfReference{ libCZI::CZIFrameOfReference::RawSubBlockCoordinateSystem, roi }, planeCoordinate, pOptions); - } + virtual std::shared_ptr Get(const libCZI::IntRectAndFrameOfReference& roi, const IDimCoordinate* planeCoordinate, const Options* pOptions) = 0; - virtual std::shared_ptr Get(libCZI::PixelType pixeltype, const libCZI::IntRectAndFrameOfReference& roi, const IDimCoordinate* planeCoordinate, const Options* pOptions) = 0; /// Gets the tile composite of the specified plane and the specified ROI. /// /// \param pixeltype The pixeltype. - /// \param roi The ROI (given in _raw-subblock-coordinate-system_, c.f. @ref coordinatesystems). + /// \param roi The ROI and the coordinate system it is defined in. /// \param planeCoordinate The plane coordinate. /// \param pOptions Options for controlling the operation. /// /// \return A std::shared_ptr containing the tile-composite. - std::shared_ptr Get(libCZI::PixelType pixeltype, const libCZI::IntRect& roi, const IDimCoordinate* planeCoordinate, const Options* pOptions) - { - return this->Get(pixeltype, libCZI::IntRectAndFrameOfReference{ libCZI::CZIFrameOfReference::RawSubBlockCoordinateSystem, roi }, planeCoordinate, pOptions); - } + virtual std::shared_ptr Get(libCZI::PixelType pixeltype, const libCZI::IntRectAndFrameOfReference& roi, const IDimCoordinate* planeCoordinate, const Options* pOptions) = 0; /// Copy the tile composite into the specified bitmap. The bitmap passed in here determines the width and the height of the ROI /// (and the pixeltype). /// /// \param [in] pDest The destination bitmap. - /// \param xPos The x-position of the ROI (width and height are given by pDest) - given in _raw-subblock-coordinate-system_, c.f. @ref coordinatesystems. - /// \param yPos The y-position of the ROI (width and height are given by pDest) - given in _raw-subblock-coordinate-system_, c.f. @ref coordinatesystems. + /// \param position The x-position and y-position of the ROI (width and height are given by pDest), and the coordinate system they are defined in. /// \param planeCoordinate The plane coordinate. /// \param pOptions Options for controlling the operation. - virtual void Get(libCZI::IBitmapData* pDest, int xPos, int yPos, const IDimCoordinate* planeCoordinate, const Options* pOptions) = 0; + virtual void Get(libCZI::IBitmapData* pDest, const IntPointAndFrameOfReference& position, const IDimCoordinate* planeCoordinate, const Options* pOptions) = 0; /// Gets the tile composite of the specified plane and the specified ROI. /// The pixeltype is determined by examining the first subblock found in the @@ -269,25 +257,72 @@ namespace libCZI /// bitmap is returned. /// \param xPos The x-position (given in _raw-subblock-coordinate-system_, c.f. @ref coordinatesystems). /// \param yPos The y-position (given in _raw-subblock-coordinate-system_, c.f. @ref coordinatesystems). - /// \param width The width (given in _raw-subblock-coordinate-system_, c.f. @ref coordinatesystems). - /// \param height The height (given in _raw-subblock-coordinate-system_, c.f. @ref coordinatesystems). + /// \param width The width. + /// \param height The height. /// \param planeCoordinate The plane coordinate. /// \param pOptions Options for controlling the operation. /// \return A std::shared_ptr containing the tile-composite. - inline std::shared_ptr Get(int xPos, int yPos, int width, int height, const IDimCoordinate* planeCoordinate, const Options* pOptions) { return this->Get(libCZI::IntRect{ xPos,yPos,width,height }, planeCoordinate, pOptions); } + std::shared_ptr Get(int xPos, int yPos, int width, int height, const IDimCoordinate* planeCoordinate, const Options* pOptions) + { + return this->Get(libCZI::IntRect{ xPos,yPos,width,height }, planeCoordinate, pOptions); + } /// Gets the tile composite of the specified plane and the specified ROI. /// \param pixeltype The pixeltype. - /// \param xPos The x-position. - /// \param yPos The y-position. + /// \param xPos The x-position (given in _raw-subblock-coordinate-system_, c.f. @ref coordinatesystems). + /// \param yPos The y-position (given in _raw-subblock-coordinate-system_, c.f. @ref coordinatesystems). /// \param width The width. /// \param height The height. /// \param planeCoordinate The plane coordinate. /// \param pOptions Options for controlling the operation. /// \return A std::shared_ptr containing the tile-composite. - inline std::shared_ptr Get(libCZI::PixelType pixeltype, int xPos, int yPos, int width, int height, const IDimCoordinate* planeCoordinate, const Options* pOptions) { return this->Get(pixeltype, libCZI::IntRect{ xPos,yPos,width,height }, planeCoordinate, pOptions); } + std::shared_ptr Get(libCZI::PixelType pixeltype, int xPos, int yPos, int width, int height, const IDimCoordinate* planeCoordinate, const Options* pOptions) + { + return this->Get(pixeltype, libCZI::IntRect{ xPos,yPos,width,height }, planeCoordinate, pOptions); + } + + /// Gets the tile composite of the specified plane and the specified ROI. The pixeltype is + /// determined by examining the first subblock found in the specified plane (which is an + /// arbitrary subblock). A newly allocated bitmap is returned. + /// + /// \param roi The ROI (given in _raw-subblock-coordinate-system_, c.f. @ref coordinatesystems). + /// \param planeCoordinate The plane coordinate. + /// \param pOptions Options for controlling the operation. + /// + /// \returns A std::shared_ptr containing the tile-composite. + std::shared_ptr Get(const libCZI::IntRect& roi, const IDimCoordinate* planeCoordinate, const Options* pOptions) + { + return this->Get(libCZI::IntRectAndFrameOfReference{ libCZI::CZIFrameOfReference::RawSubBlockCoordinateSystem, roi }, planeCoordinate, pOptions); + } + + /// Gets the tile composite of the specified plane and the specified ROI. + /// + /// \param pixeltype The pixeltype. + /// \param roi The ROI (given in _raw-subblock-coordinate-system_, c.f. @ref coordinatesystems). + /// \param planeCoordinate The plane coordinate. + /// \param pOptions Options for controlling the operation. + /// + /// \return A std::shared_ptr containing the tile-composite. + std::shared_ptr Get(libCZI::PixelType pixeltype, const libCZI::IntRect& roi, const IDimCoordinate* planeCoordinate, const Options* pOptions) + { + return this->Get(pixeltype, libCZI::IntRectAndFrameOfReference{ libCZI::CZIFrameOfReference::RawSubBlockCoordinateSystem, roi }, planeCoordinate, pOptions); + } + + /// Copy the tile composite into the specified bitmap. The bitmap passed in here determines the width and the height of the ROI + /// (and the pixeltype). + /// + /// \param [in] pDest The destination bitmap. + /// \param xPos The x-position of the ROI (width and height are given by pDest) - given in _raw-subblock-coordinate-system_, c.f. @ref coordinatesystems. + /// \param yPos The y-position of the ROI (width and height are given by pDest) - given in _raw-subblock-coordinate-system_, c.f. @ref coordinatesystems. + /// \param planeCoordinate The plane coordinate. + /// \param pOptions Options for controlling the operation. + void Get(libCZI::IBitmapData* pDest, int xPos, int yPos, const IDimCoordinate* planeCoordinate, const Options* pOptions) + { + this->Get(pDest, libCZI::IntPointAndFrameOfReference{ libCZI::CZIFrameOfReference::RawSubBlockCoordinateSystem, { xPos, yPos } }, planeCoordinate, pOptions); + } + protected: - virtual ~ISingleChannelTileAccessor() = default; + ~ISingleChannelTileAccessor() override = default; }; /// Interface for single-channel-pyramidlayer tile accessors.