# Why aint this breaking?

## Recommended Posts

EDIT: Nevermind...I see why...but can someone tell me why that at all values of val other than 0, it returns zeros to the col2.A, R, B, and G?

```void Render(Surface dst, Surface src, Rectangle rect)
{
Rectangle selection = this.EnvironmentParameters.GetSelection(dst.Bounds).GetBoundsInt();
int ceiling = selection.Bottom;
int val=0; //TO be TOKEN'd
ColorBgra col2 = src[1, 1]; //get a guaranteed base
ColorBgra col = src[1, 1]; //get a guaranteed base
col.A=0; //token
col.R=255; //token
col.B=255; //token
col.G=255; //token
for(int y = rect.Top; y < rect.Bottom; y++)
{
for (int x = rect.Left; x < rect.Right; x++)
{
dst[x, y] = col;
if (y+(x / val) < ceiling) {
double val2 = (y+(x / val));
double tpx = Math.Floor(val2);
double bpx = Math.Ceiling(val2);
double topmean = (val2 - tpx);
double bottommean = (bpx - val2);
double tA = (double)(src[x, (int)(tpx)].A);
double tR = (double)(src[x, (int)(tpx)].R);
double tB = (double)(src[x, (int)(tpx)].;
double tG = (double)(src[x, (int)(tpx)].G);
double bA = (double)(src[x, (int)(bpx)].A);
double bR = (double)(src[x, (int)(bpx)].R);
double bB = (double)(src[x, (int)(bpx)].;
double bG = (double)(src[x, (int)(bpx)].G);
tA *= topmean;
tR *= topmean;
tB *= topmean;
tG *= topmean;
bA *= bottommean;
bR *= bottommean;
bB *= bottommean;
bG *= bottommean;
tA += bA;
tR += bR;
tB += bB;
tG += bG;
col2.A = (byte)(Math.Round(tA));
col2.R = (byte)(Math.Round(tR));
col2.B = (byte)(Math.Round(tB));
col2.G = (byte)(Math.Round(tG));
dst[x, y] = col2;

//dst[x, y] = src[x, y+(x/val)];
}
}
}
}
```

I'm new to this.

At least tell me why it's returning zeroes.

~~

##### Share on other sites

Hey, I'm dumb!!!

Just a note to beginners: get your value types right.

~~

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account. ×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×
×