~ubuntu-branches/ubuntu/warty/xplanet/warty

« back to all changes in this revision

Viewing changes to src/libdisplay/DisplayBase.h

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-08-24 07:14:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040824071400-2dr4qnjbjmm8z3ia
Tags: 1.0.6-1ubuntu1
Build-depend: libtiff4-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef DisplayBase_h
 
2
#define DisplayBase_h
 
3
 
 
4
#include <string>
 
5
#include <vector>
 
6
 
 
7
#include "config.h"
 
8
 
 
9
#define TEXTRENDERER
 
10
 
 
11
#ifdef TEXTRENDERER
 
12
#include "TextRenderer.h"
 
13
#else
 
14
 
 
15
#endif
 
16
class PlanetProperties;
 
17
 
 
18
class DisplayBase
 
19
{
 
20
public:
 
21
    DisplayBase(const int tr);
 
22
    virtual ~DisplayBase();
 
23
 
 
24
    int Width() const { return(width_); };
 
25
    int Height() const { return(height_); };
 
26
 
 
27
    void setPixel(const double X, const double Y,
 
28
                  const unsigned char color[3]);
 
29
    void setPixel(const int x, const int y, const unsigned int value);
 
30
    void setPixel(const int x, const int y, const unsigned char pixel[3]);
 
31
    void setPixel(const int x, const int y, const unsigned char pixel[3],
 
32
                  const double opacity);
 
33
    void getPixel(const int x, const int y, unsigned char pixel[3]) const;
 
34
 
 
35
    virtual void renderImage(PlanetProperties *planetProperties[]) = 0;
 
36
 
 
37
    const std::string & Font() const { return(textRenderer_->Font()); };
 
38
    int FontSize() const { return(textRenderer_->FontSize()); };
 
39
 
 
40
    void Font(const std::string &fontname);
 
41
    void FontSize(const int size);
 
42
 
 
43
    void setText(const std::string &text);
 
44
    void DrawOutlinedText(const int x, int y, const std::string &text, 
 
45
                          const unsigned char color[3]);
 
46
    void FreeText();
 
47
    void getTextBox(int &textWidth, int &textHeight);
 
48
 
 
49
    virtual std::string TmpDir();
 
50
 
 
51
protected:
 
52
    const int times_run;
 
53
 
 
54
    int width_, height_;
 
55
    int area_;
 
56
    unsigned char *rgb_data;
 
57
    unsigned char *alpha;
 
58
 
 
59
    int fullWidth_, fullHeight_;       // pixel dimensions of the display
 
60
 
 
61
    void allocateRGBData();
 
62
    void drawLabel(PlanetProperties *planetProperties[]);
 
63
    void drawLabelLine(int &currentX, int &currentY, 
 
64
                       const std::string &text);
 
65
    void PlaceImageOnRoot();
 
66
 
 
67
    void SetBackground(const int width, const int height, 
 
68
                       unsigned char *rgb);
 
69
 
 
70
private:
 
71
    TextRenderer *textRenderer_;
 
72
};
 
73
#endif