Текущий архив: 2002.08.29;
Скачать: CL | DM;
ВнизWindows виснет. Не могу найти ошибку. Код простой. Помогите :) Найти похожие ветки
← →
Kettle of delphi (2002-08-18 19:41) [0]Здравствуйте.
Windows виснет при попытке ЗАКРЫТЬ программу либо еще раньше...
Изображение заранее 24-х разрядное.
Вот код:
unit Unit1;
interface
uses ...;
var
...
MaxW,MaxH: Integer; {примерные значения: не более 100}
implementation
uses ...;
procedure TForm1.Button1Click(Sender: TObject);
var BMP: TBitMap;
begin
...
...
BMP := TBitMap.Create;
BMP.Width := MaxW;
BMP.Height := MaxH;
{если не вызывать следующую процедуру, все работает!!!}
Y_to_BMP(MaxW,MaxH,ResultM,BMP);
Form_Pic.Image_Result.Picture.Assign(BMP);
BMP.Free;
...
...
end;
===============================================
unit Unit2;
interface
uses ..., Graphics {TBitMap};
type
Complex = record
Re, Im: Real;
end;
CM = array [0..300, 0..300] of Complex;
var
..., ResultM: CM;
function ToByte(X: Real): Byte;
procedure Y_to_BMP(X,Y: Integer; var InYM: CM; var OutBMP: TBitMap);
implementation
uses ...;
{***************************************************************}
function ToByte(X: Real): Byte;
var Q: Integer;
begin
Q := Round(X);
if Q > 255 then Q := 255;
if Q < 0 then Q := 0;
Result := Q;
end;
procedure Y_to_BMP(X,Y: Integer; var InYM: CM; var OutBMP: TBitMap);
var W,H,I: Integer; DestP: PByteArray;
begin
OutBMP.Width := X;
OutBMP.Height := Y;
for H := 0 to OutBMP.Height-1 do begin
DestP := OutBMP.ScanLine[H];
I := 0;
for W := 0 to OutBMP.Width-1 do begin
DestP[I+2] := ToByte(InYM[W,H].Re);
DestP[I+1] := ToByte(InYM[W,H].Re);
DestP[I+0] := ToByte(InYM[W,H].Re);
I := I+3;
end;
end;
end;
← →
Kettle of delphi (2002-08-18 22:21) [1]Ауу...
← →
Kettle of delphi (2002-08-19 17:09) [2]Кто-нибудь... )
← →
Skier (2002-08-19 17:16) [3]>Kettle of delphi
procedure TForm1.Button1Click(Sender: TObject);
var BMP: TBitMap;
begin
...
...
BMP := TBitMap.Create;
BMP.PixelFormat := pf24bit; //не поможет ?
BMP.Width := MaxW;
BMP.Height := MaxH;
{если не вызывать следующую процедуру, все работает!!!}
Y_to_BMP(MaxW,MaxH,ResultM,BMP);
Form_Pic.Image_Result.Picture.Assign(BMP);
BMP.Free;
...
...
end;
Страницы: 1 вся ветка
Текущий архив: 2002.08.29;
Скачать: CL | DM;
Память: 0.45 MB
Время: 0.006 c