Exemple #1
0
        /// <summary>
        /// Draw filled primitive onto surface
        /// </summary>
        /// <param name="surface">Surface to draw to</param>
        /// <param name="color">Color to fill primitive</param>
        /// <param name="antiAlias">antialias primitive</param>
        /// <param name="fill">fill primitive with color</param>
        public void Draw(Surface surface, System.Drawing.Color color, bool antiAlias, bool fill)
        {
            if (surface == null)
            {
                throw new ArgumentNullException("surface");
            }
            if (fill)
            {
                int result = SdlGfx.boxRGBA(
                    surface.Handle, this.XPosition1, this.YPosition1,
                    this.XPosition2, this.YPosition2,
                    color.R, color.G, color.B,
                    color.A);
                GC.KeepAlive(this);
                if (result != (int)SdlFlag.Success)
                {
                    throw SdlException.Generate();
                }
            }
            else
            {
                int result = SdlGfx.rectangleRGBA(
                    surface.Handle, this.XPosition1, this.YPosition1,
                    this.XPosition2, this.YPosition2,
                    color.R, color.G, color.B,
                    color.A);
                GC.KeepAlive(this);

                if (result != (int)SdlFlag.Success)
                {
                    throw SdlException.Generate();
                }
            }
        }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="r"></param>
 /// <param name="c"></param>
 public void DrawBox(Rectangle r, Color c)
 {
     /*surface.Draw(new SdlDotNet.Graphics.Primitives.Box((short)r.Left,
      *                                              (short)r.Top,
      *                                              (short)r.Right,
      *                                              (short)r.Bottom), c);*/
     //SdlGfx.boxColor(this.surfacePtr(),(short)r.X,(short)r.Y,(short)(r.X+r.Width),(short)(r.Y+r.Height),Sdl.SDL_MapRGB(this.surface.format,c.R,c.G,c.B));
     SdlGfx.rectangleRGBA(this.SurfacePtr(), (short)r.X, (short)r.Y, (short)(r.X + r.Width), (short)(r.Y + r.Height), c.R, c.G, c.B, 255);
 }
Exemple #3
0
        public void rectangleRGBA()
        {
            this.InitSdl();

            //Random rand = new Random();
            int result = SdlGfx.rectangleRGBA(surfacePtr, 100, 200, 300, 300, 200, 0, (byte)0, 254);

            result = Sdl.SDL_Flip(surfacePtr);
            Thread.Sleep(sleepTime);
            Assert.AreEqual(result, 0);
            this.Quit();
        }
Exemple #4
0
 public static void DrawSquare(short x, short y, short x2, short y2, byte r, byte g,
                               byte b, byte alpha)
 {
     SdlGfx.rectangleRGBA(screen, x, y, x2, y2, r, g, b, alpha);
     Hardware.UpdateScreen();
 }
Exemple #5
0
 public static void RectanguloRGBA(short x1, short y1, short x2, short y2,
                                   byte r, byte g, byte b, byte a)
 {
     SdlGfx.rectangleRGBA(pantallaOculta,
                          x1, y1, x2, y2, r, g, b, a);
 }