public void desenha(Bitmap img) { if (pAtual.Count > 1) { for (int i = 0; i < pAtual.Count - 1; i++) { Reta.pontoMedio(pAtual[i].X, pAtual[i].Y, pAtual[i + 1].X, pAtual[i + 1].Y, img, borda); } Reta.pontoMedio(pAtual[pAtual.Count - 1].X, pAtual[pAtual.Count - 1].Y, pAtual[0].X, pAtual[0].Y, img, borda); Point c = getCentroAtual(); //Preenchimento.scanLine(c.X,c.Y,img,fundo,this); } }
private void desenha(Bitmap bmp, int x, int y) { xf = x; yf = y; if (xi < 0 || yi < 0 || xf < 0 || yf < 0 || xi > bmp.Width || xf > bmp.Width || yi > bmp.Height || yf > bmp.Height) { return; } switch (opcao) { case 1: Reta.equacaoGeral(xi, yi, xf, yf, bmp, cor); break; case 2: Reta.DDA(xi, yi, xf, yf, bmp, cor); break; case 3: Reta.pontoMedio(xi, yi, xf, yf, bmp, cor); break; case 4: Circunferencia.equacaoGeral(xi, yi, xf, yf, bmp, cor); break; case 5: Circunferencia.trigonometrica(xi, yi, xf, yf, bmp, cor); break; case 6: Circunferencia.pontoMedio(xi, yi, xf, yf, bmp, cor); break; case 7: Elipse.pontoMedio(xi, yi, xf, yf, bmp, cor); break; case 8: Preenchimento.floodFill(xf, yf, bmp, cor); break; case 9: if (poligonos.Count > 0) { Poligono click = poligonos[0]; foreach (Poligono p in poligonos) { if (p.getDistanciaClick(xf, yf) < click.getDistanciaClick(xf, yf)) { click = p; } } Preenchimento.scanLine(xf, yf, bmp, cor, click); } break; case 10: Reta.pontoMedio(xi, yi, xf, yf, bmp, cor); break; } pictureBox.Image = bmp; }