How to Get a transparent BitMap from TRVMathItemInfo item?
Posted: Mon Jul 22, 2024 5:28 pm
Hello Sergey
I used the following code to convert a latex text into a bitmap...
Every thing runs well except that the Bitmap produced is not transparent as I wish...
Please what I mess here?? Thanks in advance!!
procedure TForm9.Button1Click(Sender: TObject);
var rv:trichViewEdit;
Item: TRVMathItemInfo;
st:string;
Bit:TBitmap;
begin
rv := TRichViewEdit.Create(nil);
try
rv.Style := RvStyle1;
st := '\frac{x}{y}';
Item := TRVMathItemInfo.Create(rv.RVData);
Item.Text := st;
Item.FontSizeDouble :=40;
Item.TextColor := clRed;
// Create the bitmap with a transparent background color (e.g., clWhite)
Bit := Item.AsBitmap(rv.RVData, clWhite);
Bit.Transparent := True;
Bit.TransparentColor := clWhite;
Image1.Picture.Assign(Bit);
finally
rv.Free;
end;
end;
I used the following code to convert a latex text into a bitmap...
Every thing runs well except that the Bitmap produced is not transparent as I wish...
Please what I mess here?? Thanks in advance!!
procedure TForm9.Button1Click(Sender: TObject);
var rv:trichViewEdit;
Item: TRVMathItemInfo;
st:string;
Bit:TBitmap;
begin
rv := TRichViewEdit.Create(nil);
try
rv.Style := RvStyle1;
st := '\frac{x}{y}';
Item := TRVMathItemInfo.Create(rv.RVData);
Item.Text := st;
Item.FontSizeDouble :=40;
Item.TextColor := clRed;
// Create the bitmap with a transparent background color (e.g., clWhite)
Bit := Item.AsBitmap(rv.RVData, clWhite);
Bit.Transparent := True;
Bit.TransparentColor := clWhite;
Image1.Picture.Assign(Bit);
finally
rv.Free;
end;
end;