Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 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.47 MB
Время: 0.011 c
1-95901
Teron
2002-08-18 20:25
2002.08.29
Не могу найти ответы на следующие вопросы... Может, плохо ищу?


14-95975
.nuke
2002-08-05 14:16
2002.08.29
Rx-Lib и sohoLib


3-95722
SlavaK
2002-08-07 16:01
2002.08.29
SQLQuery


14-95940
НАИВый панк
2002-08-03 14:29
2002.08.29
вопрос касательный проги Keyboard Ninja...


1-95758
CashDi
2002-08-19 13:21
2002.08.29
регулярные выражения