vgfx is the Vector Graphics Engine. More...
Classes | |
class | vgfx::Drawer |
Clients must implement this if they want to draw. More... | |
class | vgfx::Request |
used to easily construct vgfx Requests More... | |
struct | vgfx::visit_result_t |
hit detection results More... | |
class | vgfx::Primitive |
the base class from which all vector graphics objects inherit. More... | |
class | vgfx::ObjectMap |
an ObjectMap is a physical manifestation of a vector graphics 2D area. More... | |
struct | vgfx::init_primitive_t |
struct | vgfx::init_point_t |
struct | vgfx::init_bezier_t |
struct | vgfx::init_rect_t |
struct | vgfx::init_line_t |
struct | vgfx::init_dxdy_t |
struct | vgfx::init_quad_t |
struct | vgfx::init_text_t |
Namespaces | |
namespace | vgfx |
Modules | |
vgfx Request Format | |
| |
Typedefs | |
typedef point2d_t< float > | vgfx::point_t |
typedef rect2d_t< float > | vgfx::rect_t |
typedef bool(* | vgfx::callback_t )(IN void *context, IN visit_result_t &result) |
Enumerations | |
enum | vgfx::eHitDetect { vgfx::eHit_Overlap = 1, vgfx::eHit_Contained = 2, vgfx::eHit_Always = 3, vgfx::eHit_Invalid = 0 } |
hit detection results More... | |
Functions | |
void | vgfx::visit_result_t::clear (void) throw () |
virtual | vgfx::Primitive::~Primitive (void) throw () |
virtual long | vgfx::Primitive::getRefCount (void) const throw () |
virtual void | vgfx::Primitive::incrementRefCount (void) throw () |
virtual void | vgfx::Primitive::decrementRefCount (void) throw () |
virtual const char * | vgfx::Primitive::getID (void) const throw () |
virtual void | vgfx::Primitive::setID (IN const char *id) |
virtual const char * | vgfx::Primitive::getType (void) const =0 throw () |
virtual void | vgfx::Primitive::persist (OUT std::ostream &stream) const =0 |
virtual void | vgfx::Primitive::listContainers (IN const VecString &path, OUT VecString &ids) const |
virtual bool | vgfx::Primitive::doesContainerExist (IN const VecString &path) const |
virtual bool | vgfx::Primitive::canCreateContainer (IN const VecString &path) const |
virtual void | vgfx::Primitive::removeContainer (IN const VecString &path) |
virtual void | vgfx::Primitive::getContainerDictionary (IN const VecString &path, OUT dictionary_t &data) const |
virtual void | vgfx::Primitive::setContainerDictionary (IN const VecString &path, IN const dictionary_t &data) |
virtual void | vgfx::Primitive::recalcBoundingRect (IN const char *tag_path, IN Drawer *drawer, IN const xform_2d_t &T)=0 |
virtual bool | vgfx::Primitive::getBoundingRect (OUT rect_t &r) const =0 throw () |
virtual bool | vgfx::Primitive::getPrimitive (IN const char *tag_path, IN const xform_2d_t &T, OUT visit_result_t &vr) |
virtual void | vgfx::Primitive::draw (IN Drawer *drawer, IN const rect_t &r_pix, IN const xform_2d_t &T)=0 |
draw this primitive and all children, recursively | |
virtual bool | vgfx::Primitive::visit (IN const rect_t &r, IN const xform_2d_t &T, IN const char *tag_path, IN callback_t callback, IN void *context, IN eHitDetect hit) |
static smart_ptr< Primitive > | vgfx::Primitive::create (IN const char *type, IN const dictionary_t &data) |
virtual long | vgfx::ObjectMap::size (void) const =0 throw () |
virtual void | vgfx::ObjectMap::newObjectID (IN const char *prefix, OUT std::string &id)=0 |
virtual void | vgfx::ObjectMap::addObject (IN smart_ptr< Primitive > &primitive)=0 |
virtual Primitive * | vgfx::ObjectMap::findObject (IN const char *ID) const =0 throw () |
virtual smart_ptr< Primitive > | vgfx::ObjectMap::removeObject (IN const char *ID)=0 |
static smart_ptr< ObjectMap > | vgfx::ObjectMap::create (void) |
bool | vgfx::processRequest (IN ObjectMap *map, IN std::istream &stream, IN bool single_transaction, OUT std::string &undo_request, OUT std::string &diagnostic) |
Request that an ObjectMap be updated with the given request. | |
void | vgfx::invokeFunction (IN Primitive *in_function, IN ObjectMap *map, IN const dictionary_t &in_params, OUT std::ostream &out) |
Primitive * | vgfx::addFunctionFromPath (IN ObjectMap *map, IN const char *path) |
void | vgfx::setScript (IN ObjectMap *map, IN const char *parent_id, IN const char *script_id, IN const objtree::property_set_t &pset_def, IO std::ostream &stream, OUT std::string &root) |
void | vgfx::updateScriptParameters (IN ObjectMap *map, IN const char *parent_id, IN const objtree::property_set_t &pset, IO std::ostream &stream) |
void | vgfx::resizeScript (IN ObjectMap *map, IN const char *parent_id, IN float width, IN float height, IO std::ostream &stream) |
template<class T > | |
std::string | vgfx::getStringValue (const T &t) |
void | vgfx::init_point_from_data (IN const dictionary_t &data, OUT init_point_t &) |
smart_ptr< Primitive > | vgfx::create_point (IN const init_point_t &) |
void | vgfx::init_bezier_from_data (IN const dictionary_t &data, OUT init_bezier_t &init) |
smart_ptr< Primitive > | vgfx::create_bezier (IN const init_bezier_t &init) |
void | vgfx::init_rect_from_data (IN const dictionary_t &data, OUT init_rect_t &init) |
smart_ptr< Primitive > | vgfx::create_rect (IN const init_rect_t &init) |
void | vgfx::init_line_from_data (IN const dictionary_t &data, OUT init_line_t &init) |
smart_ptr< Primitive > | vgfx::create_line (IN const init_line_t &init) |
void | vgfx::init_dxdy_from_data (IN const dictionary_t &data, OUT init_dxdy_t &) |
smart_ptr< Primitive > | vgfx::create_dxdy (IN const init_dxdy_t &) |
void | vgfx::init_quad_from_data (IN const dictionary_t &data, OUT init_quad_t &init) |
smart_ptr< Primitive > | vgfx::create_quad (IN const init_quad_t &init) |
smart_ptr< Primitive > | vgfx::parseGroup (IN std::istream &stream, IN ObjectMap *map) |
smart_ptr< Primitive > | vgfx::parseFunction (IN std::istream &stream, IN ObjectMap *map) |
void | vgfx::init_text_from_data (IN const dictionary_t &data, OUT init_text_t &init) |
smart_ptr< Primitive > | vgfx::create_text (IN const init_text_t &init) |
Variables | |
Primitive * | vgfx::visit_result_t::p |
const char * | vgfx::visit_result_t::tag_path |
xform_2d_t | vgfx::visit_result_t::T |
float | vgfx::init_point_t::y0 |
bool | vgfx::init_rect_t::fill |
float | vgfx::init_line_t::y0 |
float | vgfx::init_line_t::x1 |
float | vgfx::init_line_t::y1 |
float | vgfx::init_dxdy_t::dy |
| |
enum | vgfx::eBrushAttribute { vgfx::eBrush_PenColor = 1, vgfx::eBrush_FillColor = 2, vgfx::eBrush_PenThickness = 3, vgfx::eBrush_Font = 50, vgfx::eBrush_TextFlags = 60, vgfx::eBrush_Invalid = 0 } |
vgfx is the Vector Graphics Engine.
It exists to represent the logical model of nested, transformed 2D shapes.
The library is heavily optimized for two use cases:
In particular, the library doesn't try to be particularly fast on writes. It is more concerned with correctness (of course), and with constructing a rollback request for internal and external use.
Because any write operation returns a corresponding rollback request, it is easy for calling applications to set up an undo/redo stack.
The request language is intended to be human-readable and easy for applications to generate on the fly. Think of something like SQL updates.
Queries are focused on either lookups by object ID, or lookups based on a 2D rectangle. Reads (queries) are intended to be fast so the engine can be used in a real-time rendering application.
Typical client usage is:
If you want to draw any of this:
Keep in mind: an ObjectMap isn't actually a canvas! Think of it as a big registry of objects which you can look up by name (ID). And objects can reference each other by their IDs.
To draw something, you have to provide an object to draw. Typically an application will create a bunch of objects in the ObjectMap, and then put everything visible under a known root group object. For display, the application will call draw() on the root group object. (To do this, the application will have to create an object that implements the Drawer interface, and then call vgfx::Primitive::draw() on the root group object).
Other descriptions of vgfx (mostly for search engines):
typedef point2d_t<float> vgfx::point_t |
typedef rect2d_t<float> vgfx::rect_t |
typedef bool(* vgfx::callback_t)(IN void *context, IN visit_result_t &result) |
eBrush_PenColor | |
eBrush_FillColor | |
eBrush_PenThickness | |
eBrush_Font | |
eBrush_TextFlags | |
eBrush_Invalid |
Definition at line 46 of file vgfx/drawer.h.
enum vgfx::eHitDetect |
void vgfx::visit_result_t::clear | ( | void | ) | throw () [inline, inherited] |
vgfx::Primitive::~Primitive | ( | void | ) | throw () [virtual, inherited] |
virtual long vgfx::Primitive::getRefCount | ( | void | ) | const throw () [inline, virtual, inherited] |
virtual void vgfx::Primitive::incrementRefCount | ( | void | ) | throw () [inline, virtual, inherited] |
virtual void vgfx::Primitive::decrementRefCount | ( | void | ) | throw () [inline, virtual, inherited] |
const char * vgfx::Primitive::getID | ( | void | ) | const throw () [virtual, inherited] |
void vgfx::Primitive::setID | ( | IN const char * | id | ) | [virtual, inherited] |
virtual const char* vgfx::Primitive::getType | ( | void | ) | const throw () [pure virtual, inherited] |
virtual void vgfx::Primitive::persist | ( | OUT std::ostream & | stream | ) | const [pure virtual, inherited] |
void vgfx::Primitive::listContainers | ( | IN const VecString & | path, | |
OUT VecString & | ids | |||
) | const [virtual, inherited] |
bool vgfx::Primitive::doesContainerExist | ( | IN const VecString & | path | ) | const [virtual, inherited] |
bool vgfx::Primitive::canCreateContainer | ( | IN const VecString & | path | ) | const [virtual, inherited] |
void vgfx::Primitive::removeContainer | ( | IN const VecString & | path | ) | [virtual, inherited] |
void vgfx::Primitive::getContainerDictionary | ( | IN const VecString & | path, | |
OUT dictionary_t & | data | |||
) | const [virtual, inherited] |
void vgfx::Primitive::setContainerDictionary | ( | IN const VecString & | path, | |
IN const dictionary_t & | data | |||
) | [virtual, inherited] |
virtual void vgfx::Primitive::recalcBoundingRect | ( | IN const char * | tag_path, | |
IN Drawer * | drawer, | |||
IN const xform_2d_t & | T | |||
) | [pure virtual, inherited] |
virtual bool vgfx::Primitive::getBoundingRect | ( | OUT rect_t & | r | ) | const throw () [pure virtual, inherited] |
bool vgfx::Primitive::getPrimitive | ( | IN const char * | tag_path, | |
IN const xform_2d_t & | T, | |||
OUT visit_result_t & | vr | |||
) | [virtual, inherited] |
void vgfx::Primitive::draw | ( | IN Drawer * | drawer, | |
IN const rect_t & | r_pix, | |||
IN const xform_2d_t & | T | |||
) | [pure virtual, inherited] |
bool vgfx::Primitive::visit | ( | IN const rect_t & | r, | |
IN const xform_2d_t & | T, | |||
IN const char * | tag_path, | |||
IN callback_t | callback, | |||
IN void * | context, | |||
IN eHitDetect | hit | |||
) | [virtual, inherited] |
smart_ptr< Primitive > vgfx::Primitive::create | ( | IN const char * | type, | |
IN const dictionary_t & | data | |||
) | [static, inherited] |
virtual long vgfx::ObjectMap::size | ( | void | ) | const throw () [pure virtual, inherited] |
virtual void vgfx::ObjectMap::newObjectID | ( | IN const char * | prefix, | |
OUT std::string & | id | |||
) | [pure virtual, inherited] |
virtual void vgfx::ObjectMap::addObject | ( | IN smart_ptr< Primitive > & | primitive | ) | [pure virtual, inherited] |
virtual Primitive* vgfx::ObjectMap::findObject | ( | IN const char * | ID | ) | const throw () [pure virtual, inherited] |
virtual smart_ptr<Primitive> vgfx::ObjectMap::removeObject | ( | IN const char * | ID | ) | [pure virtual, inherited] |
smart_ptr< ObjectMap > vgfx::ObjectMap::create | ( | void | ) | [static, inherited] |
Definition at line 275 of file object_map.cpp.
bool vgfx::processRequest | ( | IN ObjectMap * | map, | |
IN std::istream & | stream, | |||
IN bool | single_transaction, | |||
OUT std::string & | undo_request, | |||
OUT std::string & | diagnostic | |||
) |
Request that an ObjectMap be updated with the given request.
Returns false on failure.
map | ObjectMap upon which the request will act. | |
stream | Input text stream containing request. See vgfx Request Format. | |
single_transaction | If true, the request will be handled as an atomic operation and an undo request will be returned. If false, there is no rollback of partial commits. Use true unless you have good reason otherwise. | |
undo_request | On output, this contains a request which will undo the original input request. Handy for undo/redo stacks. | |
diagnostic | If the return value is false, this string will contain some details on output which may be helpful in tracking down what failed. |
void vgfx::invokeFunction | ( | IN Primitive * | in_function, | |
IN ObjectMap * | map, | |||
IN const dictionary_t & | in_params, | |||
OUT std::ostream & | out | |||
) |
Primitive * vgfx::addFunctionFromPath | ( | IN ObjectMap * | map, | |
IN const char * | path | |||
) |
void vgfx::setScript | ( | IN ObjectMap * | map, | |
IN const char * | parent_id, | |||
IN const char * | script_id, | |||
IN const objtree::property_set_t & | pset_def, | |||
IO std::ostream & | stream, | |||
OUT std::string & | root | |||
) |
void vgfx::updateScriptParameters | ( | IN ObjectMap * | map, | |
IN const char * | parent_id, | |||
IN const objtree::property_set_t & | pset, | |||
IO std::ostream & | stream | |||
) |
void vgfx::resizeScript | ( | IN ObjectMap * | map, | |
IN const char * | parent_id, | |||
IN float | width, | |||
IN float | height, | |||
IO std::ostream & | stream | |||
) |
std::string vgfx::getStringValue | ( | const T & | t | ) |
void vgfx::init_point_from_data | ( | IN const dictionary_t & | data, | |
OUT init_point_t & | ||||
) |
smart_ptr<Primitive> vgfx::create_point | ( | IN const init_point_t & | ) |
void vgfx::init_bezier_from_data | ( | IN const dictionary_t & | data, | |
OUT init_bezier_t & | init | |||
) |
smart_ptr< Primitive > vgfx::create_bezier | ( | IN const init_bezier_t & | init | ) |
void vgfx::init_rect_from_data | ( | IN const dictionary_t & | data, | |
OUT init_rect_t & | init | |||
) |
smart_ptr< Primitive > vgfx::create_rect | ( | IN const init_rect_t & | init | ) |
void vgfx::init_line_from_data | ( | IN const dictionary_t & | data, | |
OUT init_line_t & | init | |||
) |
smart_ptr< Primitive > vgfx::create_line | ( | IN const init_line_t & | init | ) |
void vgfx::init_dxdy_from_data | ( | IN const dictionary_t & | data, | |
OUT init_dxdy_t & | ||||
) |
smart_ptr<Primitive> vgfx::create_dxdy | ( | IN const init_dxdy_t & | ) |
void vgfx::init_quad_from_data | ( | IN const dictionary_t & | data, | |
OUT init_quad_t & | init | |||
) |
smart_ptr< Primitive > vgfx::create_quad | ( | IN const init_quad_t & | init | ) |
smart_ptr<Primitive> vgfx::parseGroup | ( | IN std::istream & | stream, | |
IN ObjectMap * | map | |||
) |
smart_ptr< Primitive > vgfx::parseFunction | ( | IN std::istream & | stream, | |
IN ObjectMap * | map | |||
) |
void vgfx::init_text_from_data | ( | IN const dictionary_t & | data, | |
OUT init_text_t & | init | |||
) |
smart_ptr< Primitive > vgfx::create_text | ( | IN const init_text_t & | init | ) |
Primitive* vgfx::visit_result_t::p [inherited] |
const char* vgfx::visit_result_t::tag_path [inherited] |
xform_2d_t vgfx::visit_result_t::T [inherited] |
float vgfx::init_point_t::y0 [inherited] |
bool vgfx::init_rect_t::fill [inherited] |
float vgfx::init_line_t::y0 [inherited] |
float vgfx::init_line_t::x1 [inherited] |
float vgfx::init_line_t::y1 [inherited] |
float vgfx::init_dxdy_t::dy [inherited] |