/// <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 (antiAlias) { int result = SdlGfx.aalineRGBA( 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.lineRGBA( 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(); } } }
public void lineRGBA() { this.InitSdl(); //Random rand = new Random(); int result = SdlGfx.lineRGBA(surfacePtr, 100, 200, 300, 300, 200, 0, (byte)0, 254); result = Sdl.SDL_Flip(surfacePtr); Thread.Sleep(sleepTime); Assert.AreEqual(result, 0); this.Quit(); }
// Writes a line in the specified coordinates, with the specified color and alpha public void DrawLine(short x, short y, short x2, short y2, byte r, byte g, byte b, byte alpha) { SdlGfx.lineRGBA(screen, x, y, x2, y2, r, g, b, alpha); }