10-30-2016, 10:22 AM
Say I have a path filled with a pattern that's offset down 2 points which was applied with this code:
This works for both x and y movements and is confirmed by obtaining its TransformMatrix.
tmx1 = 1 0 0 1 0 2, as expected.
tmx2 = 1 0 0 1 0 -2, again as expected.
Here's the problem: The pattern should, I would expect, return to its original position, i.e. 0,0, but it doesn't. Running the code again, tmx1 = 1 0 0 1 0 4, transformed in the wrong y direction, although the tmx2 gets inverted correctly. The next time tmx1's ty is 8. It doesn't always double, sometimes it can start out as a small integer and end up a huge float.
X-axis ops seem to work as expected.
Am I doing something wrong? If this is a bug, can you suggest a workaround to simply assign an identity matrix to a pattern fill?
Also, it's easy to make a work copy of a PathStyle and reapply it, but I can't find a way to manipulate its pattern matrix first. Say I copy the style as pStyle, then:
I can't find a way to apply this new PatternStyle to pStyle. Also confusing is that:
... doesn't generate any errors, but also produces no results. It would be nice if a code example could be added to the header notes to make TransformMatrix manipulation clearer.
Many thanks in advance...
Code:
hdi::core::TransformMatrix tmx;
tmx.concatTranslate(h,v); // h and v values passed by the caller
(*iter)->transformWithOptions(tmx, hdi::core::Art::TransformOptionFillPatterns);
This works for both x and y movements and is confirmed by obtaining its TransformMatrix.
Code:
hdi::core::TransformMatrix tmx1 = (*iter)->path()->style().fill.color.pattern().transform;
tmx1 = 1 0 0 1 0 2, as expected.
Code:
bool isOK = tmx1.invert(tmx2);
tmx2 = 1 0 0 1 0 -2, again as expected.
Code:
(*iter)->transformWithOptions(tmx2, hdi::core::Art::TransformOptionFillPatterns);
Here's the problem: The pattern should, I would expect, return to its original position, i.e. 0,0, but it doesn't. Running the code again, tmx1 = 1 0 0 1 0 4, transformed in the wrong y direction, although the tmx2 gets inverted correctly. The next time tmx1's ty is 8. It doesn't always double, sometimes it can start out as a small integer and end up a huge float.
X-axis ops seem to work as expected.
Am I doing something wrong? If this is a bug, can you suggest a workaround to simply assign an identity matrix to a pattern fill?
Also, it's easy to make a work copy of a PathStyle and reapply it, but I can't find a way to manipulate its pattern matrix first. Say I copy the style as pStyle, then:
Code:
hdi::core::ArtColor::PatternStyle pPat = pStyl.fill.color.pattern();
I can't find a way to apply this new PatternStyle to pStyle. Also confusing is that:
Code:
pStyle.fill.color.pattern().transform.setIdentity();
... doesn't generate any errors, but also produces no results. It would be nice if a code example could be added to the header notes to make TransformMatrix manipulation clearer.
Many thanks in advance...