Mercurial > hg > orthanc
comparison Core/Images/ImageProcessing.cpp @ 2495:cd7b854dbc05
convert grayscale16 to bgra32
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 20 Mar 2018 13:26:00 +0100 |
parents | a9459c7d4bc2 |
children | 3d65adee289a |
comparison
equal
deleted
inserted
replaced
2494:771c1c14628c | 2495:cd7b854dbc05 |
---|---|
570 | 570 |
571 return; | 571 return; |
572 } | 572 } |
573 | 573 |
574 if (target.GetFormat() == PixelFormat_BGRA32 && | 574 if (target.GetFormat() == PixelFormat_BGRA32 && |
575 source.GetFormat() == PixelFormat_Grayscale16) | |
576 { | |
577 for (unsigned int y = 0; y < source.GetHeight(); y++) | |
578 { | |
579 const uint16_t* p = reinterpret_cast<const uint16_t*>(source.GetConstRow(y)); | |
580 uint8_t* q = reinterpret_cast<uint8_t*>(target.GetRow(y)); | |
581 for (unsigned int x = 0; x < source.GetWidth(); x++) | |
582 { | |
583 uint8_t value = (*p < 256 ? *p : 255); | |
584 q[0] = value; | |
585 q[1] = value; | |
586 q[2] = value; | |
587 q[3] = 255; | |
588 p += 1; | |
589 q += 4; | |
590 } | |
591 } | |
592 | |
593 return; | |
594 } | |
595 | |
596 if (target.GetFormat() == PixelFormat_BGRA32 && | |
575 source.GetFormat() == PixelFormat_RGB24) | 597 source.GetFormat() == PixelFormat_RGB24) |
576 { | 598 { |
577 for (unsigned int y = 0; y < source.GetHeight(); y++) | 599 for (unsigned int y = 0; y < source.GetHeight(); y++) |
578 { | 600 { |
579 const uint8_t* p = reinterpret_cast<const uint8_t*>(source.GetConstRow(y)); | 601 const uint8_t* p = reinterpret_cast<const uint8_t*>(source.GetConstRow(y)); |