source: golgotha/src/max_plugin/sdk_inc/gport.h @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 11 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
  • Property svn:keywords set to Id
File size: 3.8 KB
Line 
1/**********************************************************************
2 *<
3        FILE: gport.h
4
5        DESCRIPTION: Palette management.
6
7        CREATED BY: Dan Silva
8
9        HISTORY:
10
11 *>     Copyright (c) 1994, All Rights Reserved.
12 **********************************************************************/
13
14#ifndef __GPORT__H
15#define __GPORT__H
16
17
18class GPort {
19        public:
20                // get the palette index associated with the ith slot
21                virtual int AnimPalIndex(int i)=0;
22       
23                // returns a slot number if available, -1 if not:
24                // typically called in WM_INITDIALOG processing for as
25                // may slots as you need (total availible is 8)
26                virtual int GetAnimPalSlot()=0;
27
28                // Release an animated palete slot slot
29                // Typically called in WM_DESTROY for each slot
30                // obtained with GetAnimPalSlot
31                virtual void ReleaseAnimPalSlot(int i)=0;
32
33                // set the color associated with the ith animated slot
34                virtual void SetAnimPalEntry(int i, COLORREF cr)=0;
35
36                // Stuff the standard MAX palette the palette for the HDC,
37                // handing back a handle to the old palette.
38                virtual HPALETTE PlugPalette(HDC hdc)=0;
39
40                // Create a brush for drawing with the ith animated palette slot color
41                virtual HBRUSH MakeAnimBrush(int slotNum, COLORREF col )=0;
42
43                // Update colors calls the Windows UpdateColors on the hdc.
44                // Returns 1 iff it changed screen pixel values .
45                // Call this when get WM_PALETTECHANGED Msg
46                virtual int UpdateColors(HDC hdc)=0;
47
48                // After several SetAnimPalEntry calls, call this to affect the
49                // HDC's palette
50                virtual void AnimPalette(HDC hdc)=0;
51
52                // The companion function to PlugPalette.
53                virtual void RestorePalette(HDC hDC,HPALETTE hOldPal)=0;
54
55                // Map an single row of pixels 24 bit color to indices into
56                // the current GPort palette, applying a dither pattern.
57                // This routine does NOT do gamma correction.
58                // inp points to an array of width RGB triples.
59                // outp is an array of width bytes.  x and y are necessary to
60                // establish dither pattern alignment.
61                virtual void MapPixels(UBYTE* inp, UBYTE *outp, int x, int y, int width)=0;
62
63                 
64                // Display an array of 24bit colors in the HDC: if the current display is 8 bit
65                //  it will display it (with dither) using in the GPort palette, otherwise it
66                //  will just blit to the screen. Does NOT do gamma correction.
67                //   "drect" is the destination rectangle in the hdc.
68                //   "map" points to an array of RGB triples, with bytesPerRow bytes on each scanline.
69                //   "xsrc" and "ysrc" are the position within this source raster of the upper left
70                //    corner of the rectangle to be copied..
71                virtual void DisplayMap(HDC hdc, Rect& drect,int xsrc, int ysrc, UBYTE *map, int bytesPerRow)=0;
72               
73                // This version stretches the image (if src!=dest).
74                //  "dest" is the destination rectangle in the hdc;
75                //  "src" is the source rectangle in map.
76                virtual void DisplayMap(HDC hdc, Rect& dest, Rect& src, UBYTE *map, int bytesPerRow)=0;
77
78                // DitherColorSwatch first gamma corrects Color c using the current
79                // display gamma. In paletted modes, it will fill rectangle "r" with
80                // a dithered pattern  approximating Color c.  In 24 bit modes it just
81                // fills the rectange with c.
82                virtual void DitherColorSwatch(HDC hdc, Rect& r, Color c)=0;
83
84                // This attempts to use the animated color slot indicated by "slot"
85                // to paint a rectangular color swatch.
86                // If slot is -1, it will uses DitherColorSwatch.  It does gamma correction.
87                virtual void PaintAnimPalSwatch(HDC hdc, DWORD col, int slot, int left, int top, int right, int bottom)=0;
88
89                // get the current GPort palette.
90                virtual HPALETTE GetPalette()=0;
91        };
92
93// Normally this is the only one of these, and this gets you a pointer to it.
94extern CoreExport GPort* GetGPort();
95
96
97#endif // __GPORT__H
Note: See TracBrowser for help on using the repository browser.