Ver Mensaje Individual
  #4  
Antiguo 14-06-2008
[coso] coso is offline
Miembro Premium
 
Registrado: may 2008
Ubicación: Girona
Posts: 1.678
Reputación: 0
coso Va por buen camino
Bueno el antialias es un poquillo mas complicado en delphi 5 y me va bastante lento : / pero el degradado es sencillo. Te pongo un ejemplo y espero q encuentres alguna funcion de antialias con buen rendimiento.

Código Delphi [-]
unit degradado;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormPaint(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject); 
var 
  f: HRGN; 
begin 
  Form1.Borderstyle := bsNone; 
  f := CreateRoundRectRgn(
          0,            // x-coordinate of the region's upper-left corner
          0,            // y-coordinate of the region's upper-left corner
          clientwidth,  // x-coordinate of the region's lower-right corner
          clientheight, // y-coordinate of the region's lower-right corner
          40,           // height of ellipse for rounded corners
          40);          // width of ellipse for rounded corners
  SetWindowRgn(Handle,f,True);
end;

procedure TForm1.FormPaint(Sender: TObject);
var
        ri,gi,bi : integer;
        rf,gf,bf : integer;
        pr,pg,pb : double;
        r,g,b    : integer;
        x : integer;
        c : TColor;
begin
        inherited;

        ri := $3F;
        gi := $4F;
        bi := $70;

        rf := 255;
        gf := 255;
        bf := 255;

        pr := (rf - ri) / (2*Width/3);
        pg := (gf - gi) / (2*Width/3);
        pb := (bf - bi) / (2*Width/3);

        c := 0;
        for x := 0 to (2*Width div 3) - 1 do
        begin
          r := ri + round(pr * x);
          g := gi + round(pg * x);
          b := bi + round(pb * x);

          c := RGB(r,g,b);

          Canvas.Pen.Color := c;
          Canvas.MoveTo(x,0);
          Canvas.LineTo(x,Height);
        end;

        for x := (2*Width div 3) to Width do
        begin
          Canvas.Pen.Color := c;
          Canvas.MoveTo(x,0);
          Canvas.LineTo(x,Height);
        end;
end;
end.

Saludos
Responder Con Cita