Added image to symbol conversion

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@203 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-02-13 18:02:51 +00:00
parent e83c00c05a
commit 914f1186f2
7 changed files with 512 additions and 7 deletions
+7 -1
View File
@@ -114,6 +114,12 @@ enum SymbolPartCombine
, PART_BORDER
};
/// A sane mod function, always returns a result in the range [0..size)
inline size_t mod(int a, size_t size) {
int m = a % (int)size;
return m >= 0 ? m : m + size;
}
/// A single part (polygon/bezier-gon) in a Symbol
class SymbolPart {
public:
@@ -136,7 +142,7 @@ class SymbolPart {
/// Get a control point, wraps around
inline ControlPointP getPoint(int id) const {
return points[id >= 0 ? id % points.size() : id + points.size()];
return points[mod(id, points.size())];
}
/// Enforce lock constraints