我有个要求 是给一副图片加上背景和边框 
背景和边框是实现可以选择的,就是平时大头贴的功能
要求编程实现请问如何实现??

解决方案 »

  1.   

    这个我刚有所研究啊.
    就是把透明的前景图和后景结合起来是吧.
    呵呵
    用ImageEn,里面示例里面有png的模板+背景图片结合起来的例子
    完全实现你的要求我也想做一套呢,可惜时间不够,呵呵
      

  2.   

    不说废话,例程奉上:
    procedure DrawTransparent(var sBmp: TBitMap; dBmp: TBitMap; PosX, PosY: Integer; TranColor: TColor = -1);
    type
      PRGBTripleArray = ^TRGBTripleArray;
      TRGBTripleArray = array[0..32767] of TRGBTriple;
      function GetSLCOlor(pRGB: TRGBTriple): TColor;
      begin
        Result := RGB(pRGB.rgbtRed, pRGB.rgbtGreen, pRGB.rgbtBlue);
      end;
    var
      b, p: PRGBTripleArray;
      x, y: Integer;
      BaseColor: TColor;
    begin
      sBmp.PixelFormat := pf24Bit;
      dBmp.PixelFormat := pf24Bit;
      p := dBmp.scanline[0];  if TranColor = -1 then
        BaseCOlor := GetSLCOlor(p[0])
      else
        BaseCOlor := TranColor;  if (PosY > sBmp.Width) or (PosY > sBmp.Height) then
        Exit;  for y := 0 to dBmp.Height - 1 do
      begin
        p := dBmp.scanline[y];
        b := sBmp.ScanLine[y + PosY];
        for x := 0 to (dBmp.Width - 1) do
        begin
          if GetSLCOlor(p[x]) <> BaseCOlor then
            b[x + PosX] := p[x];
        end;
      end;end;procedure TForm1.Button1Click(Sender: TObject);
    var
      bmp:TBitMap;
    begin
      bmp:=TBitMap.Create ;
      bmp.Assign(Image1.Picture);
      DrawTransparent(bmp,Image2.Picture.Bitmap ,10,10);
      image1.Picture.Assign(bmp);
      image1.Refresh ;end;
      

  3.   

    xzhifei(饭桶超人(抵制日货)) 兄
    能不能给出完整的代码呢?
    那个RGB函数还有TRGBTriple
    结构 你都没给出来啊
      

  4.   

    在windows.pas单元里有定义,引用一下就行了
      

  5.   

    xzhifei(饭桶超人(抵制日货)) 留个msn吧??