PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
sdl/PlatformDrawObject.h
Go to the documentation of this file.
1//* -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- */
3// Name: src/platforms/sdl/PlatformDrawObject.h
4// Purpose: Platform-specific classes drawing things.
5// Author: Shane T. Mueller, Ph.D.
6// Copyright: (c) 2005-2026 Shane T. Mueller <smueller@obereed.net>
7// License: GPL 2
8//
9//
10//
11// This file is part of the PEBL project.
12//
13// PEBL is free software; you can redistribute it and/or modify
14// it under the terms of the GNU General Public License as published by
15// the Free Software Foundation; either version 2 of the License, or
16// (at your option) any later version.
17//
18// PEBL is distributed in the hope that it will be useful,
19// but WITHOUT ANY WARRANTY; without even the implied warranty of
20// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21// GNU General Public License for more details.
22//
23// You should have received a copy of the GNU General Public License
24// along with PEBL; if not, write to the Free Software
25// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27#ifndef __PLATFORMDRAWOBJECT_H__
28#define __PLATFORMDRAWOBJECT_H__
29
30#include "PlatformWidget.h"
31#include "../../objects/PDrawObject.h"
32#include "../../objects/PColor.h"
33#include "../../base/PEBLObject.h"
34#include "SDL.h"
35
36
37
38//A DrawObject is parallel to PWidget, but specific to drawing
39//primitives. It differs from PWidgets because it doesn't need to be
40// directly tied to a SDL_Surface. If it is constructed with a NULL surface,
41// it creates one itself, and cleans up after itself. If it is created
42// with a widget passed in, it does not destroy that widget when it is
43// destructed. Thus, you can 'draw' on any other widget you want.
44
46{
47
48public:
49
52
53};
54
55
56class PlatformLine: virtual public PlatformDrawObject, virtual public PLine
57{
58public:
59 PlatformLine(int x1, int y1, int dx, int dy, Variant fg);
60 virtual ~PlatformLine();
61 virtual bool Draw();
62protected:
63 virtual std::ostream & SendToStream(std::ostream& out) const;
64private:
65
66};
67
68
69
70class PlatformThickLine: virtual public PlatformDrawObject, virtual public PThickLine
71{
72public:
73 PlatformThickLine(int x1, int y1, int x2, int y2,int width, Variant fg);
74 virtual ~PlatformThickLine();
75 virtual bool Draw();
76protected:
77 virtual std::ostream & SendToStream(std::ostream& out) const;
78private:
79
80};
81
82// class PlatformBezier: public PlatformDrawObject
83// {
84// };
85
86// class PlatformPolygon: public PlatformDrawObject
87// {
88// public:
89// PlatformPlatformPolygon();
90// ~PlatformPlatformPolygon();
91// protected:
92// private:
93// };
94
95// class PlatformTriangle: public PlatformPolygon
96// {
97// public:
98// PlatformTriangle();
99// ~PlatformTriangle();
100// protected:
101// private:
102
103// };
104
105// class PlatformTrapezoid: public PlatformPolygon
106// {
107// public:
108// PlatformTrapezoid();
109// ~PlatformTrapezoid();
110// protected:
111// private:
112// };
113
114
115class PlatformRectangle: virtual public PlatformDrawObject, virtual public PRectangle
116 {
117 public:
118 PlatformRectangle(int x1, int y1, int dx, int dy, Variant fg, bool filled);
119 virtual ~PlatformRectangle();
120 virtual bool Draw();
121 protected:
122 virtual std::ostream & SendToStream(std::ostream& out) const;
123 private:
124 };
125
126class PlatformSquare: virtual public PlatformDrawObject, virtual public PSquare
127{
128public:
129 PlatformSquare(int x, int y, int size, Variant fg, bool filled);
130 virtual ~PlatformSquare();
131 virtual bool Draw();
132protected:
133 virtual std::ostream & SendToStream(std::ostream& out) const;
134private:
135};
136
137
138class PlatformEllipse: virtual public PlatformDrawObject, virtual public PEllipse
139 {
140 public:
141 PlatformEllipse(int x1, int y1, int dx, int dy, Variant fg, bool filled);
142 virtual ~PlatformEllipse();
143 virtual bool Draw();
144 protected:
145 virtual std::ostream & SendToStream(std::ostream& out) const;
146 private:
147 };
148
149
150class PlatformCircle: virtual public PlatformDrawObject, virtual public PCircle
151 {
152 public:
153 PlatformCircle(int x1, int y1, int r, Variant fg, bool filled);
154 virtual ~PlatformCircle();
155 virtual bool Draw();
156 protected:
157 virtual std::ostream & SendToStream(std::ostream& out) const;
158 private:
159 };
160
161 class PlatformPolygon: virtual public PlatformDrawObject, virtual public PPolygon
162 {
163 public:
164 PlatformPolygon(int x, int y, Variant xpoints,Variant ypoints,Variant fg, bool filled);
165 virtual ~PlatformPolygon();
166 virtual bool Draw();
167 protected:
168 virtual std::ostream & SendToStream(std::ostream& out) const;
169 private:
170 };
171
172 class PlatformBezier: virtual public PlatformDrawObject, virtual public PBezier
173 {
174 public:
175 PlatformBezier(int x, int y, Variant xpoints,Variant ypoints,int steps, Variant fg);
176 virtual ~PlatformBezier();
177 virtual bool Draw();
178 protected:
179 virtual std::ostream & SendToStream(std::ostream& out) const;
180 private:
181 };
182
183
184// class PlatformDrawGroup: public PlatformDrawObject
185// {
186// public:
187// PlatformDrawGroup();// ~PlatformDrawGroup();
188// protected:
189// private:
190// };
191
192
193#endif
virtual bool Draw()
This method initiates everything needed to display the main window
virtual std::ostream & SendToStream(std::ostream &out) const
An inheritable printing class used by PEBLObjectBase::operator<<.
virtual bool Draw()
This method initiates everything needed to display the main window
virtual std::ostream & SendToStream(std::ostream &out) const
An inheritable printing class used by PEBLObjectBase::operator<<.
Validator platform drawing primitives - no rendering, used only for compilation.
virtual std::ostream & SendToStream(std::ostream &out) const
An inheritable printing class used by PEBLObjectBase::operator<<.
virtual bool Draw()
This method initiates everything needed to display the main window
virtual bool Draw()
This method initiates everything needed to display the main window
virtual std::ostream & SendToStream(std::ostream &out) const
An inheritable printing class used by PEBLObjectBase::operator<<.
virtual std::ostream & SendToStream(std::ostream &out) const
An inheritable printing class used by PEBLObjectBase::operator<<.
virtual bool Draw()
This method initiates everything needed to display the main window
virtual bool Draw()
This method initiates everything needed to display the main window
virtual std::ostream & SendToStream(std::ostream &out) const
An inheritable printing class used by PEBLObjectBase::operator<<.
virtual std::ostream & SendToStream(std::ostream &out) const
An inheritable printing class used by PEBLObjectBase::operator<<.
virtual bool Draw()
This method initiates everything needed to display the main window
virtual std::ostream & SendToStream(std::ostream &out) const
An inheritable printing class used by PEBLObjectBase::operator<<.
virtual bool Draw()
This method initiates everything needed to display the main window