GSI

Panel에 두장의 이미지(Bitmap)를 추가한 후에
위의 이미지에 알파값을 추가해서 블랜딩 효과를 줘봤습니다.

사용자 삽입 이미지


코드는 아래와 같아요..


        private void panel_before_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            g.DrawImage(beforeLeftImage, new PointF(0, 0));

            float[][] ptsArray =
            {
                new float[] { 1, 0, 0, 0, 0},
                new float[] { 0, 1, 0, 0, 0},
                new float[] { 0, 0, 1, 0, 0},
                new float[] { 0, 0, 0, 0.7f, 0},
                new float[] { 0, 0, 0, 0, 1}
            };

            ColorMatrix clrMatrix = new ColorMatrix(ptsArray);
            ImageAttributes imageAtrr = new ImageAttributes();
            imageAtrr.SetColorMatrix(clrMatrix,
                ColorMatrixFlag.Default,
                ColorAdjustType.Bitmap);

            g.DrawImage(beforeXrayLeftIamge,
                new Rectangle(50, 50, beforeXrayLeftIamge.Width, beforeXrayLeftIamge.Height),
                0, 0, beforeXrayLeftIamge.Width, beforeXrayLeftIamge.Height,
                GraphicsUnit.Pixel,
                imageAtrr);

        }

Posted by gsi
: