Methods
  • Scale(float scaleRed, float scaleGreen, float scaleBlue, float scaleOpacity) - Scale the RGB and opacity to the provided values
  • ScaleColors(float scaleRed, float scaleGreen, float scaleBlue) - Scale just the RGB values keeping the opacity constant
  • ScaleOpacity(float scale) - Scale just the opacity keeping the colors constant
  • ScaleValue(float scale) - Scale all RGB values simultaniusly
  • RotateHue(float phi) - Rotate the hue
  • SetSaturation(float saturation) - Set the saturation to the provided value
  • RotateRed(float phi, MatrixOrder order) - Rotate red according to the hue
  • RotateGreen(float phi, MatrixOrder order) - Rotate green according to the hue
  • RotateBlue(float phi, MatrixOrder order) - Rotate blue according to the hue
  • SetBrightness(float brightness) - Sets a new brightnrss value
  • SetContrast(float contrast) - Sets a new contrast value

Examples

Use the ColorMatrix in the Paint event to filter RGB and HSV values of the image
private void pnlCanvas_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
    // Create the color matrix and set the appropriate values
    Rtw.ColorMatrix clrMtx = new Rtw.ColorMatrix();
    clrMtx.SetSaturation(sat);
    clrMtx.RotateHue(hue);
    clrMtx.ScaleValue(val);
    clrMtx.ScaleColors(red, green, blue);

    // Set the color matrix to the image attributes
    ImageAttributes ima = new ImageAttributes();
    ima.SetColorMatrix(clrMtx);

    // Draw the image on the canvas with the provided image attributes
    e.Graphics.DrawImage(mainImage, new Rectangle(0, 0, pnlCanvas.Width, pnlCanvas.Height), 0, 0, pnlCanvas.Width, pnlCanvas.Height, GraphicsUnit.Pixel, ima);
}

Last edited Mar 23, 2014 at 11:26 AM by rajithaw, version 5