home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1997 May
/
VPR9705A.ISO
/
VPR_DATA
/
PROGRAM
/
CBTRIAL
/
SETUP
/
DATA.Z
/
GRAPHICS.INT
< prev
next >
Wrap
Text File
|
1997-02-14
|
26KB
|
656 lines
{*******************************************************}
{ }
{ Delphi Visual Component Library }
{ }
{ Copyright (c) 1995-1997 Borland International }
{ }
{*******************************************************}
unit Graphics; // $Revision: 1.22 $
{$P+,S-,W-,R-}
{$C PRELOAD}
interface
uses Windows, SysUtils, Classes;
{ Graphics Objects }
type
TColor = $80000000..$7FFFFFFF;
const
clScrollBar = TColor(COLOR_SCROLLBAR or $80000000);
clBackground = TColor(COLOR_BACKGROUND or $80000000);
clActiveCaption = TColor(COLOR_ACTIVECAPTION or $80000000);
clInactiveCaption = TColor(COLOR_INACTIVECAPTION or $80000000);
clMenu = TColor(COLOR_MENU or $80000000);
clWindow = TColor(COLOR_WINDOW or $80000000);
clWindowFrame = TColor(COLOR_WINDOWFRAME or $80000000);
clMenuText = TColor(COLOR_MENUTEXT or $80000000);
clWindowText = TColor(COLOR_WINDOWTEXT or $80000000);
clCaptionText = TColor(COLOR_CAPTIONTEXT or $80000000);
clActiveBorder = TColor(COLOR_ACTIVEBORDER or $80000000);
clInactiveBorder = TColor(COLOR_INACTIVEBORDER or $80000000);
clAppWorkSpace = TColor(COLOR_APPWORKSPACE or $80000000);
clHighlight = TColor(COLOR_HIGHLIGHT or $80000000);
clHighlightText = TColor(COLOR_HIGHLIGHTTEXT or $80000000);
clBtnFace = TColor(COLOR_BTNFACE or $80000000);
clBtnShadow = TColor(COLOR_BTNSHADOW or $80000000);
clGrayText = TColor(COLOR_GRAYTEXT or $80000000);
clBtnText = TColor(COLOR_BTNTEXT or $80000000);
clInactiveCaptionText = TColor(COLOR_INACTIVECAPTIONTEXT or $80000000);
clBtnHighlight = TColor(COLOR_BTNHIGHLIGHT or $80000000);
cl3DDkShadow = TColor(COLOR_3DDKSHADOW or $80000000);
cl3DLight = TColor(COLOR_3DLIGHT or $80000000);
clInfoText = TColor(COLOR_INFOTEXT or $80000000);
clInfoBk = TColor(COLOR_INFOBK or $80000000);
clBlack = TColor($000000);
clMaroon = TColor($000080);
clGreen = TColor($008000);
clOlive = TColor($008080);
clNavy = TColor($800000);
clPurple = TColor($800080);
clTeal = TColor($808000);
clGray = TColor($808080);
clSilver = TColor($C0C0C0);
clRed = TColor($0000FF);
clLime = TColor($00FF00);
clYellow = TColor($00FFFF);
clBlue = TColor($FF0000);
clFuchsia = TColor($FF00FF);
clAqua = TColor($FFFF00);
clLtGray = TColor($C0C0C0);
clDkGray = TColor($808080);
clWhite = TColor($FFFFFF);
clNone = TColor($1FFFFFFF);
clDefault = TColor($20000000);
const
cmBlackness = BLACKNESS;
cmDstInvert = DSTINVERT;
cmMergeCopy = MERGECOPY;
cmMergePaint = MERGEPAINT;
cmNotSrcCopy = NOTSRCCOPY;
cmNotSrcErase = NOTSRCERASE;
cmPatCopy = PATCOPY;
cmPatInvert = PATINVERT;
cmPatPaint = PATPAINT;
cmSrcAnd = SRCAND;
cmSrcCopy = SRCCOPY;
cmSrcErase = SRCERASE;
cmSrcInvert = SRCINVERT;
cmSrcPaint = SRCPAINT;
cmWhiteness = WHITENESS;
type
HMETAFILE = THandle;
{$nonamespace HMETAFILE}
HENHMETAFILE = THandle;
{$nonamespace HENHMETAFILE}
EInvalidGraphic = class(Exception);
EInvalidGraphicOperation = class(Exception);
TGraphic = class;
TBitmap = class;
TIcon = class;
TMetafile = class;
TResData = record
Handle: THandle;
end;
TFontStyle = (fsBold, fsItalic, fsUnderline, fsStrikeOut);
TFontStyles = set of TFontStyle;
TFontPitch = (fpDefault, fpVariable, fpFixed);
TFontName = string[LF_FACESIZE - 1];
TFontCharset = 0..255;
TFontData = record
Handle: HFont;
Height: Integer;
Pitch: TFontPitch;
Style: TFontStyles;
Charset: TFontCharset;
Name: TFontName;
end;
TDummyFontStyles = set of TFontStyle;
TDummyFontName = string[LF_FACESIZE - 1];
TDummyFontData = record
Handle: HFont;
Height: Integer;
Pitch: TFontPitch;
Style: TDummyFontStyles;
Charset: TFontCharset;
Name: TDummyFontName;
end;
TPenStyle = (psSolid, psDash, psDot, psDashDot, psDashDotDot, psClear,
psInsideFrame);
TPenMode = (pmBlack, pmWhite, pmNop, pmNot, pmCopy, pmNotCopy,
pmMergePenNot, pmMaskPenNot, pmMergeNotPen, pmMaskNotPen, pmMerge,
pmNotMerge, pmMask, pmNotMask, pmXor, pmNotXor);
TPenData = record
Handle: HPen;
Color: TColor;
Width: Integer;
Style: TPenStyle;
end;
TBrushStyle = (bsSolid, bsClear, bsHorizontal, bsVertical,
bsFDiagonal, bsBDiagonal, bsCross, bsDiagCross);
TBrushData = record
Handle: HBrush;
Color: TColor;
Bitmap: TBitmap;
Style: TBrushStyle;
end;
PResource = ^TResource;
TResource = record
Next: PResource;
RefCount: Integer;
Handle: THandle;
HashCode: Word;
case Integer of
0: (Data: TResData);
1: (Font: TFontData);
2: (Pen: TPenData);
3: (Brush: TBrushData);
end;
TGraphicsObject = class(TPersistent)
protected
procedure Changed; dynamic;
public
property OnChange: TNotifyEvent;
end;
TFont = class(TGraphicsObject)
protected
function GetHandle: HFont;
function GetHeight: Integer;
function GetName: TFontName;
function GetPitch: TFontPitch;
function GetSize: Integer;
function GetStyle: TFontStyles;
function GetCharset: TFontCharset;
procedure SetColor(Value: TColor);
procedure SetHandle(Value: HFont);
procedure SetHeight(Value: Integer);
procedure SetName(const Value: TFontName);
procedure SetPitch(Value: TFontPitch);
procedure SetSize(Value: Integer);
procedure SetStyle(Value: TFontStyles);
procedure SetCharset(Value: TFontCharset);
public
constructor Create;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
property Handle: HFont;
property PixelsPerInch: Integer;
published
property Charset: TFontCharset default;
property Color: TColor;
property Height: Integer;
property Name: TFontName;
property Pitch: TFontPitch default fpDefault;
property Size: Integer;
property Style: TFontStyles;
end;
TPen = class(TGraphicsObject)
protected
function GetColor: TColor;
procedure SetColor(Value: TColor);
function GetHandle: HPen;
procedure SetHandle(Value: HPen);
procedure SetMode(Value: TPenMode);
function GetStyle: TPenStyle;
procedure SetStyle(Value: TPenStyle);
function GetWidth: Integer;
procedure SetWidth(Value: Integer);
public
constructor Create;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
property Handle: HPen;
published
property Color: TColor default clBlack;
property Mode: TPenMode default pmCopy;
property Style: TPenStyle default psSolid;
property Width: Integer default 1;
end;
TBrush = class(TGraphicsObject)
protected
function GetBitmap: TBitmap;
procedure SetBitmap(Value: TBitmap);
function GetColor: TColor;
procedure SetColor(Value: TColor);
function GetHandle: HBrush;
procedure SetHandle(Value: HBrush);
function GetStyle: TBrushStyle;
procedure SetStyle(Value: TBrushStyle);
public
constructor Create;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
property Bitmap: TBitmap;
property Handle: HBrush;
published
property Color: TColor default clWhite;
property Style: TBrushStyle default bsSolid;
end;
TFillStyle = (fsSurface, fsBorder);
TFillMode = (fmAlternate, fmWinding);
TCopyMode = Longint;
TCanvasStates = (csHandleValid, csFontValid, csPenValid, csBrushValid);
TCanvasState = set of TCanvasStates;
TCanvas = class(TPersistent)
protected
procedure Changed; virtual;
procedure Changing; virtual;
procedure CreateHandle; virtual;
procedure RequiredState(ReqState: TCanvasState);
public
constructor Create;
destructor Destroy; override;
procedure Arc(X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer);
procedure BrushCopy(const Dest: TRect; Bitmap: TBitmap;
const Source: TRect; Color: TColor);
procedure Chord(X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer);
procedure CopyRect(const Dest: TRect; Canvas: TCanvas;
const Source: TRect);
procedure Draw(X, Y: Integer; Graphic: TGraphic);
procedure DrawFocusRect(const Rect: TRect);
procedure Ellipse(X1, Y1, X2, Y2: Integer);
procedure FillRect(const Rect: TRect);
procedure FloodFill(X, Y: Integer; Color: TColor; FillStyle: TFillStyle);
procedure FrameRect(const Rect: TRect);
procedure LineTo(X, Y: Integer);
procedure MoveTo(X, Y: Integer);
procedure Pie(X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer);
procedure Polygon(const Points: array of TPoint);
procedure Polyline(const Points: array of TPoint);
procedure Rectangle(X1, Y1, X2, Y2: Integer);
procedure Refresh;
procedure RoundRect(X1, Y1, X2, Y2, X3, Y3: Integer);
procedure StretchDraw(const Rect: TRect; Graphic: TGraphic);
function TextHeight(const Text: string): Integer;
procedure TextOut(X, Y: Integer; const Text: string);
procedure TextRect(Rect: TRect; X, Y: Integer; const Text: string);
function TextWidth(const Text: string): Integer;
property ClipRect: TRect;
property Handle: HDC;
property PenPos: TPoint;
property Pixels[X, Y: Integer]: TColor;
property OnChange: TNotifyEvent;
property OnChanging: TNotifyEvent;
published
property Brush: TBrush;
property CopyMode: TCopyMode default cmSrcCopy;
property Font: TFont;
property Pen: TPen;
end;
{ The TGraphic class is a abstract base class for dealing with graphic images
such as metafile, bitmaps and icons; but is not limited to such.
LoadFromFile - Read the graphic from the file system. The old contents of
the graphic are lost. If the file is not of the right format, an
exception will be generated.
SaveToFile - Writes the graphic to disk in the file provided.
LoadFromStream - Like LoadFromFile except source is a stream (e.g.
TBlobStream).
SaveToStream - stream analogue of SaveToFile.
LoadFromClipboardFormat - Replaces the current image with the data
provided. If the TGraphic does not support that format it will generate
an exception.
SaveToClipboardFormats - Converts the image to a clipboard format. If the
image does not support being translated into a clipboard format it
will generate an exception.
Height - The native, unstretched, height of the graphic.
Width - The native, unstretched, width of the graphic.
OnChange - Called whenever the graphic changes }
TGraphic = class(TPersistent)
protected
constructor Create; virtual;
procedure Changed(Sender: TObject);
procedure DefineProperties(Filer: TFiler); override;
procedure Draw(ACanvas: TCanvas; const Rect: TRect); virtual; abstract;
function Equals(Graphic: TGraphic): Boolean; virtual;
function GetEmpty: Boolean; virtual; abstract;
function GetHeight: Integer; virtual; abstract;
function GetWidth: Integer; virtual; abstract;
procedure ReadData(Stream: TStream); virtual;
procedure SetHeight(Value: Integer); virtual; abstract;
procedure SetWidth(Value: Integer); virtual; abstract;
procedure WriteData(Stream: TStream); virtual;
public
procedure LoadFromFile(const Filename: string); virtual;
procedure SaveToFile(const Filename: string); virtual;
procedure LoadFromStream(Stream: TStream); virtual; abstract;
procedure SaveToStream(Stream: TStream); virtual; abstract;
procedure LoadFromClipboardFormat(AFormat: Word; AData: THandle;
APalette: HPALETTE); virtual; abstract;
procedure SaveToClipboardFormat(var AFormat: Word; var AData: THandle;
var APalette: HPALETTE); virtual; abstract;
property Empty: Boolean;
property Height: Integer;
property Modified: Boolean;
property Width: Integer;
property OnChange: TNotifyEvent;
end;
TGraphicClass = class of TGraphic;
{ TPicture }
{ TPicture is a TGraphic container. It is used in place of a TGraphic if the
graphic can be of any TGraphic class. LoadFromFile and SaveToFile are
polymorphic. For example, if the TPicture is holding an Icon, you can
LoadFromFile a bitmap file, where if the class was TIcon you could only read
.ICO files.
LoadFromFile - Reads a picture from disk. The TGraphic class created
determined by the file extension of the file. If the file extension is
not recognized an exception is generated.
SaveToFile - Writes the picture to disk.
LoadFromClipboardFormat - Reads the picture from the handle provided in
the given clipboard format. If the format is not supported, an
exception is generated.
SaveToClipboardFormats - Allocates a global handle and writes the picture
in its native clipboard format (CF_BITMAP for bitmaps, CF_METAFILE
for metafiles, etc.). Formats will contain the formats written.
Returns the number of clipboard items written to the array pointed to
by Formats and Datas or would be written if either Formats or Datas are
nil.
SupportsClipboardFormat - Returns true if the given clipboard format
is supported by LoadFromClipboardFormat.
Assign - Copys the contents of the given TPicture. Used most often in
the implementation of TPicture properties.
RegisterFileFormat - Register a new TGraphic class for use in
LoadFromFile.
RegisterClipboardFormat - Registers a new TGraphic class for use in
LoadFromClipboardFormat.
Height - The native, unstretched, height of the picture.
Width - The native, unstretched, width of the picture.
Graphic - The TGraphic object contained by the TPicture
Bitmap - Returns a bitmap. If the contents is not already a bitmap, the
contents are thrown away and a blank bitmap is returned.
Icon - Returns an icon. If the contents is not already an icon, the
contents are thrown away and a blank icon is returned.
Metafile - Returns a metafile. If the contents is not already a metafile,
the contents are thrown away and a blank metafile is returned. }
TPicture = class(TPersistent)
protected
procedure AssignTo(Dest: TPersistent); override;
procedure Changed(Sender: TObject);
procedure DefineProperties(Filer: TFiler); override;
public
destructor Destroy; override;
procedure LoadFromFile(const Filename: string);
procedure SaveToFile(const Filename: string);
procedure LoadFromClipboardFormat(AFormat: Word; AData: THandle;
APalette: HPALETTE);
procedure SaveToClipboardFormat(var AFormat: Word; var AData: THandle;
var APalette: HPALETTE);
class function SupportsClipboardFormat(AFormat: Word): Boolean;
procedure Assign(Source: TPersistent); override;
class procedure RegisterFileFormat(const AExtension, ADescription: string;
AGraphicClass: TGraphicClass);
class procedure RegisterFileFormatRes(const AExtension: String;
ADescriptionResID: Integer; AGraphicClass: TGraphicClass);
class procedure RegisterClipboardFormat(AFormat: Word;
AGraphicClass: TGraphicClass);
property Bitmap: TBitmap;
property Graphic: TGraphic;
property Height: Integer;
property Icon: TIcon;
property Metafile: TMetafile;
property Width: Integer;
property OnChange: TNotifyEvent;
end;
{ TMetafile }
{ TMetafile is an encapsulation of the Win32 Enhanced metafile.
Handle - The metafile handle.
Enhanced - determines how the metafile will be stored on disk.
Enhanced = True (default) stores as EMF (Win32 Enhanced Metafile),
Enhanced = False stores as WMF (Windows 3.1 Metafile, with Aldus header).
The in-memory format is always EMF. WMF has very limited capabilities;
storing as WMF will lose information that would be retained by EMF.
This property is set to match the metafile type when loaded from a
stream or file. This maintains form file compatibility with 16 bit
Delphi (If loaded as WMF, then save as WMF).
Inch - The units per inch assumed by a WMF metafile. Used to alter
scale when writing as WMF, but otherwise this property is obsolete.
Enhanced metafiles maintain complete scale information internally.
MMWidth,
MMHeight: Width and Height in 0.01 millimeter units, the native
scale used by enhanced metafiles. The Width and Height properties
are always in screen device pixel units; you can avoid loss of
precision in converting between device pixels and mm by setting
or reading the dimentions in mm with these two properties.
CreatedBy - Optional name of the author or application used to create
the metafile.
Description - Optional text description of the metafile.
You can set the CreatedBy and Description of a new metafile by calling
TMetafileCanvas.CreateWithComment.
TMetafileCanvas
To create a metafile image from scratch, you must draw the image in
a metafile canvas. When the canvas is destroyed, it transfers the
image into the metafile object provided to the canvas constructor.
After the image is drawn on the canvas and the canvas is destroyed,
the image is 'playable' in the metafile object. Like this:
MyMetafile := TMetafile.Create;
with TMetafileCanvas.Create(MyMetafile, 0) do
try
Brush.Color := clRed;
Ellipse(0,0,100,100);
...
finally
Free;
end;
Form1.Canvas.Draw(0,0,MyMetafile); (* 1 red circle *)
To add to an existing metafile image, create a metafile canvas
and play the source metafile into the metafile canvas. Like this:
(* continued from previous example, so MyMetafile contains an image *)
with TMetafileCanvas.Create(MyMetafile, 0) do
try
Draw(0,0,MyMetafile);
Brush.Color := clBlue;
Ellipse(100,100,200,200);
...
finally
Free;
end;
Form1.Canvas.Draw(0,0,MyMetafile); (* 1 red circle and 1 blue circle *)
}
TMetafileCanvas = class(TCanvas)
public
constructor Create(AMetafile: TMetafile; ReferenceDevice: HDC);
constructor CreateWithComment(AMetafile: TMetafile; ReferenceDevice: HDC;
const CreatedBy, Description: String);
destructor Destroy; override;
end;
TMetafileImage = class
end;
TMetafile = class(TGraphic)
protected
function GetEmpty: Boolean; override;
function GetHeight: Integer; override;
function GetWidth: Integer; override;
procedure Draw(ACanvas: TCanvas; const Rect: TRect); override;
procedure ReadData(Stream: TStream); override;
procedure ReadEMFStream(Stream: TStream);
procedure ReadWMFStream(Stream: TStream; Length: Longint);
procedure SetHeight(Value: Integer); override;
procedure SetWidth(Value: Integer); override;
function TestEMF(Stream: TStream): Boolean;
procedure WriteData(Stream: TStream); override;
procedure WriteEMFStream(Stream: TStream);
procedure WriteWMFStream(Stream: TStream);
public
constructor Create; override;
destructor Destroy; override;
procedure Clear;
procedure LoadFromStream(Stream: TStream); override;
procedure SaveToFile(const Filename: String); override;
procedure SaveToStream(Stream: TStream); override;
procedure LoadFromClipboardFormat(AFormat: Word; AData: THandle;
APalette: HPALETTE); override;
procedure SaveToClipboardFormat(var AFormat: Word; var AData: THandle;
var APalette: HPALETTE); override;
procedure Assign(Source: TPersistent); override;
property CreatedBy: String;
property Description: String;
property Enhanced: Boolean default True;
property Handle: HENHMETAFILE;
property MMWidth: Integer;
property MMHeight: Integer;
property Inch: Word;
property Palette: HPALETTE;
end;
{ TBitmap }
{ TBitmap is an encapsulation of a Windows HBITMAP and HPALETTE. It manages
the palette realizing automatically as well as having a Canvas to allow
modifications to the palette. Creating copies of a TBitmap is very fast
since the handles is copied not the image. If the image is modified, and
the handle is shared by more than one TBitmap object, the image is copied
before the modification is performed (i.e. copy on write).
Canvas - Allows drawing on the bitmap.
Handle - The HBITMAP encapsulated by the TBitmap. Grabbing the handle
directly should be avoided since it causes the HBITMAP to be copied if
more than one TBitmap share the handle.
Palette - The HPALETTE realized by the TBitmap. Grabbing this handle
directly should be avoided since it causes the HPALETTE to be copied if
more than one TBitmap share the handle.
Monochrome - True if the bitmap is a monochrome bitmap }
TInternalImage = class
end;
TDIBType = (dtNone, dtWin, dtPM);
TBitmapImage = class(TInternalImage)
end;
TBitmap = class(TGraphic)
protected
procedure Draw(ACanvas: TCanvas; const Rect: TRect); override;
function GetEmpty: Boolean; override;
function GetHeight: Integer; override;
function GetWidth: Integer; override;
procedure ReadData(Stream: TStream); override;
procedure SetWidth(Value: Integer); override;
procedure SetHeight(Value: Integer); override;
procedure WriteData(Stream: TStream); override;
public
constructor Create; override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
procedure Dormant;
procedure FreeImage;
procedure LoadFromClipboardFormat(AFormat: Word; AData: THandle;
APalette: HPALETTE); override;
procedure LoadFromStream(Stream: TStream); override;
procedure LoadFromResourceName(Instance: THandle; const ResName: String);
procedure LoadFromResourceID(Instance: THandle; ResID: Integer);
function ReleaseHandle: HBITMAP;
function ReleasePalette: HPALETTE;
procedure SaveToClipboardFormat(var Format: Word; var Data: THandle;
var APalette: HPALETTE); override;
procedure SaveToStream(Stream: TStream); override;
property Canvas: TCanvas;
property Handle: HBITMAP;
property Monochrome: Boolean;
property Palette: HPALETTE;
property IgnorePalette: Boolean;
property TransparentColor: TColor;
end;
{ TIcon }
{ TIcon encapsulates window HICON handle. Drawing of an icon does not stretch
so calling stretch draw is not meaningful.
Handle - The HICON used by the TIcon. }
TIconImage = class(TInternalImage)
end;
TIcon = class(TGraphic)
protected
procedure Draw(ACanvas: TCanvas; const Rect: TRect); override;
function GetEmpty: Boolean; override;
function GetHeight: Integer; override;
function GetWidth: Integer; override;
procedure SetHeight(Value: Integer); override;
procedure SetWidth(Value: Integer); override;
procedure LoadFromClipboardFormat(AFormat: Word; AData: THandle;
APalette: HPALETTE); override;
procedure SaveToClipboardFormat(var Format: Word; var Data: THandle;
var APalette: HPALETTE); override;
public
constructor Create; override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
procedure LoadFromStream(Stream: TStream); override;
function ReleaseHandle: HICON;
procedure SaveToStream(Stream: TStream); override;
property Handle: HICON;
end;
var // New TFont instances are intialized with the values in this structure:
DefFontData: TFontData = (
Handle: 0;
Height: 0;
Pitch: fpDefault;
Style: [];
Charset: DEFAULT_CHARSET;
Name: 'MS Sans Serif');
function GraphicFilter(GraphicClass: TGraphicClass): string;
function GraphicExtension(GraphicClass: TGraphicClass): string;
function ColorToRGB(Color: TColor): Longint;
function ColorToString(Color: TColor): string;
function StringToColor(const S: string): TColor;
procedure GetColorValues(Proc: TGetStrProc);
function ColorToIdent(Color: Longint; var Ident: string): Boolean;
function IdentToColor(const Ident: string; var Color: Longint): Boolean;
procedure GetCharsetValues(Proc: TGetStrProc);
function CharsetToIdent(Charset: Longint; var Ident: string): Boolean;
function IdentToCharset(const Ident: string; var Charset: Longint): Boolean;
function GetDefFontCharSet: TFontCharSet;
function MemAlloc(Size: Longint): Pointer;
procedure GetDIBSizes(Bitmap: HBITMAP; var InfoHeaderSize: Integer;
var ImageSize: DWORD);
function GetDIB(Bitmap: HBITMAP; Palette: HPALETTE; var BitmapInfo; var Bits): Boolean;
function CopyPalette(Palette: HPALETTE): HPALETTE;
procedure InitGraphics;
procedure PaletteChanged;
procedure FreeMemoryContexts;
implementation