MCPcopy Create free account
hub / github.com/carbonengine/trinity / IsMonochrome

Method IsMonochrome

trinity/Tr2HostBitmap.cpp:624–650  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

622}
623
624bool Tr2HostBitmap::IsMonochrome() const
625{
626 if( !IsValid() || GetBytesPerPixel( m_format ) != 4 || IsCompressed() )
627 {
628 return false;
629 }
630
631 for( uint32_t x = 0; x < m_width; x++ )
632 {
633 for( uint32_t y = 0; y < m_height; y++ )
634 {
635 uint32_t pixval;
636 if( GetPixel( x, y, &pixval ) )
637 {
638 bool matches = true;
639 uint32_t red_val = ( pixval & 0x00FF0000 ) >> 16;
640 matches &= check_chan_value( 0x0000FF00, 8, pixval, red_val );
641 matches &= check_chan_value( 0x000000FF, 0, pixval, red_val );
642 if( !matches )
643 {
644 return false;
645 }
646 }
647 }
648 }
649 return true;
650}
651
652bool Tr2HostBitmap::SetPixel( int x, int y, const void* data )
653{

Callers

nothing calls this directly

Calls 2

check_chan_valueFunction · 0.85
IsValidFunction · 0.70

Tested by

no test coverage detected