mirror of
https://github.com/vapaamies/KolibriOS.git
synced 2024-11-12 19:07:29 +01:00
Image formats type definitions moved to KolibriOS unit
This commit is contained in:
parent
08306b3601
commit
42bf5fb77e
@ -3,27 +3,6 @@ program DrawImageApp;
|
||||
uses
|
||||
KolibriOS;
|
||||
|
||||
type
|
||||
THeader = packed record
|
||||
IDLength: Byte;
|
||||
ColorMapType: Byte;
|
||||
ImageType: Byte;
|
||||
CMapStart: Word;
|
||||
CMapLength: Word;
|
||||
CMapDepth: Byte;
|
||||
XOffset: Word;
|
||||
YOffset: Word;
|
||||
Width: Word;
|
||||
Height: Word;
|
||||
PixelDepth: Byte;
|
||||
ImageDescriptor: Byte;
|
||||
end;
|
||||
|
||||
PTargaFile = ^TTargaFile;
|
||||
TTargaFile = packed record
|
||||
Header: THeader;
|
||||
end;
|
||||
|
||||
procedure ExtractFileDirectory(Source, Dest: PKolibriChar); stdcall;
|
||||
asm
|
||||
PUSH ESI
|
||||
@ -49,7 +28,7 @@ end;
|
||||
|
||||
var
|
||||
WndLeft, WndTop, WndWidth, WndHeight: Integer;
|
||||
TargaFile: PTargaFile;
|
||||
TargaFile: Pointer;
|
||||
Image: Pointer;
|
||||
FileSize: LongWord;
|
||||
|
||||
@ -59,8 +38,7 @@ begin
|
||||
|
||||
TargaFile := LoadFile('Lena.tga', FileSize);
|
||||
|
||||
with TargaFile^ do
|
||||
Image := Pointer(PKolibriChar(TargaFile) + SizeOf(Header) + Header.IDLength);
|
||||
Image := PKolibriChar(TargaFile) + SizeOf(TTargaFileHeader) + PTargaFileHeader(TargaFile).IDLength;
|
||||
|
||||
with GetScreenSize do
|
||||
begin
|
||||
@ -77,7 +55,7 @@ begin
|
||||
BeginDraw;
|
||||
DrawWindow(WndLeft, WndTop, WndWidth, WndHeight, 'Draw Image', $00FFFFFF,
|
||||
WS_SKINNED_FIXED + WS_CLIENT_COORDS + WS_CAPTION, CAPTION_MOVABLE);
|
||||
with TargaFile.Header do
|
||||
with PTargaFileHeader(TargaFile)^ do
|
||||
DrawImage(Image^, 30, 20, Width, Height);
|
||||
EndDraw;
|
||||
end;
|
||||
|
@ -8,43 +8,6 @@ const
|
||||
Picture2 = 'Mario(1bpp).bmp';
|
||||
Picture3 = 'House(24bpp).bmp';
|
||||
|
||||
type
|
||||
TBitmapFileHeader = packed record
|
||||
bfType: Word;
|
||||
bfSize: LongWord;
|
||||
bfReserved1: Word;
|
||||
bfReserved2: Word;
|
||||
bfOffBits: LongWord;
|
||||
end;
|
||||
|
||||
TBitmapInfoHeader = packed record
|
||||
biSize: LongWord;
|
||||
biWidth: LongInt;
|
||||
biHeight: LongInt;
|
||||
biPlanes: Word;
|
||||
biBitCount: Word;
|
||||
biCompression: LongWord;
|
||||
biSizeImage: LongWord;
|
||||
biXPelsPerMeter: LongInt;
|
||||
biYPelsPerMeter: LongInt;
|
||||
biClrUsed: LongWord;
|
||||
biClrImportant: LongWord;
|
||||
end;
|
||||
|
||||
TRGBQuad = packed record
|
||||
Blue: Byte;
|
||||
Green: Byte;
|
||||
Red: Byte;
|
||||
Reserved: Byte;
|
||||
end;
|
||||
|
||||
PBitmapFile = ^TBitmapFile;
|
||||
TBitmapFile = packed record
|
||||
BitmapFileHeader: TBitmapFileHeader;
|
||||
BitmapInfoHeader: TBitmapInfoHeader;
|
||||
Palette: array[0..0] of TRGBQuad;
|
||||
end;
|
||||
|
||||
procedure ExtractFileDirectory(Src, Dst: PKolibriChar); stdcall;
|
||||
asm
|
||||
PUSH ESI
|
||||
|
@ -8,35 +8,6 @@ const
|
||||
POINT_BUTTON = 3;
|
||||
WAIT_BUTTON = 4;
|
||||
|
||||
type
|
||||
TBitmapFileHeader = packed record
|
||||
bfType: Word;
|
||||
bfSize: LongWord;
|
||||
bfReserved1: Word;
|
||||
bfReserved2: Word;
|
||||
bfOffBits: LongWord;
|
||||
end;
|
||||
|
||||
TBitmapInfoHeader = packed record
|
||||
biSize: LongWord;
|
||||
biWidth: LongInt;
|
||||
biHeight: LongInt;
|
||||
biPlanes: Word;
|
||||
biBitCount: Word;
|
||||
biCompression: LongWord;
|
||||
biSizeImage: LongWord;
|
||||
biXPelsPerMeter: LongInt;
|
||||
biYPelsPerMeter: LongInt;
|
||||
biClrUsed: LongWord;
|
||||
biClrImportant: LongWord;
|
||||
end;
|
||||
|
||||
PBitmapFile = ^TBitmapFile;
|
||||
TBitmapFile = packed record
|
||||
BitmapFileHeader: TBitmapFileHeader;
|
||||
BitmapInfoHeader: TBitmapInfoHeader;
|
||||
end;
|
||||
|
||||
procedure ExtractFileDirectory(Src, Dst: PKolibriChar); stdcall;
|
||||
asm
|
||||
PUSH ESI
|
||||
|
58
Lib/ImageFormats.inc
Normal file
58
Lib/ImageFormats.inc
Normal file
@ -0,0 +1,58 @@
|
||||
(*
|
||||
Image file format definitions for KolibriOS
|
||||
|
||||
Copyright (c) 2017 0CodErr
|
||||
*)
|
||||
|
||||
type
|
||||
PTargaFileHeader = ^TTargaFileHeader;
|
||||
TTargaFileHeader = packed record
|
||||
IDLength: Byte;
|
||||
ColorMapType: Byte;
|
||||
ImageType: Byte;
|
||||
CMapStart: Word;
|
||||
CMapLength: Word;
|
||||
CMapDepth: Byte;
|
||||
XOffset: Word;
|
||||
YOffset: Word;
|
||||
Width: Word;
|
||||
Height: Word;
|
||||
PixelDepth: Byte;
|
||||
ImageDescriptor: Byte;
|
||||
end;
|
||||
|
||||
TBitmapFileHeader = packed record
|
||||
bfType: Word;
|
||||
bfSize: LongWord;
|
||||
bfReserved1: Word;
|
||||
bfReserved2: Word;
|
||||
bfOffBits: LongWord;
|
||||
end;
|
||||
|
||||
TBitmapInfoHeader = packed record
|
||||
biSize: LongWord;
|
||||
biWidth: LongInt;
|
||||
biHeight: LongInt;
|
||||
biPlanes: Word;
|
||||
biBitCount: Word;
|
||||
biCompression: LongWord;
|
||||
biSizeImage: LongWord;
|
||||
biXPelsPerMeter: LongInt;
|
||||
biYPelsPerMeter: LongInt;
|
||||
biClrUsed: LongWord;
|
||||
biClrImportant: LongWord;
|
||||
end;
|
||||
|
||||
TRGBQuad = packed record
|
||||
Blue: Byte;
|
||||
Green: Byte;
|
||||
Red: Byte;
|
||||
Reserved: Byte;
|
||||
end;
|
||||
|
||||
PBitmapFile = ^TBitmapFile;
|
||||
TBitmapFile = packed record
|
||||
BitmapFileHeader: TBitmapFileHeader;
|
||||
BitmapInfoHeader: TBitmapInfoHeader;
|
||||
Palette: array[0..0] of TRGBQuad;
|
||||
end;
|
@ -9,6 +9,8 @@ unit KolibriOS;
|
||||
|
||||
interface
|
||||
|
||||
{$I ImageFormats.inc}
|
||||
|
||||
type
|
||||
TSize = packed record
|
||||
Height: Word;
|
||||
|
Loading…
Reference in New Issue
Block a user