ArtemKuchin

Forum Replies Created

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • in reply to: Need help with blending #10614

    ArtemKuchin
    Participant

    Amazing!

    Windows 10, intel graphics

    before 90 fps

    after  220 fps

    Android, Samsung J5 2016

    before 30 fps

    after 120 fps

    now this can be actually used 🙂

    in reply to: Need help with blending #10603

    ArtemKuchin
    Participant

    Jesse, yes, of course when i make this change i get the original problem.

    It was only done to demonstarte the perfomance penalty. And the question why drawing into image convas is so much slower.

    in reply to: Need help with blending #10590

    ArtemKuchin
    Participant

    Thank you Jesse.

     

    I ran your code and it works as needed.I tested perfomance and compared.

    Your code run at 90 fps

    My code runs at 350 fps

    If i put

    cnvs=canvas

    befor

    cnvs.Clear(New Color(0,0,0,0))

    (basically drawing again everything into main canvas instead of image)

    I get 300 fps from your code

    So, drawing into canvas attached to an image has huge perfomance penalty.

    Interesting, however, than it does not really matter how much i draw into that image canvas. If i have flush or clear

    i get stable 90 fps.

    I wonder why so much perfomance penalty and why it is pretty constant and independat of how much is drawing into it.

    in reply to: Need help with blending #10537

    ArtemKuchin
    Participant

    alas, this is not it because if te green circle is for example 0x88 then when blended with itself  using additive blending it gets 0xff color in green channel, which is is not the original 0x88

    i miss normal bitwise OR/AND/XOR blending

    in reply to: Change color in a sprite #10365

    ArtemKuchin
    Participant

    Got it. But what exactly premultiplying alpha does on pixmap? It does not seem to modify pixmap data at all. Since pmAlpha is using DESTINATION RGB to calculate resulting pixel color then it seems like premultiplying alpha is just some kind of flag/parameter  which is used by device rendering part. And it seems to work globaly, not locally for one pixmap.

    At least in all examples i saw the pmAlpha is set for d3d globally.

    in reply to: Change color in a sprite #10362

    ArtemKuchin
    Participant

    Thank you for explaning the badk work with image data. This is a mess, but probably there is not better way for now at least.

    I understood that pixmap is the basic object for images and that the thing i need. Image is kinda convinience wrapper.

    As you see i am using pixmap load i the example i did.

    But i dont understand how pmAlpha argument for pixmap.load works.

    If i set it to False i don’t get any alpha at all. So, basically it is pmAlpha=True or no alpha at all.

    Did i get it right?

    in reply to: Change color in a sprite #10354

    ArtemKuchin
    Participant

    Okay, i have done it. See code below. HOWEVER one thing i don’t understand. if ALPHA channel is ZERO i can still the color. To fully hide pixel i need to set ALPHA to zero and RGB to zero also. This i don’t understand.

     

    Attachments:
    in reply to: Change color in a sprite #10351

    ArtemKuchin
    Participant

    aha, so i neex pixelmap, not image

    pixelmap has load  method which load from png and save which saves to png

    that’s very good, i will play with it

    in reply to: Change color in a sprite #10336

    ArtemKuchin
    Participant

    Aha, found this in image class description

     

      <li class=”mx2docs”>Color – when rendering an image to a canvas, this property is multiplied by the current canvas color and the result is multiplied by actual image pixel colors to achieve the final color to be rendered.

    So, color does not do it.

    I guess i need a way to directly manipulate pixels in image or on canvas in ARGB fomat.

    I don’t see anyt ReadPixels/WritePixels in mojo2 for images and buffers.

    Is it possible?

    in reply to: Change color in a sprite #10333

    ArtemKuchin
    Participant

    Thank you

    I tried mojotest app from bananas

     

    did this:

    image=Image.Load( “asset::RedbrushAlpha.png” ) image=Image.Load( “asset::RedbrushAlpha.png” ) image.Color=Color.Grey

    The result is strange. Seems .color does not replacem pixel colors, but mixes with pixels in image.

    See attached file.

     

    Also, this way i do not have any way to choose what color to replace. But it is secondary task.

    in reply to: Android target is not built #5203

    ArtemKuchin
    Participant

    And final. The error was about min SDK version. The default gradle.build has level 10, while some calls are from level 12. I put level 12 into  min version and now it build without error. But still. very very manual.

Viewing 11 posts - 1 through 11 (of 11 total)