Вниз
Скачать: 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 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.008 c
3-23441
Dark Programmer
2002-06-14 09:16
2002.07.08
проблема с отчетом


4-23833
Artemkin
2002-05-08 10:12
2002.07.08
resources


1-23544
Voldemar
2002-06-26 17:41
2002.07.08
Автоопределение кодировки (866 vs 1251)


14-23772
Nevercomes
2002-06-07 23:24
2002.07.08
GTA 3 WinXp+Nvidia GeForse = с графикой проблемы!!!


4-23835
SPeller
2002-05-05 14:37
2002.07.08
События




   Наверх