ConvertBitmapToRTF(const Bitmap: TBitmap): string;
我使用了上面的函数将一个 BMP 图片转成 16 进字符串.再放入RTF中
RTF中的图片表示使用的是
{\rtf1 {\pict\dibitmap 图片的16进制字符串 }}
请问如何反操作.再将16进制字符串转成BMP图片
.
ConvertBitmapToRTF 具体如下:{将Bitmap转换为RTF格式}
function ConvertBitmapToRTF(const Bitmap: TBitmap): string;
var
  bi, bb: string;
  bis, bbs: Cardinal;
  achar: string[2];
  Buffer: string;
  I: Integer;
type
  PWord = ^Word;
begin
  GetDIBSizes(Bitmap.Handle, bis, bbs);
  SetLength(bi, bis);
  SetLength(bb, bbs);
  GetDIB(Bitmap.Handle, Bitmap.Palette, PChar(bi)^, PChar(bb)^);
  SetLength(Buffer, (Length(bb) + Length(bi)) * 2);
  i := 1;
  for bis := 1 to Length(bi) do
  begin
    achar := IntToHex(Integer(bi[bis]), 2);
    PWord(@Buffer[i])^ := PWord(@achar[1])^;
    inc(i, 2);
  end;
  for bbs := 1 to Length(bb) do
  begin
    achar := IntToHex(Integer(bb[bbs]), 2);
    PWord(@Buffer[i])^ := PWord(@achar[1])^;
    inc(i, 2);
  end;
  Result := '{\rtf1 {\pict\dibitmap ' + Buffer + ' }}';
end;