Jump to content

Coding help needed


Bleek II

Recommended Posts

Hi, I need help with a number of issues. First I'd like to say that I have looked a large amount of sample code and have not been able to find the answers.

I have a loop like this

    ColorBgra CP;
   for(int y = rect.Top; y < rect.Bottom; y++)
   {
       for (int x = rect.Left; x < rect.Right; x++)
       { 
         CP.R = ????????????????????;
           dst[x, y] = src.GetBilinearSample(
               x+CP.R,
               y+CP.R,
               true
           );

In place of the ??????????? I want to assign the Red value of the current pixel that I'm working on.

Even better yet the it's brightness; I just used red because I'm working with BW images.

I'm have only used c++ in the past so this a little harder to learn for me.

Link to comment
Share on other sites

yes but you need to give CP a value first, I think!

void Render(Surface dst, Surface src, Rectangle rect)
{
  ColorBgra CP;
  for(int y = rect.Top; y < rect.Bottom; y++)
   {
       for (int x = rect.Left; x < rect.Right; x++)
       { 
         // give a value to the pixel (not only the red chanel)
         CP = src[x,y];

         // then you could use any chanel of CP as you need!
         dst[x, y] = src.GetBilinearSample(x+CP.R, y+CP.R, true );
       }
  }
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...