size : 3642
uploaded_on : Mon Feb 1 00:00:00 1999
modified_on : Wed Dec 8 14:03:33 1999
title : Windows icons in DOS program
org_filename : IconsInDOSApp.txt
author : Algirdas Kepezinskas
authoremail : cyber@vil.ktu.lt
description : How to use Windows icons in a Pascal DOS program
keywords :
tested : not tested yet
submitted_by : The CKB Crew
submitted_by_email : ckb@netalive.org
uploaded_by : nobody
modified_by : nobody
owner : nobody
lang : pas
file-type : text/plain
category : pascal-dos-graphics
__END_OF_HEADER__
> How can I use Windows Icons in a Pascal Dos Program ?
well, here is my quick and dirty code. It doesnt however take attention to AND
mask, so icon wont be transpearant(sp?) Also it uses two files:)) sorry, i was
too lazy..
Type
TIconHeader = Record
idReserved : Word; (* Always set to 0 *)
idType : Word; (* Always set to 1 *)
idCount : Word; (* Number of icon images *)
(* immediately followed by idCount TIconDirEntries *)
End;
TIconDirEntry = Record
bWidth : Byte; (* Width *)
bHeight : Byte; (* Height *)
bColorCount : Byte; (* Nr. of colors used, see below *)
bReserved : Byte; (* not used, 0 *)
wPlanes : Word; (* not used, 0 *)
wBitCount : Word; (* not used, 0 *)
dwBytesInRes : LongInt; (* total number of bytes in images
*)
dwImageOffset : LongInt;(* location of image from the
beginning of file *)
End;
TBitmapInfoHeader = Record
biSize : LongInt; (* sizeof(TBitmapInfoHeader *)
biWidth : LongInt; (* width of bitmap *)
biHeight : LongInt; (* height of bitmap, see notes *)
biPlanes : Word; (* planes, always 1 *)
biBitCount : Word; (* number of color bits *)
biCompression : LongInt; (* compression used, 0 *)
biSizeImage : LongInt; (* size of the pixel data, see
notes *)
biXPelsPerMeter : LongInt; (* not used, 0 *)
biYPelsPerMeter : LongInt; (* not used, 0 *)
biClrUsed : LongInt; (* nr of colors used, set to
0 *)
biClrImportant : LongInt; (* important colors, set to 0
*)
End;
TRGBQuad = Record
rgbBlue : Byte; (* blue component of color *)
rgbGreen : Byte; (* green component of color *)
rgbRed : Byte; (* red component of color *)
rgbReserved : Byte; (* reserved, 0 *)
End;
TIconPalette = Array [0..15] Of
TRGBQuad;
TIcon = Record
Header : TIconHeader;
DirEntry : TIconDirEntry;
InfoHeader : TBitmapInfoHeader;
IconPalette : TIconPalette;
End;
Var
Icon : TIcon;
F : File Of
TIcon;
F2 : File Of
Byte;
I, J, K, L : Integer;
C, C2 : Byte;
Row : Array [1..32] Of
Byte;
Procedure SetPal (I, r, g, b : Byte);
Begin
port [$3c8] := I;
port [$3c9] := r;
port [$3c9] := g;
port [$3c9] := b;
End;
Begin
Assign (F, ParamStr (1) );
Reset (F);
Read (F, Icon);
Assign (F2, ParamStr (1) );
Reset (F2);
Seek (F2, 126);
Asm
mov al, 13h
Int 10h
End;
For I := 0 To 15 Do
SetPal (I, Icon.IconPalette [I] .rgbRed Div 4,
Icon.IconPalette [I] .rgbGreen Div 4,
Icon.IconPalette [I] .rgbBlue Div 4);
For I := 32 DownTo 1 Do
For J := 1 To 16 Do
Begin
Read (F2, C);
mem [$A000 : (80 + I) * 320 + (J * 2 - 1) + 140] := C Div 16;
mem [$A000 : (80 + I) * 320 + (J * 2) + 140] := C Mod 16;
End;
ReadLn;
Asm
mov al, 3h
Int 10h
End;
End.
{end of code}