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

abi continued
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 05 Nov 2020 19:33:18 +0100
parents bf7b9edf6b81
children 50b0c69b653a
comparison
equal deleted inserted replaced
4299:3f85db78c441 4300:b30a8de92ad9
86 SetWidth(width); 86 SetWidth(width);
87 SetHeight(height); 87 SetHeight(height);
88 SetFormat(format); 88 SetFormat(format);
89 } 89 }
90 90
91 ImageBuffer::ImageBuffer()
92 {
93 Initialize();
94 }
95
96 ImageBuffer::~ImageBuffer()
97 {
98 Deallocate();
99 }
100
101 PixelFormat ImageBuffer::GetFormat() const
102 {
103 return format_;
104 }
105
91 106
92 void ImageBuffer::Initialize() 107 void ImageBuffer::Initialize()
93 { 108 {
94 changed_ = false; 109 changed_ = false;
95 forceMinimalPitch_ = true; 110 forceMinimalPitch_ = true;
108 changed_ = true; 123 changed_ = true;
109 format_ = format; 124 format_ = format;
110 } 125 }
111 } 126 }
112 127
128 unsigned int ImageBuffer::GetWidth() const
129 {
130 return width_;
131 }
132
113 133
114 void ImageBuffer::SetWidth(unsigned int width) 134 void ImageBuffer::SetWidth(unsigned int width)
115 { 135 {
116 if (width != width_) 136 if (width != width_)
117 { 137 {
118 changed_ = true; 138 changed_ = true;
119 width_ = width; 139 width_ = width;
120 } 140 }
121 } 141 }
122 142
143 unsigned int ImageBuffer::GetHeight() const
144 {
145 return height_;
146 }
147
123 148
124 void ImageBuffer::SetHeight(unsigned int height) 149 void ImageBuffer::SetHeight(unsigned int height)
125 { 150 {
126 if (height != height_) 151 if (height != height_)
127 { 152 {
128 changed_ = true; 153 changed_ = true;
129 height_ = height; 154 height_ = height;
130 } 155 }
156 }
157
158 unsigned int ImageBuffer::GetBytesPerPixel() const
159 {
160 return ::Orthanc::GetBytesPerPixel(format_);
131 } 161 }
132 162
133 163
134 void ImageBuffer::GetReadOnlyAccessor(ImageAccessor& accessor) 164 void ImageBuffer::GetReadOnlyAccessor(ImageAccessor& accessor)
135 { 165 {
140 170
141 void ImageBuffer::GetWriteableAccessor(ImageAccessor& accessor) 171 void ImageBuffer::GetWriteableAccessor(ImageAccessor& accessor)
142 { 172 {
143 Allocate(); 173 Allocate();
144 accessor.AssignWritable(format_, width_, height_, pitch_, buffer_); 174 accessor.AssignWritable(format_, width_, height_, pitch_, buffer_);
175 }
176
177 bool ImageBuffer::IsMinimalPitchForced() const
178 {
179 return forceMinimalPitch_;
145 } 180 }
146 181
147 182
148 void ImageBuffer::AcquireOwnership(ImageBuffer& other) 183 void ImageBuffer::AcquireOwnership(ImageBuffer& other)
149 { 184 {