如以下代码,画出来的简直就是四个大括号拼起来。
   canvas.Pen.Color:=clred;
   canvas.brush.color:=clRed;
   canvas.ellipse(200,200,212,212);

解决方案 »

  1.   

    procedure Stretch_Linear(bmpDest: TBitmap; bmpSrc: TBitmap);
    var
      sw: integer;
      sh: integer;
      dw: integer;
      dh: integer;
      B, N, x, y: integer;
      pLinePrev, pLineNext: PByte;
      pDest: PByte;
      pA, pB, pC, pD: PByte;
      nPixelSize: integer;
      i, j, k: integer;
      BxN, dwXdh, dhB, dwN: integer;
      dwXdh_dhB_dwN: integer;
    begin
        if (bmpDest.PixelFormat <> pf24bit)
            or (bmpSrc.PixelFormat <> pf24bit) then
          Exit;    sw := bmpSrc.Width - 1;
        sh := bmpSrc.Height - 1;
        dw := bmpDest.Width - 1;
        dh := bmpDest.Height - 1;    nPixelSize := 3;    for i := 0 to dh do
        begin        pDest := bmpDest.ScanLine[i];        y := i * sh div dh;        N := dh - i * sh mod dh;        pLinePrev := bmpSrc.ScanLine[y];
            Inc(y);
            if ( N = dh ) then
              pLineNext := pLinePrev
            else
              pLineNext := bmpSrc.ScanLine[y];        for j := 0 to dw do
            begin            x := j * sw div dw * nPixelSize;            B := dw - j * sw mod dw;            pA := pLinePrev;
                Inc(pA, x);            pB := pA;
                Inc(pB, nPixelSize);            pC := pLineNext;
                Inc(pC, x);            pD := pC;
                Inc(pD, nPixelSize);            if ( B = dw ) then
                begin
                    pB := pA;
                    pD := pC;
                end;
                BxN := B * N;
                dwXdh := dw * dh;
                dhB := dh * B;
                dwN := dw *N;
                dwXdh_dhB_dwN := dwXdh - dhB - dwN;
                for k := 0 to nPixelSize-1 do
                begin
                    pDest^ := ( BxN * ( pA^ - pB^ - pC^ + pD^ ) + dwN * pB^
                        + dhB * pC^ + ( dwXdh_dhB_dwN ) * pD^
                        + dwXdh shr 1 ) div ( dwXdh );
                    Inc(pA);
                    Inc(pB);
                    Inc(pC);
                    Inc(pD);
                    Inc(pDest);
                end;
            end
        end;
    end;procedure TForm1.FormPaint(Sender: TObject);
    var
      bmp1, bmp2: TBitmap;
    begin
      bmp1 := TBitmap.Create();
      bmp2 := TBitmap.Create();
      bmp1.Width := 160;
      bmp1.Height := 160;
      bmp2.Width := 16;
      bmp2.Height := 16;
      bmp1.PixelFormat := pf24bit;
      bmp2.PixelFormat := pf24bit;
      bmp1.Canvas.Pen.Color:=clRed;
      bmp1.Canvas.Brush.Color:=clRed;
      bmp1.Canvas.Ellipse(20,20,140,140);
      Stretch_Linear(bmp2, bmp1);
      Canvas.Draw(100, 100, bmp2);
      bmp1.Free();
      bmp2.Free();
    end;