Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    daljit97
    @daljit97
    HI I just came across this nice library. I wanted to ask how does thorvg implement its antialising technique? Is it using exact pixel coverage like Pathfinder (https://github.com/servo/pathfinder)?
    3 replies
    Hermet Park
    @hermet
    @daljit97 it uses the customized freetype rasterizer, i'm not sure 100% your saying the terms of "exact pixel coverage" but probably yes, you can compare the drawing result with some shape drawing between tvg and pathfinder. Quality is pretty nice. most UI systems use freetype raster for font drawing including Android. On the other hand, tvg uses the custom feathering anti-aliasing technique only for the transformed image as the @JSUYA mentioned. In this case, the anti-aliasing algorithm was designed by me.
    Hermet Park
    @hermet
    @mgrudzinska Samsung/thorvg#1200 after this patch we gonna release v0.8
    projectitis
    @projectitis

    Hi all - I have changed my code to use a new canvas for each 'sprite' (actually a Rive object). They all target the same buffer. I loop through all the canvases and draw/sync them in order. However, only the last canvas is drawn, and all around it is black. It is like outside the shape is not transparent but instead it is solid black. What could I be doing wrong?

    This is what I am doing:

    // Each rive sprite has it's own canvas
    _canvas = tvg::SwCanvas::gen();
    _canvas->target((uint32_t*)context->buffer(), context->width(), context->width(), context->height(), tvg::SwCanvas::ARGB8888);
    
    // If I do this, sprite 0 is drawn with black all around it, despite the buffer being red
    context->buffer()->clear( COLOR_RED );
    sprites[0]->canvas()->draw(); sprites[0]->canvas()->sync();
    
    // If I do this, only sprite 1 is visible (with black all around it)
    context->buffer()->clear( COLOR_RED );
    sprites[0]->canvas()->draw(); sprites[0]->canvas()->sync();
    sprites[1]->canvas()->draw(); sprites[1]->canvas()->sync();
    
    // And so on. (only sprite 2 is visible)
    context->buffer()->clear( COLOR_RED );
    sprites[0]->canvas()->draw(); sprites[0]->canvas()->sync();
    sprites[1]->canvas()->draw(); sprites[1]->canvas()->sync();
    sprites[2]->canvas()->draw(); sprites[2]->canvas()->sync();

    It doesn't matter if the sprite is a Rive file or a Picture, or a combination. Result is all the same.

    Any ideas?

    Hermet Park
    @hermet
    @projectitis Hi, Are you trying to overwrite multiple rive images on One canvas? Actually, the canvas buffer is not supposed to be shared among the canvases... it will clear buffer before drawing.
    Hermet Park
    @hermet
    @projectitis that case that would be better if the multiple rive artboards shares One Canvas.
    need to check it that point of view...
    projectitis
    @projectitis
    @hermet I have multiple canvases that all share the same buffer. It would be fantastic if that was supported because I can see many use-cases - for example, in an application that does it's own rendering, and then passing the buffer to thorvg to render some vectors over the top.
    @hermet Another use-case: Multiple canvases mean that I can choose the draw order of each object/canvas without having to redraw (build and push new paints, load/process SVG, load/process images) each object every time the order changes (which is also why I am working on adding canvas->remove/scene->remove).
    projectitis
    @projectitis

    @hermet I have changed my code now to use a single canvas. Each 'sprite' maintains a Scene and owns the pointer to it. The canvas is cleared every frame, and the scenes are added back to the canvas in the correct order every frame. This means that I do not have to rebuild the scene every frame, just push it back onto the canvas. To do this I had to add an overloaded method for Canvas::push that takes a Paint* instead of a unique_ptr<Paint> so that my sprites can maintain ownership of the Scene.

    The rendering is fixed, but I have a slow memory leak somewhere. This was happening even before I added the Paint* overload (see rive-app/rive-tizen#70).

    Hermet Park
    @hermet
    @projectitis About memory leak, could you please share the source code? probably, there must be wrong to fix.
    @projectitis or you can share the more info of the memory leak.
    4 replies
    fyi, the canvas could have the composited scenes. That's why tvg supports Scene interface. You can manipulate them by pushing in the canvas in order. The last approach of yours looks correct to me.
    Hermet Park
    @hermet
    @/all ThorVg project is supposed to be moved here https://github.com/thorvg. It will be independent from Samsung soon or later.
    2 replies
    iFire
    @ifire:mozilla.org
    [m]
    Wow. Not hearing much error reports on SVG. That's good.
    Regarding SVG in Godot Engine 4
    iFire
    @ifire:mozilla.org
    [m]
    iFire
    @ifire:mozilla.org
    [m]
    I personally do not have this bug, so it's obscure to me too.
    Hermet Park
    @hermet
    @ifire:mozilla.org Samsung/thorvg#1206 ?
    iFire
    @ifire:mozilla.org
    [m]
    yeah!
    Hermet Park
    @hermet
    Thats good news. Will apply the fix soon.
    @ifire:mozilla.org thanks for your effort!
    iFire
    @ifire:mozilla.org
    [m]
    I think remi is also offering to add a github actions to check for mingw.
    Hermet Park
    @hermet
    @JSUYA
    projectitis
    @projectitis
    Just a suggestion. I wonder if you would consider a new logo when you become independent? Here is a mockup :)
    Hermet Park
    @hermet
    @projectitis Cool, I love it, do you have svg icon as well?
    Also, we can replace the icon regardless of independence.
    projectitis
    @projectitis
    @Hermet I have created SVG and PNG versions of the logo and submitted a PR. I am happy to make any changes!
    Hermet Park
    @hermet
    @projectitis applied your design all over the pages, great job!
    projectitis
    @projectitis
    Thank you :D
    projectitis
    @projectitis
    @hermet When you have some time, would you be able to look at this example code?
    It renders 3 rive files to a canvas. Each rive file has it's own scene.
    I have had to add an overloaded method to ThorVG Canvas in order to do this (Result push(Paint* paint) instead of Result push(std::unique_ptr<Paint> paint))
    How would you suggest I can do this same thing without the overloaded method? How can I do this without modifying ThorVG? ThorVG makes huge use of std::unique_ptr, which makes it difficult to manage my own paints :)
    See https://github.com/DeriveSDK/experiments/blob/main/MultiRiveRenderTest/MultiRiveRenderTest.cpp#L43
    Hermet Park
    @hermet
    @projectitis hi. ok a bit busy these days. let me figure out your code... you are trying to retain the paints right?
    the basic idea of the tvg is that, shot & forget the paints node.
    thus retaining paints node is not the standard approach basically, though there is a way to do that.
    If you checked the examples of the tvg...
    @projectitis otherwise did you check this example ? https://github.com/Samsung/thorvg/blob/master/src/examples/DirectUpdate.cpp
    Hermet Park
    @hermet
    @projectitis sorry for late reply, your patch has been submitted. rive-app/rive-tizen#69
    It will be appreciated if somebody can help this rive-app/rive-tizen#70
    projectitis
    @projectitis
    @hermet thank you. Please do not feel any pressure from my issues. They are not urgent. If you are busy with other things, please don’t worry about them :) That goes for other contributors, too. Thanks for an amazing library!
    1 reply
    Hermet Park
    @hermet
    @projectitis applied thanks! rive-app/rive-tizen#71
    1 reply
    Hermet Park
    @hermet
    @ifire:mozilla.org hello, curious if the godot engine has been released including thorvg ; ), if so, i would like to update the tvg pages.
    iFire
    @ifire:mozilla.org
    [m]
    @hermet: there's been 5 alphas of godot 4
    thorvg is in them
    iFire
    @ifire:mozilla.org
    [m]
    There are still 6000 open bugs on the issue trackr :(
    1 reply
    iFire
    @ifire:mozilla.org
    [m]
    Alpha 7 now