TJPEGImage画像をクリアする方法は?
トリックはJPG.Width := 0
機能しません。また、空のビットマップ(0x0ピクセル)を作成してjpegに割り当てたくありません。
TJPEGImage画像をクリアする方法は?
トリックはJPG.Width := 0
機能しません。また、空のビットマップ(0x0ピクセル)を作成してjpegに割り当てたくありません。
次のようなものを使用できます(ここでは、保護されたメソッドにアクセスするために、挿入されたクラスが使用されます)。
type
TJPEGImage = class(jpeg.TJPEGImage);
implementation
procedure TForm1.Button1Click(Sender: TObject);
var
JPEGImage: TJPEGImage;
begin
JPEGImage := TJPEGImage.Create;
try
// this should recreate the internal bitmap
JPEGImage.NewBitmap;
// this should recreate the internal image stream
JPEGImage.NewImage;
// here the memory used by the image should be released
finally
JPEGImage.Free;
end;
end;
FreeAndNilを使用せず、画像を空のままにしておく場合...
Procedure EmptyJPG(jpg:TJpegImage);
var
j:TJpegImage;
begin
j := TJpegImage.Create;
try
jpg.Assign(j);
finally
j.Free;
end;
end;
TImageコンポーネントの背景にTshapeコンポーネントを配置します
Image1 : Timage
.
.
Image1.Picture.Graphic.Assign(nil);