Главная страница
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.011 c
3-23442
фл
2002-06-14 11:28
2002.07.08
local SQL запрос: выбрать 5 максимальных


1-23583
Боева Наталья
2002-06-24 04:27
2002.07.08
отчет в word


3-23485
NaPoleOn_IV
2002-06-15 20:53
2002.07.08
Помогите новичку перемножить две цифры!


1-23553
Navigor
2002-06-26 19:02
2002.07.08
Про буфер обмена WIN 98


1-23588
zam
2002-06-24 17:44
2002.07.08
Как изменить цвет или границу выделенного элемента в listview