2005-03-02 10:55:29 +00:00
|
|
|
//This file is part of Photon (http://photon.sourceforge.net)
|
|
|
|
//Copyright (C) 2004-2005 James Turk
|
|
|
|
//
|
|
|
|
// Author:
|
|
|
|
// James Turk (jpt2433@rit.edu)
|
|
|
|
//
|
|
|
|
// Version:
|
2005-03-03 09:25:19 +00:00
|
|
|
// $Id: Pen.hpp,v 1.2 2005/03/03 09:25:47 cozman Exp $
|
2005-03-02 10:55:29 +00:00
|
|
|
|
|
|
|
#ifndef PHOTON_VIDEO_PEN_HPP
|
|
|
|
#define PHOTON_VIDEO_PEN_HPP
|
|
|
|
|
|
|
|
#include "types.hpp"
|
|
|
|
#include "video/Color.hpp"
|
|
|
|
#include "math/Rect.hpp"
|
|
|
|
#include "math/Vector2.hpp"
|
|
|
|
#include "math/Circle.hpp"
|
|
|
|
|
|
|
|
namespace photon
|
|
|
|
{
|
|
|
|
namespace video
|
|
|
|
{
|
|
|
|
|
|
|
|
// Class: Pen
|
|
|
|
// Class which is used for drawing primitives.
|
|
|
|
//
|
|
|
|
// Each instance of pen has a color, and the various members simply draw
|
|
|
|
// primitives in that color.
|
|
|
|
class Pen
|
|
|
|
{
|
|
|
|
|
|
|
|
// Group: (Con/De)structors
|
|
|
|
public:
|
|
|
|
// Function: Pen
|
|
|
|
// Default constructor, sets color to white.
|
|
|
|
Pen();
|
|
|
|
|
|
|
|
// Function: Pen
|
|
|
|
// Initializing constructor, takes components of color to use for drawing.
|
|
|
|
//
|
|
|
|
// Parameters:
|
|
|
|
// r - Value for red component.
|
|
|
|
// g - Value for green component.
|
|
|
|
// b - Value for blue component.
|
|
|
|
// a - Value for alpha component. [default: 255]
|
|
|
|
//
|
|
|
|
// See Also:
|
|
|
|
// <setColor>
|
|
|
|
Pen(ubyte r, ubyte g, ubyte b, ubyte a=255);
|
|
|
|
|
|
|
|
// Function: Pen
|
|
|
|
// Initializing constructor, takes <Color> to use for drawing..
|
|
|
|
//
|
|
|
|
// Parameters:
|
|
|
|
// color - <Color> to use for drawing.
|
|
|
|
//
|
|
|
|
// See Also:
|
|
|
|
// <setColor>
|
2005-03-03 09:25:19 +00:00
|
|
|
Pen(const Color& color);
|
2005-03-02 10:55:29 +00:00
|
|
|
|
|
|
|
// Group: Color
|
|
|
|
public:
|
|
|
|
// Function: setColor
|
|
|
|
// Sets color to use for drawing.
|
|
|
|
//
|
|
|
|
// Parameters:
|
|
|
|
// r - Value for red component.
|
|
|
|
// g - Value for green component.
|
|
|
|
// b - Value for blue component.
|
|
|
|
// a - Value for alpha component. [default: 255]
|
|
|
|
void setColor(ubyte r, ubyte g, ubyte b, ubyte a=255);
|
|
|
|
|
|
|
|
// Function: setColor
|
|
|
|
// Sets color to use for drawing.
|
|
|
|
//
|
|
|
|
// Parameters:
|
|
|
|
// color - <Color> to use for drawing.
|
2005-03-03 09:25:19 +00:00
|
|
|
void setColor(const Color& color);
|
2005-03-02 10:55:29 +00:00
|
|
|
|
|
|
|
// Group: Drawing
|
|
|
|
public:
|
|
|
|
// Function: drawPoint
|
|
|
|
// Draws a single point.
|
|
|
|
//
|
|
|
|
// Parameters:
|
|
|
|
// point - Point to draw.
|
2005-03-03 09:25:19 +00:00
|
|
|
void drawPoint(const math::Point2& point) const;
|
2005-03-02 10:55:29 +00:00
|
|
|
|
|
|
|
// Function: drawLine
|
|
|
|
// Draw a line from one point to another.
|
|
|
|
//
|
|
|
|
// Parameters:
|
|
|
|
// p1 - First endpoint of line.
|
|
|
|
// p2 - Second endpoint of line.
|
2005-03-03 09:25:19 +00:00
|
|
|
void drawLine(const math::Point2& p1, const math::Point2& p2) const;
|
2005-03-02 10:55:29 +00:00
|
|
|
|
|
|
|
// Function: drawVector
|
|
|
|
// Draw a vector, including small arrow, with base at a given point.
|
|
|
|
//
|
|
|
|
// Parameters:
|
|
|
|
// point - Base point for vector.
|
|
|
|
// vector - Vector to draw.
|
2005-03-03 09:25:19 +00:00
|
|
|
void drawVector(const math::Point2& point,
|
|
|
|
const math::Vector2& vector) const;
|
2005-03-02 10:55:29 +00:00
|
|
|
|
|
|
|
// Function: drawRectangle
|
|
|
|
// Draw an empty rectangle.
|
|
|
|
//
|
|
|
|
// Parameters:
|
|
|
|
// rect - <Rect> to draw.
|
|
|
|
void drawRectangle(const math::Rect &rect) const;
|
|
|
|
|
|
|
|
// Function: fillRectangle
|
|
|
|
// Draw a filled rectangle.
|
|
|
|
//
|
|
|
|
// Parameters:
|
|
|
|
// rect - <Rect> to draw.
|
|
|
|
void fillRectangle(const math::Rect &rect) const;
|
|
|
|
|
|
|
|
// Function: drawCircle
|
|
|
|
// Draw an empty circle.
|
|
|
|
//
|
|
|
|
// Parameters:
|
|
|
|
// circle - <Circle> to draw.
|
|
|
|
void drawCircle(const math::Circle &circle) const;
|
|
|
|
|
|
|
|
// Function: fillCircle
|
|
|
|
// Draw a filled circle.
|
|
|
|
//
|
|
|
|
// Parameters:
|
|
|
|
// circle - <Circle> to draw.
|
|
|
|
void fillCircle(const math::Circle &circle) const;
|
|
|
|
|
|
|
|
// data members
|
|
|
|
private:
|
|
|
|
Color color_;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //PHOTON_VIDEO_PEN_HPP
|