micahpearlman / MonkSVG

SVG parsing framework in C++
BSD 3-Clause "New" or "Revised" License
79 stars 19 forks source link

A simple Line bug? #16

Open gerchicov opened 11 years ago

gerchicov commented 11 years ago
void SVG::handle_line(TiXmlElement *element) {

    _handler->onPathBegin();
    float x1, x2, y1, y2;
    element->QueryFloatAttribute("x1", &x1);
    element->QueryFloatAttribute("y1", &y1);
    element->QueryFloatAttribute("x2", &x2);
    element->QueryFloatAttribute("y2", &y2);
    _handler->onLine(x1, y1, x2, y2);

// _handler->onPathMoveTo(x1, y1); // _handler->onPathLineTo(x2, y2); handle_general_parameter(element); _handler->onPathEnd(); }

void OpenVG_SVGHandler::onLine(float x1, float y1, float x2, float y2) {

    vguLine(_current_group->current_path->path, x1, y1, x2, y2);
}

I added these methods. because a simple line tag is unimplemented. And onLine must work as onPathMoveTo + onPathLineTo and it must be correct. But they both work incorrectly and... differently?!

gerchicov commented 11 years ago

here is a link to an example of file: http://www.filehostfree.com/?d=526146EC1

micahpearlman commented 11 years ago

Can you submit this as a pull request?

gerchicov commented 11 years ago

I'm sorry but I can't because: 1)I simply don't know how to do this 2)if you mean all my changes (not these only) to this library then I can't send all of them because of agreement with my employer.

additionally I saw that if line tag is defined before path tag then it works.

gerchicov commented 11 years ago

I think I have found a problem but I still don't know how to fix it. And I don't know is it in my code or your own. The problem is when I draw path attribute (in example file) I use a relative mode for the last coordinates. Then I try to draw line attribute in an absolute mode. So I need to reset this mode to default or manually set it to relative before the line drawing. Or there is even error in your code in vguLine in MonkVG (it always sets VG_ABSOLUTE mode).

gerchicov commented 11 years ago

Hello, can you create an example of a project which could push/pop a view controller which shows svg? I think I have found a bug with memory management but I'm not assure that it isn't my own bug.