Top.Mail.Ru
Мастера DELPHI, Delphi programming community Титульная страница Поиск, карта сайта Написать письмо 
| Новости | Поиск | FAQ | Статьи | Книги | Новости VCL |
| Форумы ЧАТ | Орешник | KOL и MCK |
Форумы -» Основная («Начинающим»)/ Базы / WinAPI / Компоненты / Сети / Media / Игры / Corba и COM / KOL / FreePascal / .Net / Прочее / RSDN.ORG

« предыдущая ветвь | форум | следующая ветвь »

bmp.savetofile problem (sorry for english)


Delight ©   (2002-07-19 04:14:00) 

How come this code doesn"t work?

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


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

It works perfect! Thanks for your help


/Delight


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

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?


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

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.


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

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;


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

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?)


SPeller   (2002-07-19 15:35:00) [6]

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


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

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 07:21:00) [8]

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


Наверх

Титульная страница Поиск, карта сайта Написать письмо