37    bool hasAlpha = img.HasAlpha();
 
   40    for( 
int y = 0; y < img.GetHeight(); y++ )
 
   42        for( 
int x = 0; x < img.GetWidth(); x++ )
 
   44            int r = img.GetRed( x, y );
 
   45            int g = img.GetGreen( x, y );
 
   46            int b = img.GetBlue( x, y );
 
   47            int a = hasAlpha ? img.GetAlpha( x, y ) : 255;
 
   50            r = std::min( r >> roundBits << roundBits, 0xFF );
 
   51            g = std::min( g >> roundBits << roundBits, 0xFF );
 
   52            b = std::min( b >> roundBits << roundBits, 0xFF );
 
   53            a = std::min( a >> roundBits << roundBits, 0xFF );
 
   55            img.SetRGB( x, y, r, g, b );
 
   58                img.SetAlpha( x, y, a );
 
   62    std::unordered_map<uint32_t, SHAPE_POLY_SET> colorPolys;
 
   65    for( 
int y = 0; y < img.GetHeight(); y++ )
 
   67        for( 
int x = 0; x < img.GetWidth(); x++ )
 
   69            uint32_t r = img.GetRed( x, y );
 
   70            uint32_t g = img.GetGreen( x, y );
 
   71            uint32_t b = img.GetBlue( x, y );
 
   72            uint32_t a = hasAlpha ? img.GetAlpha( x, y ) : 255;
 
   76                uint32_t 
color = r | ( g << 8 ) | ( b << 16 ) | ( a << 24 );
 
   81                chain.Append( x * pixelScale.
x, y * pixelScale.
y, 
true );
 
   82                chain.Append( ( x + 1 ) * pixelScale.
x, y * pixelScale.
y, 
true );
 
   83                chain.Append( ( x + 1 ) * pixelScale.
x, ( y + 1 ) * pixelScale.
y, 
true );
 
   84                chain.Append( x * pixelScale.
x, ( y + 1 ) * pixelScale.
y, 
true );
 
   85                chain.SetClosed( 
true );
 
   92    for( 
auto& [
color, polySet] : colorPolys )
 
   96        for( 
int i = 0; i < polySet.OutlineCount(); i++ )
 
 
  112    std::unordered_map<uint32_t, SHAPE_POLY_SET> colorPolys =
 
  115    for( 
auto& [
color, polySet] : colorPolys )
 
  123            shape->SetPolyShape( poly );
 
  125            int r = 
color & 0xFF;
 
  126            int g = ( 
color >> 8 ) & 0xFF;
 
  127            int b = ( 
color >> 16 ) & 0xFF;
 
  128            int a = ( 
color >> 24 ) & 0xFF;
 
  130            shape->SetWidth( -1 );
 
  132            shape->SetFillColor( 
COLOR4D( r / 255.0, g / 255.0, b / 255.0, a / 255.0 ) );
 
  134            shape->SetUnit( unit );
 
  136            shape->Move( offset );