public void lineTo(Point Point, Model.Canvas Canvas) { if (Canvas.isLineInClippingArea(Point)) { int x, y, t, deltaX, deltaY, incrementX, incrementY, pdx, pdy, ddx, ddy, es, el, err; deltaX = Point.X - Canvas.getPencil().getPosition().X; deltaY = Point.Y - Canvas.getPencil().getPosition().Y; incrementX = Math.Sign(deltaX); incrementY = Math.Sign(deltaY); if (deltaX < 0) { deltaX = -deltaX; } if (deltaY < 0) { deltaY = -deltaY; } if (deltaX > deltaY) { pdx = incrementX; pdy = 0; ddx = incrementX; ddy = incrementY; es = deltaY; el = deltaX; } else { pdx = 0; pdy = incrementY; ddx = incrementX; ddy = incrementY; es = deltaX; el = deltaY; } x = Canvas.getPencil().getPosition().X; y = Canvas.getPencil().getPosition().Y; err = el / 2; this.point(new Model.Pixel(new Point(x, y), Canvas.getColor()), Canvas); for (t = 0; t < el; ++t) { err -= es; if (err < 0) { err += el; x += ddx; y += ddy; } else { x += pdx; y += pdy; } this.point(new Model.Pixel(new Point(x, y), Canvas.getColor()), Canvas); } } else { moveTo(Point, Canvas); } }
private Model.Pixel getAbsolutePixel(Model.Pixel Pixel, Model.Canvas Canvas) { int x = Canvas.getPencil().getPosition().X + Pixel.getPosition().X; int y = Canvas.getPencil().getPosition().Y + Pixel.getPosition().Y; Pixel.setPosition(new Point(x, y)); return(Pixel); }
public void text(string text, Model.Canvas Canvas, Model.Font Font) { char[] chars = text.ToCharArray(); Point PencilStartPosition = Canvas.getPencil().getPosition(); for (int i = 0; i < chars.Length; i++) { if (i != 0) { moveTo(new Point((i * Font.getDimension().width + PencilStartPosition.X), PencilStartPosition.Y), Canvas); } bitmap(Font.getGlyph(chars[i]), Canvas); } }
public void moveTo(Point Point, Model.Canvas Canvas) { Canvas.getPencil().setPosition(Point); }