Summary description for GDI32Brush.
상속: GDIObject
예제 #1
0
        public void RunOnce(GDIRenderer aPort)
        {
            System.Drawing.Point[] points = new Point[10];

            for (int i = 0; i < 10; i++)
            {
                points[i].X = fSize.Width * fFigure[i].X / 200;
                points[i].Y = fSize.Height * fFigure[i].Y / 100;
            }

            // Select a gray brush to draw with
            //aPort.SelectStockObject(GDI32.GRAY_BRUSH);
            GDIBrush aBrush = new GDIBrush(BrushStyle.Solid, HatchStyle.Vertical, RGBColor.Blue, Guid.NewGuid());
            aPort.SetBrush(aBrush);

            // First draw with ALTERNATE method
            aPort.SetPolyFillMode(PolygonFillMode.Alternate);
            aPort.Polygon(points);


            // Translate the x coordinates by half the screen
            for (int i = 0; i < 10; i++)
            {
                points[i].X += fSize.Width / 2;
            }

            // Now draw with WINDING method
            aPort.SetPolyFillMode(PolygonFillMode.Winding);
            aPort.Polygon(points);
        }
예제 #2
0
		public PLCStageBar(string name, int x, int y, int width, int height)
			:base(name, x, y, width, height)
		{
            fBrush = new GDIBrush(BrushStyle.Solid, HatchStyle.Vertical, RGBColor.RGB(238, 238, 238), Guid.NewGuid());

			//fPixmap = Image.FromFile("stagehead.png");
            
            //fPixmap = new PixelBuffer(this.GetType(), "Resources.stagehead.png");
			//fPixmap = new PixelBuffer(this.GetType(), "Resources.stagebar5.png");
			//fPixmap = new PixelBuffer(this.GetType(), "Resources.stageheademf.emf");
        }
예제 #3
0
		public GraphicArrow(string name, int frameLeft, int frameTop, int width, int height,
			uint fillColor, uint borderColor)
            : base(name, frameLeft, frameTop, width, height)
		{
            fPen = new GDIPen(borderColor);
            fBrush = new GDIBrush(BrushStyle.Solid, HatchStyle.Vertical, fillColor, Guid.NewGuid());
            fFillColor = fillColor;
			fBorderColor = borderColor;

			UpdateGeometryState();
        }
예제 #4
0
        public void RunOnce(GDIRenderer aPort)
        {
            // Do some path stuff
            GPath aPath = new GPath();
            
            aPath.Begin();
            aPath.MoveTo(10, 10, false);
            aPath.LineTo(10, 100, false);
            aPath.LineTo(100, 100, true);
            aPath.End();

            GDIBrush pathBrush = new GDIBrush(BrushStyle.Solid, HatchStyle.BDiagonal, RGBColor.Cyan, Guid.NewGuid());
            aPort.FillPath(pathBrush, aPath);

            GDIPen pathPen = new GDIPen(PenType.Geometric, 
                PenStyle.Solid, 
                PenJoinStyle.Round, 
                PenEndCap.Round, 
                RGBColor.Black, 
                10, 
                Guid.NewGuid());
            //aPort.DrawPath(pathPen, aPath);

            // Now use a GDIPath
            aPort.SetBkMode((int)BackgroundMixMode.Transparent);
            aPort.SetTextColor(RGBColor.Black);

            GDIFont aFont = new GDIFont("Impact", 96, Guid.NewGuid());

            GDIContext dc = aPort.DeviceContext;
            GDIPath gdipath = new GDIPath(dc, Guid.NewGuid());
            gdipath.Begin();
            aPort.SetFont(aFont);
            aPort.DrawString(200, 200, "The Scaled Text");
            gdipath.End();
            aPort.Flush();

            // First fill the text
            aPort.FillPath(pathBrush, gdipath);

            // Then stroke the path around it
            GDIPen textPen = new GDIPen(PenType.Geometric,
                PenStyle.Solid,
                PenJoinStyle.Round,
                PenEndCap.Round,
                RGBColor.Black,
                2,
                Guid.NewGuid());
            aPort.DrawPath(textPen, gdipath);
            aPort.Flush();

        }
