我的代碼 - >顯示波形立體.wav文件TImage delphi max的寬度和高度?
max_l和max_r這裏是每個通道中波形的最高值。
form2:= TForm2.Create(self);
form2.Image1.Visible := true;
form2.Image1.Width := numsamples;
form2.Image1.Height := max_l * 2;
form2.Image1.Canvas.Lock;
form2.Image1.Canvas.MoveTo(0,mid);
form2.Image1.Canvas.Pen.Color := clRed
form2.Image2.Visible := true;
form2.Image2.Width := numsamples;
form2.Image2.Height := max_r * 2;
form2.Image2.Canvas.Lock;
form2.Image2.Canvas.MoveTo(0,mid);
form2.Image2.Canvas.Pen.Color := clRed
x:=0;
for i := 0 to numchannels do begin
if i mod 2 = 0 then begin
form2.Image2.Canvas.MoveTo(x,max_r);
form2.Image2.Canvas.LineTo(x,max_r+buff[i]);
x:=x+1;
end
else begin
form2.Image1.Canvas.MoveTo(x,max_l);
form2.Image1.Canvas.LineTo(x,max_l+buff[i]);
end;
end;
我想知道TImage Delphi最大高度和寬度的最大值是多少?因爲我試圖繪製一個.wav文件的整個波形的大圖。例如,現在我得到了image1.height = 23000多,並得到EOutOfResource問題或者我的代碼錯誤了嗎?任何建議,將不勝感激。
EDIT1:還我試圖用畫BMP然後用stretchdraw方法調整其大小,但它不工作了,這是我的代碼和主要思想是首先我畫超級大原始大小成BMP,則縮水了使用StretchDraw函數然後將其繪製在TImage上。但仍然位圖也返回相同的問題EOutOfResources。
form2:= TForm2.Create(self);
form2.Image1.Visible := true;
bmp:=TBitmap.Create;
bmp.Height:=max_l*2;
bmp.Width:=numsamples;
bmp.Canvas.Pen.Color:=clRed;
bmp.Canvas.MoveTo(0,max_l);
x:=0;
for i := 0 to numchannels do begin
if i mod 2 = 0 then begin
bmp.Canvas.MoveTo(x,max_r);
bmp.Canvas.LineTo(x,max_r+buff[i]);
x:=x+1;
end;
end;
newwidth:=1000;
newheight:=500;
bmp.Canvas.StretchDraw(rect(0,0,newheight,newwidth),bmp);
form2.Image1.Canvas.Draw(0,0,bmp);
是否有任何其他方式來做我想要的而不需要改變硬件? –
正如我所建議的,調整內存位圖的大小,使其更接近於正常的屏幕分辨率,例如,如果您有1,000,000像素的圖像(寬度),但您會以表單形式顯示它,因爲典型屏幕沒有超過2.000像素,應該更好地將圖像重新縮放到2.000像素的圖像,並將其存儲在內存中 – Qsebas
我該怎麼做? –