howto restate this code from php to c#
<p>this script is from <a href="http://groups.google.com/group/jquery-ui-dev/browse_thread/thread/f77dd774a3f6c42?fwc=1" rel="nofollow">here</a>:</p>

<pre><code>$r = /* get R value from querystring */;
$g = /* get G value from querystring */;
$b = /* get B value from querystring *;

$mask = ImageCreateFromPng(/* magical path */);

$w = /* width of the mask */;
$h = /* height of the mask*/;

$im = /* create a new image with width and height of mask */;
imagealphablending($im, true); // ??
imagesavealpha($im, true); // ?

if ($r == 255) {
    $trans = imageColorAllocateAlpha($im, 0, 255, 255, 127); // ?
}
else {
    $trans = imageColorAllocateAlpha($im, 255, 255, 255, 127); // ?
}

imageFill($im, 0, 0, $trans); // fill the whole newly created image with this new color

for ($x = 0; $x &lt; $w; $x++) {
    for ($y = 0; $y &lt; $h; $y++) {
        $index    = imageColorAt($mask, $x, $y); // retrieve the color of the mask
        $maskRgba = imageColorsForIndex($mask, $index); // ?

        if ($maskRgba['red'] == $r
            &amp;&amp; $maskRgba['green'] == $g
            &amp;&amp; $maskRgba['blue'] == $b) {
            continue; // if they all match, continue
        }

        $alpha = 127 - ($maskRgba['red'] / 2); // calculate some alpha

        $color = imageColorAllocateAlpha($im, $r, $g, $b, $alpha); // ?
        imageSetPixel($im, $x, $y, $color);
    }
} 
</code></pre>

<p>now ... basically, all the lines with <code>// ?</code> i'm blank with translating them to c#.</p>

<p>that's where i'm stuck right now (left out <code>using</code>s etc...)</p>

<pre><code>var image = Image.FromFile(fileName); // ImageCreateFromPng
var bitmap = new Bitmap(image);
var canvas = Graphics.FromImage(bitmap);

var color = new Color(...);
var brush = new SolidBrush(color);
canvas.FillRectangle(brush, 0, 0, image.Width, image.Height); // $im instantiation

// ? imagealphablending
// ? imagesavealpha
// ? $trans

for (var rowCounter = 0; rowCounter &lt; image.Height; rowCounter++)
{
    for (var columnCounter = 0; columnCounter &lt; image.Width; columnCounter++)
    {
        var pixel = bitmap.GetPixel(columnCounter, rowCounter);

        // $index = ...
        var pixelR = pixel.R;
        var pixelG = pixel.G;
        var pixelB = pixel.B;

        // $maskRgba ??


        if (pixelR == maskR)
        {
            continue;
        }
        if (pixelG == maskG)
        {
            continue;
        }
        if (pixelB == maskB)
        {
            continue;
        }

        var alpha = 127 - pixelR / 2;

        pixel = Color.FromArgb(alpha, pixelR, pixelG, pixelB);
        bitmap.SetPixel(columnCounter, rowCounter, pixel);
    }
}
</code></pre>
