diff options
author | pixel <pixel> | 2004-11-27 21:48:01 +0000 |
---|---|---|
committer | pixel <pixel> | 2004-11-27 21:48:01 +0000 |
commit | f9969775e6d2f798a3bfea5c58fc5478dad07eae (patch) | |
tree | c82d4ed9c87d7e09c71be3554ac5d0486c774eda /include/shape.h | |
parent | 1ae229afb9bff4a3636c08632032b509e1e80ec4 (diff) |
Large dos2unix commit...
Diffstat (limited to 'include/shape.h')
-rw-r--r-- | include/shape.h | 394 |
1 files changed, 197 insertions, 197 deletions
diff --git a/include/shape.h b/include/shape.h index d5932cd..72feba2 100644 --- a/include/shape.h +++ b/include/shape.h @@ -1,197 +1,197 @@ -/*
- * mogltk
- * Copyright (C) 1999-2004 Nicolas "Pixel" Noble
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* $Id: shape.h,v 1.15 2004-11-27 21:44:50 pixel Exp $ */
-
-#ifndef __SHAPE_H__
-#define __SHAPE_H__
-
-#include <vector>
-#include <Exceptions.h>
-#include <BString.h>
-#include <mcolor.h>
-#include <texture.h>
-
-namespace mogltk {
- typedef enum {
- LEFT,
- CENTER,
- RIGHT
- } align_t;
- class fillwalker : public Base {
- public:
- fillwalker();
- virtual ~fillwalker();
- virtual void step(int x, int y);
- };
- class segwalker : public Base {
- public:
- segwalker();
- virtual ~segwalker();
- virtual void step(int x1, int y1, int x2, int y2);
- };
- class fill : public Base {
- public:
- fill();
- virtual ~fill();
- void walk(fillwalker *);
- void swalk(segwalker *);
- void insert(int, int, int, int);
- void insertfix(int, int);
- int GetMinX() const;
- int GetMinY() const;
- int GetMaxX() const;
- int GetMaxY() const;
- texture * GetTexture();
- texture * Talloc();
- texture * GetSTexture();
- texture * STalloc();
- Color last;
- private:
- void insert(int, int);
- struct segment {
- int x1, y1, x2, y2;
- };
- class sline : public Base {
- public:
- sline(int, fill *);
- virtual ~sline();
- int GetY() const;
- void insert(int, int);
- void insertfix(int, int);
- void walk(fillwalker *);
- private:
- class point : public Base {
- public:
- point(int, sline *);
- virtual ~point();
- int GetX() const;
- int GetY() const;
- void walk(fillwalker *);
- point * look(int);
- private:
- int x;
- point * next;
- sline * header;
- };
- int y;
- sline * next;
- fill * header;
- sline * look(int);
- protected:
- point * pheader;
- friend class point;
- private:
- int count() const;
- };
- int minX, minY, maxX, maxY;
- texture * cached;
- texture * scached;
- std::vector<segment> segments;
- protected:
- sline * header;
- friend class sline;
- };
- class shape : public Base {
- public:
- shape(SDL_Surface * = 0);
- virtual void pixel(int x, int y, ColorP = WHITE);
- virtual void circle(int x, int y, int r, ColorP = WHITE);
- virtual void pcircle(int x, int y, int r, ColorP = WHITE);
- virtual fill * fcircle(int x, int y, int r);
- virtual void fdraw(fill *, ColorP = WHITE, int sx = 0, int sy = 0);
- virtual void sdraw(fill *, ColorP = WHITE, int sx = 0, int sy = 0);
- virtual void box(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE);
- virtual void box3d(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, int = 2, bool = false);
- virtual void box(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP);
- virtual void obox(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE);
- virtual void obox3d(int x1, int y1, int x2, int y2, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false);
- virtual void obox(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP);
- virtual void hline(int x1, int x2, int y, ColorP = DOS_WHITE);
- virtual void hline3d(int x1, int x2, int y, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false);
- virtual void hline(int x1, int x2, int y, ColorP, ColorP);
- virtual void vline(int x, int y1, int y2, ColorP = DOS_WHITE);
- virtual void vline3d(int x, int y1, int y2, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false);
- virtual void vline(int x, int y1, int y2, ColorP, ColorP);
- virtual void line(int x1, int y1, int x2, int y2, ColorP = WHITE);
- virtual void tbox(texture *, int x1, int y1, int x2, int y2, int tx = 0, int ty = 0, double = 1.0, ColorP = WHITE);
- virtual void tbox(texture *, int x1, int y1, int x2, int y2, int tx1, int ty1, int tx2, int ty2, ColorP = WHITE);
- virtual void tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx = 0, int ty = 0, double = 1.0);
- virtual void tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx1, int ty1, int tx2, int ty2);
- virtual void window(int x1, int y1, int x2, int y2,
- const String & title = "",
- ColorP titlecolor = DOS_HIGH_WHITE,
- ColorP titlebackcolor = DOS_MAGENTA,
- ColorP front = DOS_WHITE,
- ColorP shade1 = DOS_HIGH_WHITE,
- ColorP shade2 = DOS_GRAY);
- virtual void text(int x, int y, const String &,
- ColorP textcolor = DOS_HIGH_WHITE,
- align_t align = LEFT);
- virtual void text3d(int x, int y, const String &,
- ColorP textcolor = DOS_BLACK,
- ColorP shade1 = DOS_HIGH_WHITE,
- ColorP shade2 = DOS_GRAY,
- align_t align = LEFT,
- bool bevel = false);
- virtual void button(int x1, int y1, int x2, int y2, const String &,
- bool bevel = false,
- ColorP front = DOS_WHITE,
- ColorP shade1 = DOS_HIGH_WHITE,
- ColorP shade2 = DOS_GRAY,
- ColorP round = DOS_BLACK,
- ColorP textcolor = DOS_BLACK,
- ColorP tshade1 = DOS_HIGH_WHITE,
- ColorP tshade2 = DOS_GRAY);
- SDL_Surface * GetSurf();
- private:
- void bsubline_1(int x1, int y1, int x2, int y2, ColorP = WHITE);
- void bsubline_2(int x1, int y1, int x2, int y2, ColorP = WHITE);
- void bsubline_3(int x1, int y1, int x2, int y2, ColorP = WHITE);
- void bsubline_4(int x1, int y1, int x2, int y2, ColorP = WHITE);
- virtual bool Enter();
- virtual void Leave(bool);
- SDL_Surface * surf;
- };
-
- class filldrawer : public fillwalker {
- public:
- filldrawer(fill *, texture *, ColorP = DOS_WHITE);
- virtual ~filldrawer();
- virtual void step(int x, int y);
- private:
- fill * f;
- texture * t;
- ColorP c;
- int oldx, oldy;
- };
- class segdrawer : public segwalker {
- public:
- segdrawer(fill *, texture *, ColorP = DOS_WHITE);
- virtual ~segdrawer();
- virtual void step(int x1, int y1, int x2, int y2);
- private:
- fill * f;
- texture * t;
- ColorP c;
- shape * sh;
- };
-};
-
-#endif
+/* + * mogltk + * Copyright (C) 1999-2004 Nicolas "Pixel" Noble + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* $Id: shape.h,v 1.16 2004-11-27 21:48:01 pixel Exp $ */ + +#ifndef __SHAPE_H__ +#define __SHAPE_H__ + +#include <vector> +#include <Exceptions.h> +#include <BString.h> +#include <mcolor.h> +#include <texture.h> + +namespace mogltk { + typedef enum { + LEFT, + CENTER, + RIGHT + } align_t; + class fillwalker : public Base { + public: + fillwalker(); + virtual ~fillwalker(); + virtual void step(int x, int y); + }; + class segwalker : public Base { + public: + segwalker(); + virtual ~segwalker(); + virtual void step(int x1, int y1, int x2, int y2); + }; + class fill : public Base { + public: + fill(); + virtual ~fill(); + void walk(fillwalker *); + void swalk(segwalker *); + void insert(int, int, int, int); + void insertfix(int, int); + int GetMinX() const; + int GetMinY() const; + int GetMaxX() const; + int GetMaxY() const; + texture * GetTexture(); + texture * Talloc(); + texture * GetSTexture(); + texture * STalloc(); + Color last; + private: + void insert(int, int); + struct segment { + int x1, y1, x2, y2; + }; + class sline : public Base { + public: + sline(int, fill *); + virtual ~sline(); + int GetY() const; + void insert(int, int); + void insertfix(int, int); + void walk(fillwalker *); + private: + class point : public Base { + public: + point(int, sline *); + virtual ~point(); + int GetX() const; + int GetY() const; + void walk(fillwalker *); + point * look(int); + private: + int x; + point * next; + sline * header; + }; + int y; + sline * next; + fill * header; + sline * look(int); + protected: + point * pheader; + friend class point; + private: + int count() const; + }; + int minX, minY, maxX, maxY; + texture * cached; + texture * scached; + std::vector<segment> segments; + protected: + sline * header; + friend class sline; + }; + class shape : public Base { + public: + shape(SDL_Surface * = 0); + virtual void pixel(int x, int y, ColorP = WHITE); + virtual void circle(int x, int y, int r, ColorP = WHITE); + virtual void pcircle(int x, int y, int r, ColorP = WHITE); + virtual fill * fcircle(int x, int y, int r); + virtual void fdraw(fill *, ColorP = WHITE, int sx = 0, int sy = 0); + virtual void sdraw(fill *, ColorP = WHITE, int sx = 0, int sy = 0); + virtual void box(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE); + virtual void box3d(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, int = 2, bool = false); + virtual void box(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP); + virtual void obox(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE); + virtual void obox3d(int x1, int y1, int x2, int y2, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false); + virtual void obox(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP); + virtual void hline(int x1, int x2, int y, ColorP = DOS_WHITE); + virtual void hline3d(int x1, int x2, int y, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false); + virtual void hline(int x1, int x2, int y, ColorP, ColorP); + virtual void vline(int x, int y1, int y2, ColorP = DOS_WHITE); + virtual void vline3d(int x, int y1, int y2, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false); + virtual void vline(int x, int y1, int y2, ColorP, ColorP); + virtual void line(int x1, int y1, int x2, int y2, ColorP = WHITE); + virtual void tbox(texture *, int x1, int y1, int x2, int y2, int tx = 0, int ty = 0, double = 1.0, ColorP = WHITE); + virtual void tbox(texture *, int x1, int y1, int x2, int y2, int tx1, int ty1, int tx2, int ty2, ColorP = WHITE); + virtual void tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx = 0, int ty = 0, double = 1.0); + virtual void tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx1, int ty1, int tx2, int ty2); + virtual void window(int x1, int y1, int x2, int y2, + const String & title = "", + ColorP titlecolor = DOS_HIGH_WHITE, + ColorP titlebackcolor = DOS_MAGENTA, + ColorP front = DOS_WHITE, + ColorP shade1 = DOS_HIGH_WHITE, + ColorP shade2 = DOS_GRAY); + virtual void text(int x, int y, const String &, + ColorP textcolor = DOS_HIGH_WHITE, + align_t align = LEFT); + virtual void text3d(int x, int y, const String &, + ColorP textcolor = DOS_BLACK, + ColorP shade1 = DOS_HIGH_WHITE, + ColorP shade2 = DOS_GRAY, + align_t align = LEFT, + bool bevel = false); + virtual void button(int x1, int y1, int x2, int y2, const String &, + bool bevel = false, + ColorP front = DOS_WHITE, + ColorP shade1 = DOS_HIGH_WHITE, + ColorP shade2 = DOS_GRAY, + ColorP round = DOS_BLACK, + ColorP textcolor = DOS_BLACK, + ColorP tshade1 = DOS_HIGH_WHITE, + ColorP tshade2 = DOS_GRAY); + SDL_Surface * GetSurf(); + private: + void bsubline_1(int x1, int y1, int x2, int y2, ColorP = WHITE); + void bsubline_2(int x1, int y1, int x2, int y2, ColorP = WHITE); + void bsubline_3(int x1, int y1, int x2, int y2, ColorP = WHITE); + void bsubline_4(int x1, int y1, int x2, int y2, ColorP = WHITE); + virtual bool Enter(); + virtual void Leave(bool); + SDL_Surface * surf; + }; + + class filldrawer : public fillwalker { + public: + filldrawer(fill *, texture *, ColorP = DOS_WHITE); + virtual ~filldrawer(); + virtual void step(int x, int y); + private: + fill * f; + texture * t; + ColorP c; + int oldx, oldy; + }; + class segdrawer : public segwalker { + public: + segdrawer(fill *, texture *, ColorP = DOS_WHITE); + virtual ~segdrawer(); + virtual void step(int x1, int y1, int x2, int y2); + private: + fill * f; + texture * t; + ColorP c; + shape * sh; + }; +}; + +#endif |