comparison OrthancFramework/Sources/Images/ImageAccessor.cpp @ 4300:b30a8de92ad9

abi continued
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 05 Nov 2020 19:33:18 +0100
parents 9279de56a405
children d9473bd5ed43
comparison
equal deleted inserted replaced
4299:3f85db78c441 4300:b30a8de92ad9
96 target.AddChunk("], [ 3 " + boost::lexical_cast<std::string>(height) + 96 target.AddChunk("], [ 3 " + boost::lexical_cast<std::string>(height) +
97 " " + boost::lexical_cast<std::string>(width) + " ]), [ 3 2 1 ]))"); 97 " " + boost::lexical_cast<std::string>(width) + " ]), [ 3 2 1 ]))");
98 } 98 }
99 99
100 100
101 ImageAccessor::ImageAccessor()
102 {
103 AssignEmpty(PixelFormat_Grayscale8);
104 }
105
106 ImageAccessor::~ImageAccessor()
107 {
108 }
109
110 bool ImageAccessor::IsReadOnly() const
111 {
112 return readOnly_;
113 }
114
115 PixelFormat ImageAccessor::GetFormat() const
116 {
117 return format_;
118 }
119
120 unsigned int ImageAccessor::GetBytesPerPixel() const
121 {
122 return ::Orthanc::GetBytesPerPixel(format_);
123 }
124
125 unsigned int ImageAccessor::GetWidth() const
126 {
127 return width_;
128 }
129
130 unsigned int ImageAccessor::GetHeight() const
131 {
132 return height_;
133 }
134
135 unsigned int ImageAccessor::GetPitch() const
136 {
137 return pitch_;
138 }
139
140 unsigned int ImageAccessor::GetSize() const
141 {
142 return GetHeight() * GetPitch();
143 }
144
145 const void *ImageAccessor::GetConstBuffer() const
146 {
147 return buffer_;
148 }
149
101 void* ImageAccessor::GetBuffer() 150 void* ImageAccessor::GetBuffer()
102 { 151 {
103 if (readOnly_) 152 if (readOnly_)
104 { 153 {
105 throw OrthancException(ErrorCode_ReadOnly, 154 throw OrthancException(ErrorCode_ReadOnly,
170 { 219 {
171 throw OrthancException(ErrorCode_ParameterOutOfRange); 220 throw OrthancException(ErrorCode_ParameterOutOfRange);
172 } 221 }
173 } 222 }
174 223
224 void ImageAccessor::GetReadOnlyAccessor(ImageAccessor &target) const
225 {
226 target.AssignReadOnly(format_, width_, height_, pitch_, buffer_);
227 }
228
175 229
176 void ImageAccessor::AssignWritable(PixelFormat format, 230 void ImageAccessor::AssignWritable(PixelFormat format,
177 unsigned int width, 231 unsigned int width,
178 unsigned int height, 232 unsigned int height,
179 unsigned int pitch, 233 unsigned int pitch,