Mercurial > hg > orthanc
diff Core/FileFormats/PngReader.h @ 798:e1d27ee2114a
ImageAccessor abstraction
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 06 May 2014 12:52:28 +0200 |
parents | 37adac56017a |
children |
line wrap: on
line diff
--- a/Core/FileFormats/PngReader.h Tue May 06 12:47:26 2014 +0200 +++ b/Core/FileFormats/PngReader.h Tue May 06 12:52:28 2014 +0200 @@ -32,6 +32,8 @@ #pragma once +#include "ImageAccessor.h" + #include "../Enumerations.h" #include <vector> @@ -40,74 +42,6 @@ namespace Orthanc { - class ImageAccessor - { - private: - bool readOnly_; - PixelFormat format_; - unsigned int width_; - unsigned int height_; - unsigned int pitch_; - void *buffer_; - - public: - ImageAccessor() - { - AssignEmpty(PixelFormat_Grayscale8); - } - - bool IsReadOnly() const - { - return readOnly_; - } - - PixelFormat GetFormat() const - { - return format_; - } - - unsigned int GetWidth() const - { - return width_; - } - - unsigned int GetHeight() const - { - return height_; - } - - unsigned int GetPitch() const - { - return pitch_; - } - - const void* GetConstBuffer() const - { - return buffer_; - } - - void* GetBuffer(); - - const void* GetConstRow(unsigned int y) const; - - void* GetRow(unsigned int y); - - void AssignEmpty(PixelFormat format); - - void AssignReadOnly(PixelFormat format, - unsigned int width, - unsigned int height, - unsigned int pitch, - const void *buffer); - - void AssignWritable(PixelFormat format, - unsigned int width, - unsigned int height, - unsigned int pitch, - void *buffer); - }; - - class PngReader : public ImageAccessor { private: