comparison Core/Images/Font.cpp @ 2853:52b017d22a4f

New URI: "/studies/.../merge" to merge a study
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 02 Oct 2018 17:05:07 +0200
parents 878b59270859
children 668d5ad73c74
comparison
equal deleted inserted replaced
2851:859e880ac9a8 2853:52b017d22a4f
217 217
218 break; 218 break;
219 } 219 }
220 220
221 case PixelFormat_RGBA32: 221 case PixelFormat_RGBA32:
222 case PixelFormat_BGRA32:
222 { 223 {
223 assert(bpp == 4); 224 assert(bpp == 4);
224 225
225 for (unsigned int cx = left; cx < width; cx++, pos++, p += 4) 226 for (unsigned int cx = left; cx < width; cx++, pos++, p += 4)
226 { 227 {
254 int y, 255 int y,
255 const uint8_t color[4]) const 256 const uint8_t color[4]) const
256 { 257 {
257 if (target.GetFormat() != PixelFormat_Grayscale8 && 258 if (target.GetFormat() != PixelFormat_Grayscale8 &&
258 target.GetFormat() != PixelFormat_RGB24 && 259 target.GetFormat() != PixelFormat_RGB24 &&
259 target.GetFormat() != PixelFormat_RGBA32) 260 target.GetFormat() != PixelFormat_RGBA32 &&
261 target.GetFormat() != PixelFormat_BGRA32)
260 { 262 {
261 throw OrthancException(ErrorCode_NotImplemented); 263 throw OrthancException(ErrorCode_NotImplemented);
262 } 264 }
263 265
264 int a = x; 266 int a = x;
309 int y, 311 int y,
310 uint8_t r, 312 uint8_t r,
311 uint8_t g, 313 uint8_t g,
312 uint8_t b) const 314 uint8_t b) const
313 { 315 {
314 uint8_t color[4] = { r, g, b, 255 }; 316 uint8_t color[4];
317
318 switch (target.GetFormat())
319 {
320 case PixelFormat_BGRA32:
321 color[0] = b;
322 color[1] = g;
323 color[2] = r;
324 color[3] = 255;
325 break;
326
327 default:
328 color[0] = r;
329 color[1] = g;
330 color[2] = b;
331 color[3] = 255;
332 break;
333 }
334
315 DrawInternal(target, utf8, x, y, color); 335 DrawInternal(target, utf8, x, y, color);
316 } 336 }
317 337
318 } 338 }