root/trunk/BMP.h

Revision 14, 2.7 kB (checked in by sagrer, 4 months ago)

Поковырял код на предмет понять "где что есть". Заодно добавил везде шапку и вбил дополнительно в конфиг проекта те модули, которые вбиты не были - чтобы можно было быстро открыть любой файл через окно менеджера проекта.

Line 
1 ///////////////////////////////////////////////////////////
2 //                        TexGen                         //
3 //          утилита для подготовки текстур рельефа       //
4 //               для игры Проклятые Земли                //
5 //           Copyright (C) 2007-2008 Gipat Group         //
6 //              Распространяется на условиях             //
7 //    Gipat Group's opened EI-editor-utility license     //
8 //                      версии 1.0                       //
9 //                                                       //
10 //                  www.gipatgroup.org                   //
11 ///////////////////////////////////////////////////////////
12
13 //К работе над данным файлом приложили руки, ноги.... короче аффтары:
14 // 1) Снайпер (sniper-rifle@rambler.ru)
15
16 ////////////////////////////////////////////////////////////////////////
17
18
19 #ifndef BMPH
20 #define BMPH
21
22 #include <dstring.h>
23 #include <StrUtils.hpp>
24 #include <SysUtils.hpp>
25 #include <stdio.h>
26 #include "Mask.h"
27
28
29 class CBitMap
30 {
31 private:
32         int W,H,DeltaZero;//Дельтазеро - это количество нулей в конце каждой строки %(
33         int RealSize;
34         bool Inited;
35         short int D;
36         byte *Buffer;
37 public:
38 /**/    int Width(){return W;}
39 /**/    int Height(){return H;}
40 /**/    int PicWeight(){return H*(W*3+DeltaZero);}
41
42         struct ColorRGB
43         {
44           byte Red,Green,Blue;
45           operator == (ColorRGB &Other)
46           {
47             bool b;
48             b = (Red == Other.Red) && (Green==Other.Green) && (Blue == Other.Blue );
49             return b;
50           }
51         };
52
53 //        CBitMap(){this=CBitMap(1,1,Clr2RGB(0,0,0));}
54 /**/    CBitMap(int XSize, int YSize, ColorRGB Clr);
55         CBitMap(AnsiString FName);
56
57         ~CBitMap(){if(Inited)delete [] Buffer;}
58
59         void Save(AnsiString FName);
60         ColorRGB GetPixel(int X, int Y);
61 /**/    ColorRGB Clr2RGB(int R, int G, int B){ColorRGB a; a.Red = R; a.Green = G; a.Blue = B; return a;}
62         ColorRGB MergePixel(ColorRGB P1, ColorRGB P2, int Value1, int Value2);
63         void SetPixel(int X, int Y, ColorRGB Clr);
64
65         AnsiString ColorToString(ColorRGB Clr){return IntToStr(Clr.Red)+"/"+IntToStr(Clr.Green)+"/"+IntToStr(Clr.Blue);}
66
67         void Paste(int X,int Y, CBitMap *BMP);
68         void Paste(int X,int Y, CBitMap *BMP, CBitMap *Mask, ColorRGB SolidColor);
69         void Paste(int X,int Y, CBitMap *B1, CBitMap *B2, CBitMap *B3, CTileMask *M);
70         void Copy (int X,int Y, CBitMap *BMP);
71         void Resize(int W, int H, bool Smooth=false);
72
73         //И наконец - тупейшие функции для округления чисел
74         int floor(float X);
75         int ceil (float X);
76 };
77
78 #endif
Note: See TracBrowser for help on using the browser.