3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
8 * See LICENSING which should be included
9 * along with this file for more details
12 #ifndef __FELIB_COLORBIT_H__
13 #define __FELIB_COLORBIT_H__
30 typedef std::map
<col16
, std::pair
<cachedfont
*, cachedfont
*> > fontcache
;
33 /* actually this is simple 256-color with palette PCX codec */
36 rawbitmap (cfestring
&FileName
);
39 void Save (cfestring
&FileName
);
40 void MaskedBlit (bitmap
*Bitmap
, v2 Src
, v2 Dest
, v2 Border
, packcol16
*Color
) const;
41 void MaskedBlit (bitmap
*Bitmap
, packcol16
*Color
) const;
43 void LIKE_PRINTF(5, 6) Printf (bitmap
*Bitmap
, v2 Pos
, packcol16 Color
, cchar
*Format
, ...) const;
44 void LIKE_PRINTF(5, 6) PrintfColored (bitmap
*Bitmap
, v2 Pos
, packcol16 Color
, cchar
*Format
, ...) const;
45 void LIKE_PRINTF(5, 6) PrintfUnshaded (bitmap
*Bitmap
, v2 Pos
, packcol16 Color
, cchar
*Format
, ...) const;
46 void LIKE_PRINTF(5, 6) PrintfUnshadedColored (bitmap
*Bitmap
, v2 Pos
, packcol16 Color
, cchar
*Format
, ...) const;
47 cachedfont
*Colorize (cpackcol16
*Color
, alpha BaseAlpha
=255, cpackalpha
*Alpha
=0) const;
48 bitmap
*Colorize (v2 Pos
, v2 Border
, v2 Move
, cpackcol16
*Color
, alpha BaseAlpha
=255,
49 cpackalpha
*Alpha
=0, cuchar
*RustData
=0, truth AllowReguralColors
=true) const;
50 v2
GetSize () const { return Size
; }
52 void AlterGradient (v2 Pos
, v2 Border
, int MColor
, int Amount
, truth Clip
);
53 void SwapColors (v2 Pos
, v2 Border
, int Color1
, int Color2
);
54 void Roll (v2 Pos
, v2 Border
, v2 Move
, paletteindex
*TempBuffer
);
56 void CreateFontCache (packcol16 Color
);
57 static truth
IsMaterialColor (int Color
) { return Color
>= 192; }
58 static int GetMaterialColorIndex (int Color
) { return (Color
-192) >> 4; }
59 int GetMaterialColorIndex (int X
, int Y
) const { return (PaletteBuffer
[Y
][X
]-192) >> 4; }
60 truth
IsTransparent (v2 Pos
) const;
61 truth
IsMaterialColor1 (v2 Pos
) const;
62 v2
RandomizeSparklePos (cv2
*ValidityArray
, v2
*PossibleBuffer
, v2 Pos
, v2 Border
, int ValidityArraySize
, int SparkleFlags
) const;
63 void CopyPaletteFrom (rawbitmap
*Bitmap
);
64 void PutPixel (v2 Pos
, paletteindex Color
) { PaletteBuffer
[Pos
.Y
][Pos
.X
] = Color
; }
65 paletteindex
GetPixel (v2 Pos
) const { return PaletteBuffer
[Pos
.Y
][Pos
.X
]; }
67 void NormalBlit (rawbitmap
*Bitmap
, v2 Src
, v2 Dest
, v2 Border
, int Flags
=0) const;
69 const uChar
*getPalette () const { return Palette
; }
70 const uChar
*getBuffer () const { return PaletteBuffer
[0]; }
73 static truth
strHasCtlCodes (cchar
*str
);
74 void printfColoredVA (bitmap
*bmp
, v2 pos
, packcol16 clr
, truth shaded
, cchar
*fmt
, va_list vap
) const;
75 void printstrColored (bitmap
*bmp
, v2 pos
, packcol16 clr
, truth shaded
, cchar
*str
) const;
78 void loadFromFile (FILE *fl
);
79 void loadPCX (FILE *fl
);
81 void loadPNG (FILE *fl
);
84 static festring curfile
;
85 static unsigned char getb (FILE* fl
);
90 paletteindex
**PaletteBuffer
;