Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Gráficos (https://www.clubdelphi.com/foros/forumdisplay.php?f=8)
-   -   Rellenos Bezier (https://www.clubdelphi.com/foros/showthread.php?t=81754)

MArkdc 14-12-2012 04:13:11

Rellenos Bezier
 
Hola que tal. Soy estudiante de universidad y nos dejaron un proyecto de graficos en delphi, yo use en particular el codigo de bezier para crear la figura pero tengo un problema que es el relleno del bezier e intentado rellenarlo con el canvas.floodfill pero se colorea todo el image. Además intente realizar un ciclo for anidado que rellene el bezier pero tampoco funciona muy bien.

Me gustaria saber si existe o no algun metodo de rellenar bezier y como se hace. Agradecería mucho su ayuda con este tema.

Gracias por su atención y espero su respuesta.

ecfisa 14-12-2012 05:26:29

Hola MArkdc, bienvenido a Club Delphi :)

Como a todos los que se inician te invitamos a que leas nuestra guía de estilo.

Sobre tu consulta, revisa el mensaje #2 de este [ hilo ].

Saludos.

rounin 14-12-2012 10:17:45

Yo hago eso usando FillPath
(BeginPath, PolyBezierTo, CloseFigure, EndPath, FillPath)

Ejemplo de mi libreria

Código Delphi [-]
 
procedure TRBezier.FillArea(Layer: TRLayer);
var i, ip1: Integer;
    pt0, pt1, rpt, lpt: TPoint;
    _pt0, _pt1, _rpt, _lpt: TPointF;
    pts: array[0..3]of TPoint;
begin
  BeginPath(Layer.Canvas.Handle);
  Layer.Converter.LogicToScreen(X[Low], Y[Low], pt0.X, pt0.Y);
  MoveToEx(Layer.Canvas.Handle, pt0.X, pt0.Y, nil);
  for i := Low to High + Integer(Closed)-1 do
  begin
    ip1 := (i+1) mod Length;
    _pt0 := PointF(X[i], Y[i]);
    _pt1 := PointF(X[ip1], Y[ip1]);
    Layer.Converter.LogicToScreen(X[ip1], Y[ip1], pt1.X, pt1.Y);
    case SegmentType[i] of
      stBezier:
      begin
        // Relative control points
        _rpt := RCtrlPt[i];
        _lpt := LCtrlPt[ip1];
        // Absolute control points
        OffsetPointF(_rpt, _pt0.X, _pt0.Y);
        OffsetPointF(_lpt, _pt1.X, _pt1.Y);
        Layer.Converter.LogicToScreen(_rpt.X, _rpt.Y, rpt.X, rpt.Y);
        Layer.Converter.LogicToScreen(_lpt.X, _lpt.Y, lpt.X, lpt.Y);
        pts[1] := rpt;
        pts[2] := lpt;
        pts[3] := pt1;
        PolyBezierTo(Layer.Canvas.Handle, pts[1], 3);
      end;
      stLine: PolyLineTo(Layer.Canvas.Handle, pt1, 1);
    end;
  end;
  CloseFigure(Layer.Canvas.Handle);
  EndPath(Layer.Canvas.Handle);
  FillPath(Layer.Canvas.Handle);
end;

MArkdc 18-12-2012 00:06:29

Rellenos Bezier
 
Muchas gracias por tu aporte me sirvio como referencia para crear un procedimiento para rellenar bezier ya entregado mi dibujo y si quedo perfecto


La franja horaria es GMT +2. Ahora son las 20:58:20.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi