transform matrix ops produce wrong ty value? - Printable Version +- Hot Door CORE Forum (http://hotdoorcore.com/forum) +-- Forum: All forums (http://hotdoorcore.com/forum/forumdisplay.php?fid=1) +--- Forum: Bugs (http://hotdoorcore.com/forum/forumdisplay.php?fid=5) +--- Thread: transform matrix ops produce wrong ty value? (/showthread.php?tid=107) |
transform matrix ops produce wrong ty value? - Rick Johnson - 10-30-2016 Say I have a path filled with a pattern that's offset down 2 points which was applied with this code: Code: hdi::core::TransformMatrix tmx; 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... |