include/rays/painter.h in rays-0.1.3 vs include/rays/painter.h in rays-0.1.4
- old
+ new
@@ -2,14 +2,14 @@
#pragma once
#ifndef __RAYS_PAINTER_H__
#define __RAYS_PAINTER_H__
+#include <xot/pimpl.h>
#include <rays/defs.h>
+#include <rays/texture.h>
#include <rays/opengl.h>
-#include <rays/font.h>
-#include <rays/helpers.h>
namespace Rays
{
@@ -40,12 +40,20 @@
POLYGON = GL_POLYGON,
};// ShapeType
- class Texture;
+ class Point;
+ class Bounds;
+
+ class Color;
+
+ class Matrix;
+
+ class Font;
+
class Image;
class Painter
{
@@ -56,120 +64,211 @@
~Painter ();
bool canvas (coord x, coord y, coord width, coord height);
+ bool canvas (coord x, coord y, coord z, coord width, coord height, coord depth);
+
+ bool canvas (const Bounds& bounds);
+
bool begin ();
bool end ();
- bool push_matrix ();
-
- bool pop_matrix ();
-
//
// high level drawing methods
//
bool line (coord x1, coord y1, coord x2, coord y2);
+ bool line (const Point& p1, const Point& p2);
+
bool rect (coord x, coord y, coord width, coord height);
+ bool rect (const Bounds& bounds);
+
bool ellipse (
- coord x, coord y, coord width, coord height = 0, coord radius_min = 0,
- uint nsegment = 0);
+ coord x, coord y, coord width, coord height = 0,
+ coord radius_min = 0, uint nsegment = 0);
+ bool ellipse (
+ const Bounds& bounds,
+ coord radius_min = 0, uint nsegment = 0);
+
+ bool ellipse (
+ const Point& center, coord radius,
+ coord radius_min = 0, uint nsegment = 0);
+
bool arc (
coord x, coord y, coord width, coord height = 0,
- float angle_from = 0, float angle_to = 360, coord radius_min = 0,
- uint nsegment = 0);
+ float angle_from = 0, float angle_to = 360,
+ coord radius_min = 0, uint nsegment = 0);
+ bool arc (
+ const Bounds& bounds,
+ float angle_from = 0, float angle_to = 360,
+ coord radius_min = 0, uint nsegment = 0);
+
+ bool arc (
+ const Point& center, coord radius,
+ float angle_from = 0, float angle_to = 360,
+ coord radius_min = 0, uint nsegment = 0);
+
bool image (
const Image& image, coord x = 0, coord y = 0);
bool image (
+ const Image& image, const Point& position);
+
+ bool image (
const Image& image, coord x, coord y, coord width, coord height);
bool image (
+ const Image& image, const Bounds& bounds);
+
+ bool image (
const Image& image,
coord src_x, coord src_y, coord src_width, coord src_height,
coord dest_x, coord dest_y);
bool image (
const Image& image,
+ const Bounds& src_bounds, const Point& dest_position);
+
+ bool image (
+ const Image& image,
coord src_x, coord src_y, coord src_width, coord src_height,
coord dest_x, coord dest_y, coord dest_width, coord dest_height);
+ bool image (
+ const Image& image,
+ const Bounds& src_bounds, const Bounds& dest_bounds);
+
bool text (
const char* str, coord x = 0, coord y = 0,
- const Font& font = default_font());
+ const Font* font = NULL);
bool text (
+ const char* str, const Point& position,
+ const Font* font = NULL);
+
+ bool text (
const char* str, coord x, coord y, coord width, coord height,
- const Font& font = default_font());
+ const Font* font = NULL);
+ bool text (
+ const char* str, const Bounds& bounds,
+ const Font* font = NULL);
+
bool clear ();
- bool get_clear (
- float* red, float* green = NULL, float* blue = NULL,
- float* alpha = NULL);
+ bool set_background (float red, float green, float blue, float alpha = 1);
- bool set_clear (
- float red, float green, float blue, float alpha = 1);
+ bool set_background (const Color& color);
- bool no_clear ();
+ bool no_background ();
- bool get_fill (
- float* red, float* green = NULL, float* blue = NULL,
- float* alpha = NULL);
+ const Color& background () const;
bool set_fill (float red, float green, float blue, float alpha = 1);
- bool no_fill ();
+ bool set_fill (const Color& color);
- bool get_stroke (
- float* red, float* green = NULL, float* blue = NULL,
- float* alpha = NULL);
+ bool no_fill ();
+ const Color& fill () const;
+
bool set_stroke (float red, float green, float blue, float alpha = 1);
- bool no_stroke ();
+ bool set_stroke (const Color& color);
- bool get_clip (
- coord* x, coord* y = NULL,
- coord* width = NULL, coord* height = NULL);
+ bool no_stroke ();
+ const Color& stroke () const;
+
bool set_clip (coord x, coord y, coord width, coord height);
- bool no_clip ();
+ bool set_clip (const Bounds& bounds);
+ bool no_clip ();
+
+ const Bounds& clip () const;
+
+ bool set_font (const Font& font);
+
+ const Font& font () const;
+
+ bool push_attrs ();
+
+ bool pop_attrs ();
+
//
+ // transformation methods
+ //
+ bool translate (coord x, coord y, coord z = 0);
+
+ bool translate (const Point& value);
+
+ bool scale (coord x, coord y, coord z = 1);
+
+ bool scale (const Point& value);
+
+ bool rotate (float angle, coord x = 0, coord y = 0, coord z = 1);
+
+ bool rotate (float angle, const Point& center);
+
+ bool set_matrix (float value = 1);
+
+ bool set_matrix (
+ float a1, float a2, float a3, float a4,
+ float b1, float b2, float b3, float b4,
+ float c1, float c2, float c3, float c4,
+ float d1, float d2, float d3, float d4);
+
+ bool set_matrix (const float* elements);
+
+ bool set_matrix (const Matrix& matrix);
+
+ const Matrix& matrix () const;
+
+ bool push_matrix ();
+
+ bool pop_matrix ();
+
+ //
// low level drawing methods
//
bool begin_shape (ShapeType type);
bool end_shape ();
- bool color (float red, float green, float blue, float alpha = 1);
+ bool set_color (float red, float green, float blue, float alpha = 1);
- bool texture (const Texture& tex);
+ bool set_color (const Color& color);
- bool no_texture ();
+ bool set_texture (const Texture& tex);
- bool vertex (coord x, coord y);
+ bool no_texture ();
- bool vertex (coord x, coord y, coord z);
+ bool add_vertex (coord x, coord y);
- bool vertex (coord x, coord y, coord texture_s, coord texture_t);
+ bool add_vertex (coord x, coord y, coord z);
- bool vertex (coord x, coord y, coord z, coord texture_s, coord texture_t);
+ bool add_vertex (const Point& position);
+ bool add_vertex (coord x, coord y, coord tex_s, coord tex_t);
+
+ bool add_vertex (coord x, coord y, coord z, coord tex_s, coord tex_t);
+
+ bool add_vertex (const Point& position, coord tex_s, coord tex_t);
+
+
operator bool () const;
bool operator ! () const;
struct Data;
- Impl<Data> self;
+ Xot::PImpl<Data, true> self;
};// Painter
}// Rays