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

Вниз

Большой BMP   Найти похожие ветки 

 
microb ©   (2002-03-04 10:22) [0]

Мне нужно разрезать монохромный BMP на 16 частей, что то вроде шахматной доски, и перезаписать данные в другой файл, что бы при считывании из него рисунок выводился блоками. BMP - большой, около 10Mb.


 
Владимир Васильев ©   (2002-03-04 16:31) [1]

FileHandle := FileOpen (FFilename, fmOpenRead + fmShareDenyNone);
if FileHandle = INVALID_HANDLE_VALUE then
raise Exception.Create ("Failed to open " + FFilename);

// create file map and throw away the file handle
try
MapHandle := CreateFileMapping (FileHandle, nil, PAGE_READONLY, 0, 0, nil);
if MapHandle = 0 then
raise Exception.Create ("Failed to map file")
finally
CloseHandle (FileHandle)
end;

// view file map and throw away the map handle
try
FData := MapViewOfFile (MapHandle, FILE_MAP_READ, 0, 0, 0);
if FData = nil then
raise Exception.Create ("Failed to view map file")
finally
CloseHandle (MapHandle)
end;

// set up a few other pointers into the data for records we will
// need to reference in the file, it"s easiest just to do it this once.
FInfoHeader := pointer (integer (FData) + sizeof (TBitmapFileHeader));
FInfo := pointer (FInfoHeader);
FPixelStart := pointer (integer(FData) + FFileHeader^.bfOffBits);

// get bitmap size into easy to access properties
FBitmapHeight := FInfoHeader^.biHeight;
FBitmapWidth := FInfoHeader^.biWidth;


//копируешь нужный кусок
StretchDIBits (TempDIB.Canvas.Handle, //destination device context.
DestR.Left,DestR.Top,W,H, //dest. rect
SrcR.Left,FBitmapHeight-SrcR.Bottom,W,H, //source rect
FPixelStart, // address of bitmap bits
FInfo^, // address of bitmap data
DIB_RGB_COLORS, SRCCOPY);


 
Владимир Васильев ©   (2002-03-04 16:42) [2]

Полностью код забирай с
ftp://vladcommon:vladcommon@194.84.65.217



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

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

Наверх




Память: 0.47 MB
Время: 0.013 c
1-23570
vitnt2000
2002-06-27 08:09
2002.07.08
Как преобразовать array of char to string?


3-23505
Oleon
2002-06-17 13:36
2002.07.08
InterBase.


1-23618
Chris
2002-06-25 16:04
2002.07.08
Каким ярлыком запущена программа?


1-23595
Filat
2002-06-17 19:05
2002.07.08
Контрольная сумма, как её создать и как проверить?


6-23693
Filat
2002-04-10 17:20
2002.07.08
Обмен файлами между организацией и её клиентами через Интернет?