comparison Core/Images/PixelTraits.h @ 2493:5aa787a03e7d

PixelTraits::FloatToPixel for color formats
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 15 Mar 2018 16:17:01 +0100
parents e91bab2d8c75
children 89b789366596
comparison
equal deleted inserted replaced
2492:58c50d627b2f 2493:5aa787a03e7d
188 { 188 {
189 return (a.red_ == b.red_ && 189 return (a.red_ == b.red_ &&
190 a.green_ == b.green_ && 190 a.green_ == b.green_ &&
191 a.blue_ == b.blue_); 191 a.blue_ == b.blue_);
192 } 192 }
193
194 ORTHANC_FORCE_INLINE
195 static void FloatToPixel(PixelType& target,
196 float value)
197 {
198 uint8_t v;
199 PixelTraits<PixelFormat_Grayscale8>::FloatToPixel(v, value);
200
201 target.red_ = v;
202 target.green_ = v;
203 target.blue_ = v;
204 }
193 }; 205 };
194 206
195 207
196 template <> 208 template <>
197 struct PixelTraits<PixelFormat_BGRA32> 209 struct PixelTraits<PixelFormat_BGRA32>
236 return (a.blue_ == b.blue_ && 248 return (a.blue_ == b.blue_ &&
237 a.green_ == b.green_ && 249 a.green_ == b.green_ &&
238 a.red_ == b.red_ && 250 a.red_ == b.red_ &&
239 a.alpha_ == b.alpha_); 251 a.alpha_ == b.alpha_);
240 } 252 }
253
254 ORTHANC_FORCE_INLINE
255 static void FloatToPixel(PixelType& target,
256 float value)
257 {
258 uint8_t v;
259 PixelTraits<PixelFormat_Grayscale8>::FloatToPixel(v, value);
260
261 target.blue_ = v;
262 target.green_ = v;
263 target.red_ = v;
264 target.alpha_ = 255;
265 }
241 }; 266 };
242 } 267 }