sp-mesh-array.h revision 81092741e7a5b65552e8224f5cb152a618d54a48
#ifndef SEEN_SP_MESH_ARRAY_H
#define SEEN_SP_MESH_ARRAY_H
/*
* Authors:
* Tavmjong Bah <tavmjong@free.fr>
*
* Copyrigt (C) 2012 Tavmjong Bah
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
/**
A group of classes and functions for manipulating mesh gradients.
A mesh is made up of an array of patches. Each patch has four sides and four corners. The sides can
be shared between two patches and the corners between up to four.
The order of the points for each side always goes from left to right or top to bottom.
For sides 2 and 3 the points must be reversed when used (as in calls to cairo functions).
Two patches: (C=corner, S=side, H=handle, T=tensor)
C0 H1 H2 C1 C0 H1 H2 C1
+ ---------- + ---------- +
| S0 | S0 |
H1 | T0 T1 |H1 T0 T1 | H1
|S3 S1|S3 S1|
H2 | T3 T2 |H2 T3 T2 | H2
| S2 | S2 |
+ ---------- + ---------- +
C3 H1 H2 C2 C3 H1 H2 C2
The mesh is stored internally as an array of nodes that includes the tensor nodes.
Note: This code uses tensor points which are not part of the SVG2 plan at the moment.
Including tensor points was motivated by a desire to experiment with their usefulness
in smoothing color transitions. There doesn't seem to be much advantage for that
purpose. However including them internally allows for storing all the points in
an array which simplifies things like inserting new rows or columns.
*/
#include "color.h"
// For color picking
#include "sp-item.h"
enum NodeType {
};
// Is a node along an edge?
enum NodeEdge {
MG_NODE_EDGE_TOP = 1,
MG_NODE_EDGE_LEFT = 2,
MG_NODE_EDGE_BOTTOM = 4,
};
enum MeshCornerOperation {
};
enum MeshNodeOperation {
};
SPMeshNode() {
set = false;
draggable = -1;
path_type = 'u';
opacity = 0.0;
}
bool set;
};
// I for Internal to distinguish it from the Object class
// This is a convenience class...
int row;
int col;
bool tensorIsSet();
bool tensorIsSet( guint i );
void updateNodes();
};
// An array of mesh nodes.
// Should be private
// Draggables to nodes
bool drag_valid;
~SPMeshNodeArray() { clear(); };
bool built;
void clear();
void print();
// Get size of patch
guint patch_rows();
// Operations on corners
// Update other nodes in response to a node move.
void update_handles( guint corner, std::vector< guint > selected_corners, Geom::Point old_p, MeshNodeOperation op );
};
#endif /* !SEEN_SP_MESH_ARRAY_H */
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
c-basic-offset:2
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :