From 93395bd24e21d9555fbe69d7bae89f9e22c49d33 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Tue, 17 Sep 2019 17:21:01 +0300 Subject: [PATCH] genesys: Add wrapper to retrieve raw channel value from image --- backend/genesys_image.cc | 6 ++++++ backend/genesys_image.h | 1 + 2 files changed, 7 insertions(+) diff --git a/backend/genesys_image.cc b/backend/genesys_image.cc index bfeed1a28..7ece725a5 100644 --- a/backend/genesys_image.cc +++ b/backend/genesys_image.cc @@ -83,6 +83,11 @@ RawPixel Image::get_raw_pixel(std::size_t x, std::size_t y) const return get_raw_pixel_from_row(get_row_ptr(y), x, format_); } +std::uint16_t Image::get_raw_channel(std::size_t x, std::size_t y, unsigned channel) const +{ + return get_raw_channel_from_row(get_row_ptr(y), x, channel, format_); +} + void Image::set_raw_pixel(std::size_t x, std::size_t y, const RawPixel& pixel) { set_raw_pixel_to_row(get_row_ptr(y), x, pixel, format_); @@ -93,6 +98,7 @@ void Image::resize(std::size_t width, std::size_t height, PixelFormat format) width_ = width; height_ = height; format_ = format; + row_bytes_ = get_pixel_row_bytes(format_, width_); data_.resize(get_row_bytes() * height); } diff --git a/backend/genesys_image.h b/backend/genesys_image.h index 0dbc6b00c..07dfee3be 100644 --- a/backend/genesys_image.h +++ b/backend/genesys_image.h @@ -65,6 +65,7 @@ public: void set_pixel(std::size_t x, std::size_t y, const Pixel& pixel); RawPixel get_raw_pixel(std::size_t x, std::size_t y) const; + std::uint16_t get_raw_channel(std::size_t x, std::size_t y, unsigned channel) const; void set_raw_pixel(std::size_t x, std::size_t y, const RawPixel& pixel); void resize(std::size_t width, std::size_t height, PixelFormat format);