图片在只在程序中使用显示,支持。.psd图片

解决方案 »

  1.   

    服了你,给不给分随便,PSD的问题你自己搞定
    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;
      

  2.   

    PSD格式本身是非常复杂的,但复杂不在格式解析,而在后期渲染上,其工作量相当于把PhotoShop的主要功能都实现了不过好在psd格式中包括了渲染后的位图信息,直接跳过前面的各种资源和图层信息,读后面位图信息用于显示即可