mirror of
https://github.com/vapaamies/KolibriOS.git
synced 2025-09-22 15:13:49 +02:00
Image formats type definitions moved to KolibriOS unit
This commit is contained in:
@@ -3,27 +3,6 @@ program DrawImageApp;
|
|||||||
uses
|
uses
|
||||||
KolibriOS;
|
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;
|
procedure ExtractFileDirectory(Source, Dest: PKolibriChar); stdcall;
|
||||||
asm
|
asm
|
||||||
PUSH ESI
|
PUSH ESI
|
||||||
@@ -49,7 +28,7 @@ end;
|
|||||||
|
|
||||||
var
|
var
|
||||||
WndLeft, WndTop, WndWidth, WndHeight: Integer;
|
WndLeft, WndTop, WndWidth, WndHeight: Integer;
|
||||||
TargaFile: PTargaFile;
|
TargaFile: Pointer;
|
||||||
Image: Pointer;
|
Image: Pointer;
|
||||||
FileSize: LongWord;
|
FileSize: LongWord;
|
||||||
|
|
||||||
@@ -59,8 +38,7 @@ begin
|
|||||||
|
|
||||||
TargaFile := LoadFile('Lena.tga', FileSize);
|
TargaFile := LoadFile('Lena.tga', FileSize);
|
||||||
|
|
||||||
with TargaFile^ do
|
Image := PKolibriChar(TargaFile) + SizeOf(TTargaFileHeader) + PTargaFileHeader(TargaFile).IDLength;
|
||||||
Image := Pointer(PKolibriChar(TargaFile) + SizeOf(Header) + Header.IDLength);
|
|
||||||
|
|
||||||
with GetScreenSize do
|
with GetScreenSize do
|
||||||
begin
|
begin
|
||||||
@@ -77,7 +55,7 @@ begin
|
|||||||
BeginDraw;
|
BeginDraw;
|
||||||
DrawWindow(WndLeft, WndTop, WndWidth, WndHeight, 'Draw Image', $00FFFFFF,
|
DrawWindow(WndLeft, WndTop, WndWidth, WndHeight, 'Draw Image', $00FFFFFF,
|
||||||
WS_SKINNED_FIXED + WS_CLIENT_COORDS + WS_CAPTION, CAPTION_MOVABLE);
|
WS_SKINNED_FIXED + WS_CLIENT_COORDS + WS_CAPTION, CAPTION_MOVABLE);
|
||||||
with TargaFile.Header do
|
with PTargaFileHeader(TargaFile)^ do
|
||||||
DrawImage(Image^, 30, 20, Width, Height);
|
DrawImage(Image^, 30, 20, Width, Height);
|
||||||
EndDraw;
|
EndDraw;
|
||||||
end;
|
end;
|
||||||
|
@@ -8,43 +8,6 @@ const
|
|||||||
Picture2 = 'Mario(1bpp).bmp';
|
Picture2 = 'Mario(1bpp).bmp';
|
||||||
Picture3 = 'House(24bpp).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;
|
procedure ExtractFileDirectory(Src, Dst: PKolibriChar); stdcall;
|
||||||
asm
|
asm
|
||||||
PUSH ESI
|
PUSH ESI
|
||||||
|
@@ -8,35 +8,6 @@ const
|
|||||||
POINT_BUTTON = 3;
|
POINT_BUTTON = 3;
|
||||||
WAIT_BUTTON = 4;
|
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;
|
procedure ExtractFileDirectory(Src, Dst: PKolibriChar); stdcall;
|
||||||
asm
|
asm
|
||||||
PUSH ESI
|
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
|
interface
|
||||||
|
|
||||||
|
{$I ImageFormats.inc}
|
||||||
|
|
||||||
type
|
type
|
||||||
TSize = packed record
|
TSize = packed record
|
||||||
Height: Word;
|
Height: Word;
|
||||||
|
Reference in New Issue
Block a user