Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2003.05.12;
Скачать: CL | DM;

Вниз

bmp.savetofile problem (sorry for english)   Найти похожие ветки 

 
Delight   (2002-07-19 04:14) [0]

How come this code doesn"t work?

Bmp := NewBitmap( 0, 0 );
Bmp.PasteFromClipboard;
Bmp.SaveToFile("c:\bitmap.bmp"); //<---CRASH HERE!
Bmp.Free;


 
SPeller ©   (2002-07-19 07:21) [1]

А зачем размеры 0 на 0 ? Попробуй 5 на 5 например.


 
Delight   (2002-07-19 11:42) [2]

Bmp.width and Bmp.height are changed when bmp.PasteFromClipBoard executes.

Bmp := NewBitmap( 0, 0 );

//BEFORE: Bmp.Width=0, Bmp.Height=0
Bmp.PasteFromClipboard;
//AFTER: Bmp.Width=1024, Bmp.Height=768

Bmp.SaveToFile("c:\bitmap.bmp"); //<---CRASH HERE!
Bmp.Free;



It still crashes! :(


 
SPeller ©   (2002-07-19 15:35) [3]

А где это написано?


 
Vladimir Kladov   (2002-07-19 16:22) [4]

May be this is a bug of pf15bit or pf16bit format. What bitmap
is stored in Clipboard? (If it is grabbed from screen using
shift+prntscrn, what is a color deep of your desktop?)


 
Delight   (2002-07-19 16:42) [5]

It"s a screenshot (using prntscrn) and I have a 32-bits color depth on my screen. I used this code before when i was not using KOL:

bmp:=Graphics.TBitmap.Create;
bmp.assign(ClipBoard);
bmp.SaveToFile(sFilename+".bmp");
bmp.free;


 
Gandalf   (2002-07-31 15:45) [6]

Hmmm... Trouble in KOL lib:
Look here.
procedure TBitmap.SaveToStream(Strm: PStream);
var BFH : TBitmapFileHeader;
Pos : Integer;
function WriteBitmap : Boolean;
var ColorsSize, BitsSize, Size : Integer;
begin
Result := False;
if Empty then Exit;
HandleType := bmDIB; // convert to DIB if DDB
^^^ in this line trouble, you need to comment it.
But after this you get unofficial KOL.) Add it works some incorrect ,but work.

To Kladov: It"s KOL BUG - I think.



 
Vladimir Kladov   (2002-08-01 09:17) [7]

Anyway, before saving a bitmap to stream, it MUST be converted to DIB.

In version 1.38, the first code works fine. Did you test?


 
Delight   (2002-08-04 15:26) [8]

It works perfect! Thanks for your help


/Delight



Страницы: 1 вся ветка

Текущий архив: 2003.05.12;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.014 c
7-34637
opoloXAI
2003-03-18 12:52
2003.05.12
Просмотр бинарного файла


7-34634
ed
2003-03-10 23:02
2003.05.12
Флоппи


4-34653
JoSHUA
2003-03-12 15:28
2003.05.12
Убийство


1-34485
vidd
2003-04-29 11:44
2003.05.12
Вариантные записи в ObjectPascal


14-34594
Дмитрий К.К.
2003-04-24 06:19
2003.05.12
Именинники 24 апреля