예제 #5
0
        public void RunOnce(GDIRenderer aPort)
        {
            // Do some region stuff
            GDIRegion aRegion = GDIRegion.CreateFromRectangle(10, 10, 50, 250, Guid.NewGuid());
            GDIRegion bRegion = GDIRegion.CreateFromRectangle(10, 10, 50, 250, Guid.NewGuid());
            GDIRegion cRegion = GDIRegion.CreateFromRectangle(0, 0, 0, 0, Guid.NewGuid());
            GDIRegion dRegion = GDIRegion.CreateFromRectangle(30, 40, 200, 100, Guid.NewGuid());

            bool isEqual = aRegion.Equals(bRegion);

            Rectangle[] rects = aRegion.GetRectangles();

            aRegion.Add(dRegion);
            //aRegion.Subtract(dRegion);
            //aRegion.Intersect(dRegion);

            //RegionCombineType combType = cRegion.Combine(aRegion, dRegion, RegionCombineStyles.OR);
            //RegionCombineType combType = cRegion.Combine(aRegion, dRegion, RegionCombineStyles.XOR);
            //RegionCombineType combType = cRegion.Combine(aRegion, dRegion, RegionCombineStyles.Diff);
            //RegionCombineType combType = cRegion.Combine(aRegion, dRegion, RegionCombineStyles.AND);
            //rects = aRegion.GetRectangles();


            Rectangle frame = aRegion.GetFrame();

            uint colorref = RGBColor.RGB(255, 127, 127);
            GDIBrush newBrush = new GDIBrush(BrushStyle.Solid, HatchStyle.DiagCross, colorref, Guid.NewGuid());
            aPort.SetBrush(newBrush);

            //aPort.FillRegion(aRegion, newBrush);
            //aPort.DrawRegion(aRegion);
            //aPort.FrameRegion(aRegion, newBrush, new Size(1, 1));

            //aPort.SetDefaultBrushColor(RGBColor.Yellow);
            //aPort.FillRegion(cRegion, GDISolidBrush.DeviceContextBrush);

            rects = aRegion.GetRectangles();
            //Random rnd = new Random();

            GDIPen regionPen = new CosmeticPen(PenStyle.Solid, RGBColor.Red, Guid.NewGuid());
            GDISolidBrush regionBrush = new GDISolidBrush(RGBColor.Red);

            // I GraphPort does not have FillRegion yet, so we fake it
            foreach (Rectangle r in rects)
            {
                // Create some random color
                //uint randomcolor = RGBColor.RGB((byte)rnd.Next(0, 255), (byte)rnd.Next(0, 255), (byte)rnd.Next(0, 255));
                //aPort.DrawRectangle(regionPen, r.Left, r.Top, r.Width, r.Height);
                aPort.FillRectangle(regionBrush, r.Left, r.Top, r.Width, r.Height);
            }
        }
예제 #6
0
        public virtual void FillPath(GDIBrush aBrush, GPath aPath)
        {
            // 1. Set the path on the context
            DeviceContext.ReplayPath(aPath);

            // 2. Set the brush as the active brush
            SetBrush(aBrush);

            // 3. call FillPath()
            DeviceContext.FillPath();
        }
예제 #7
0
 public virtual void FillEllipse(GDIBrush aBrush, Rectangle rect)
 {
 }
예제 #8
0
 public static void Pack(BufferChunk chunk, GDIBrush aBrush)
 {
     chunk += GDI32.EMR_CREATEBRUSHINDIRECT;
     chunk += (int)aBrush.Style;
     chunk += (int)aBrush.Hatching;
     chunk += aBrush.Color;
     Pack(chunk, aBrush.UniqueID);
 }
