Jump to content

How-to swap channels ?


Recommended Posts

Yeah, and so would this CodeLab script:

void Render(Surface dst, Surface src, Rectangle rect)
{
   ColorBgra CurrentPixel;
   for (int y = rect.Top; y     {
       for (int x = rect.Left; x         {
           CurrentPixel = src[x,y];
           byte tempR = CurrentPixel.R;
           CurrentPixel.R = CurrentPixel.B;
           CurrentPixel.B = tempR;
           dst[x,y] = CurrentPixel;
       }
   }
}

Link to comment
Share on other sites

Yeah, and so would this CodeLab script:

void Render(Surface dst, Surface src, Rectangle rect)
{
   ColorBgra CurrentPixel;
   for (int y = rect.Top; y < rect.Bottom; y++)
   {
       for (int x = rect.Left; x < rect.Right; x++)
       {
           CurrentPixel = src[x,y];
           byte tempR = CurrentPixel.R;
           CurrentPixel.R = CurrentPixel.B;
           CurrentPixel.B = tempR;
           dst[x,y] = CurrentPixel;
       }
   }
}

Hey, that's kinda like a bubble sort!

 

Take responsibility for your own intelligence. 😉 -Rick Brewster

Link to comment
Share on other sites

Yeah, and so would this CodeLab script:

void Render(Surface dst, Surface src, Rectangle rect)
{
   ColorBgra CurrentPixel;
   for (int y = rect.Top; y     {
       for (int x = rect.Left; x         {
           CurrentPixel = src[x,y];
           byte tempR = CurrentPixel.R;
           CurrentPixel.R = CurrentPixel.B;
           CurrentPixel.B = tempR;
           dst[x,y] = CurrentPixel;
       }
   }
}

Hey, that's kinda like a bubble sort!

Only in Bizzaro world.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...