Главная страница
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.019 c
3-23439
vitnt2000
2002-06-14 09:40
2002.07.08
Обработка ошибки связи с сервером


14-23786
lipskiy
2002-06-08 03:30
2002.07.08
UBPFD - Бесплатная база готовых решений для Delphi


14-23765
Китаец Ла Ме
2002-06-07 15:11
2002.07.08
Торможу... Нужна помощь в 1с.


3-23510
Юра
2002-06-17 17:13
2002.07.08
OnFilterRecord - обрабатываются не все записи


1-23594
Fly`
2002-06-25 12:46
2002.07.08
RichEdit, SelStart, Lines