コード例 #1
0
        private static void parseBrush(RdpPacket data, BrushOrder brush, int present)
        {
            if ((present & 1) != 0)
            {
                brush.XOrigin = data.ReadByte();
            }

            if ((present & 2) != 0)
            {
                brush.YOrigin = data.ReadByte();
            }

            if ((present & 4) != 0)
            {
                brush.Style = data.ReadByte();
            }

            byte[] pattern = brush.Pattern;

            if ((present & 8) != 0)
            {
                pattern[0] = (byte)data.ReadByte();
            }

            if ((present & 0x10) != 0)
            {
                for (int i = 1; i < 8; i++)
                {
                    pattern[i] = (byte)data.ReadByte();
                }
            }
        }
コード例 #2
0
        internal static void drawPatBltOrder(int opcode, int x, int y, int cx, int cy, int fgcolor, int bgcolor, BrushOrder brush)
        {
            int num3;
            int boundsRight = (x + cx) - 1;

            if (boundsRight > Options.BoundsRight)
            {
                boundsRight = Options.BoundsRight;
            }
            if (x > Options.BoundsRight)
            {
                x = Options.BoundsRight;
            }
            if (x < Options.BoundsLeft)
            {
                x = Options.BoundsLeft;
            }
            cx = (boundsRight - x) + 1;
            if (cx < 0)
            {
                cx = 0;
            }
            int boundsBottom = (y + cy) - 1;

            if (boundsBottom > Options.BoundsBottom)
            {
                boundsBottom = Options.BoundsBottom;
            }
            if (y > Options.BoundsBottom)
            {
                y = Options.BoundsBottom;
            }
            if (y < Options.BoundsTop)
            {
                y = Options.BoundsTop;
            }
            cy = (boundsBottom - y) + 1;
            if (cy < 0)
            {
                cy = 0;
            }
            ChangedRect.Invalidate(x, y, cx, cy);
            uint[] src = null;
            switch (Brush.Style)
            {
            case 0:
                src = new uint[cx * cy];
                for (num3 = 0; num3 < src.Length; num3++)
                {
                    src[num3] = (uint)fgcolor;
                }
                RasterOp.do_array(opcode, Options.Canvas, Options.Canvas.Width, x, y, cx, cy, src, cx, 0, 0);
                break;

            case 1:
            case 2:
                break;

            case 3:
            {
                int    xOrigin = Brush.XOrigin;
                int    yOrigin = Brush.YOrigin;
                byte[] pattern = Brush.Pattern;
                src = new uint[cx * cy];
                int index = 0;
                for (num3 = 0; num3 < cy; num3++)
                {
                    for (int i = 0; i < cx; i++)
                    {
                        if ((pattern[(num3 + yOrigin) % 8] & (((int)1) << ((i + xOrigin) % 8))) == 0)
                        {
                            src[index] = (uint)fgcolor;
                        }
                        else
                        {
                            src[index] = (uint)bgcolor;
                        }
                        index++;
                    }
                }
                RasterOp.do_array(opcode, Options.Canvas, Options.Canvas.Width, x, y, cx, cy, src, cx, 0, 0);
                return;
            }

            default:
                return;
            }
        }