Click here to Skip to main content
16,016,623 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Here is my code:
C#
    public Bitmap MakeScreenshot()
    {
        Bitmap Bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
        Graphics Graphics = Graphics.FromImage(Bitmap);
        Graphics.CopyFromScreen(0, 0, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);

        return Bitmap;
    }

    //Reduce Screenshot Method
    public static void ReduceScreenshot(string fileName)
    {
        var bmpSS = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
        var gfxSS = Graphics.FromImage(bmpSS);
        gfxSS.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);

        ColorMatrix colorMatrix = new ColorMatrix(
           new float[][]
           {
               new float[] { 1.5f, 1.5f, 1.5f, 0, 0},
               new float[] { 1.5f,1.5f, 1.5f, 0, 0},
               new float[] {1.5f, 1.5f, 1.5f, 0, 0},
               new float[] {0, 0, 0, 1, 0},
               new float[] {-1, -1, -1, 0, 1}
           });

        ImageAttributes attributes = new ImageAttributes();
        attributes.SetColorMatrix(colorMatrix);
        Rectangle abc= new Rectangle(-783, -383, bmpSS.Width, bmpSS.Height);
        gfxSS.DrawImage(bmpSS, abc, -783, -383, bmpSS.Width, bmpSS.Height, GraphicsUnit.Pixel, attributes);

        bmpSS.Save("ScreenshotGray.png", ImageFormat.Png);
    }

}


It's how it work http://take.ms/6tzvU[^]. How should i change area from rectangle to triangle?
Posted
Updated 17-Sep-15 3:47am
v2

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900