예제 #9
0
        public virtual void SetBrush(GDIBrush aBrush)
        {
            // 1. Check to see if the brush object already exists in our
            // list of objects
            bool containsObject = fObjectDictionary.ContainsKey(aBrush.UniqueID);
            
            // 2. If the object is already in the dictionary, then select
            // it as the current brush and return.
            if (containsObject) // and the object is a brush
            {
                // Get a hold of the actual object in the dictionary
                GDIObject aUniqueObject = fObjectDictionary[aBrush.UniqueID];

                // Select it based on it's handle
                if (aUniqueObject != null)
                    DeviceContext.SelectObject(aUniqueObject);

                return;
            }

            // 3. If the brush is not found, then create a new brush, 
            // and put it into the table.
            CreateBrush(aBrush.Style, aBrush.Hatching, aBrush.Color, aBrush.UniqueID);

            // 4. Select the new brush
            SelectUniqueObject(aBrush.UniqueID);
        }
예제 #10
0
 public virtual void FrameRegion(GDIRegion region, GDIBrush aBrush, Size strokeSize)
 {
     DeviceContext.FrameRegion(region, aBrush, strokeSize);
 }
예제 #11
0
 public virtual void FillRectangle(GDIBrush aBrush, Rectangle rect)
 {
     // fDeviceContext.FillRectangle(aBrush, x, y, width, height);
 }
예제 #12
0
        public virtual void FillEllipse(GDIBrush aBrush, Rectangle rect)
        {
            // 1. Select a null pen so there's no border
            SelectStockObject(GDI32.NULL_PEN);

            // 2. Set the brush
            SetBrush(aBrush);
            
            // 3. Draw the ellipse
            GDI32.Ellipse(DeviceContext, rect.Left, rect.Top, rect.Right, rect.Bottom);
        }
예제 #13
0
 public virtual void FillRegion(GDIRegion region, GDIBrush aBrush)
 {
     bool success = GDI32.FillRgn(this, region, aBrush.DangerousGetHandle());
 }
예제 #14
0
        public virtual void FillRectangle(GDIBrush aBrush, Rectangle aRect)
        {
            SelectStockObject(GDI32.NULL_PEN);

            SetBrush(aBrush);

            DeviceContext.Rectangle(aRect.X, aRect.Y, aRect.Right, aRect.Bottom);
        }
예제 #15
0
        public virtual void FillRectangle(GDIBrush aBrush, int x, int y, int width, int height)
        {
            SelectStockObject(GDI32.NULL_PEN);

            SetBrush(aBrush);

            DeviceContext.Rectangle(x, y, x + width, y + height);
        }
예제 #16
0
        public virtual void StrokeAndFillRectangle(GDIPen aPen, GDIBrush aBrush, Rectangle aRect)
        {
            SaveState();

            // Select the pen and brush into the context
            SetPen(aPen);
            SetBrush(aBrush);

            // Draw the rectangle
            DeviceContext.Rectangle(aRect.Left, aRect.Top, aRect.Right, aRect.Bottom);
            
            ResetState();
        }
예제 #17
0
 public virtual void SetBrush(GDIBrush aBrush)
 {
 }
예제 #18
0
 public virtual void FillPath(GDIBrush aBrush, GPath aPath)
 {
 }
예제 #19
0
 public virtual void FrameRegion(GDIRegion region, GDIBrush aBrush, Size strokeSize)
 {
     bool success = GDI32.FrameRgn(this, region, aBrush.DangerousGetHandle(), strokeSize.Width, strokeSize.Height);
 }
예제 #20
0
        public virtual void DrawPolygon(System.Drawing.Point[] points, GDIPen aPen, GDIBrush aBrush)
        {
            SaveState();

            // Set the brush
            // Set the pen

            // Select the current pen and brush
            TOAPI.Types.POINT[] pts = new POINT[points.Length];
            for (int i = 0; i < pts.Length; i++)
            {
                pts[i].X = points[i].X;
                pts[i].Y = points[i].Y;
            }

            GDI32.Polygon(DeviceContext, pts, pts.Length);

            ResetState();
        }
예제 #21
0
 public virtual void FillRegion(GDIRegion region, GDIBrush aBrush)
 {
     DeviceContext.FillRegion(region, aBrush);
 }
예제 #22
0
 public virtual void SelectObject(GDIBrush aBrush)
 {
 }