我正在尝试在绿色通道中绘制 2 个矩形 1 在位图的红色通道中绘制第二个矩形。
这是代码:
Bitmap bitmap_guess = new Bitmap(C_PALETTE_X_PIXEL_MAX, C_PALETTE_Y_PIXEL_MAX, PixelFormat.Format24bppRgb);
Graphics graphics = Graphics.FromImage(bitmap_guess);
Rectangle box_rect = new Rectangle(0, 0, C_BOX_PIXELS_WIDTH, C_BOX_PIXELS_HEIGHT);
matrix = new Matrix();
matrix.RotateAt(thc, new System.Drawing.PointF(xc, yc), MatrixOrder.Prepend);
graphics.Transform = matrix;
graphics.FillRectangle(new SolidBrush(Color.Green), xc, yc, box_rect.Width, box_rect.Height);
matrix = new Matrix();
matrix.RotateAt(th, new System.Drawing.PointF(x, y), MatrixOrder.Prepend);
graphics.Transform = matrix;
graphics.FillRectangle(new SolidBrush(Color.Red), x, y, box_rect.Width, box_rect.Height);
问题是,当我用红色绘制第二个矩形时,它会将第一个矩形重叠像素覆盖为 0。我希望矩形在重叠时改变颜色,而不是直接覆盖以前的像素值。IE - 绘制单个通道而不是全部 3。
我专门为此寻找图形操作。
亲切的问候,劳夫