Color Opacity

davianblackdavianblack Posts: 4
edited September 2013 in General
Hi all,

Is it still possible to set the opacity of your brush? I use the feature quite often to draw shadows and without it I'm pretty lost. I can't find the feature anywhere.

Thank you in advance!

Comments

  • EDIT: Just saw that it will be implemented later.

    Thanks anyway!
  • SimonSimon Posts: 58
    BTW: You can make a new layer and set the opacity for the layer itself. So you can simulate shadows on this layer. 
    Later on you can merge the layers if you want.
    Thats the way I do it for shadows at the moment.
  • I second that. the ability to change the opacity of the brush is what made me stick with pyxel edit as my pixel editor of choice. 

    Please please please put it back. 

    Thanks for the tip Simon. :)
  • DanikDanik Posts: 776
    I was not happy with the way semi-transparent drawing worked so I took it out. I want to implement the behavior for opacity in for example Photoshop where opacity is "applied" as a layer of color on top when you stop drawing instead of continuously adding up during the stroke.

    Yeled_pele, would you prefer the old behavior? Maybe I will implement both opacity and flow, just like in Photoshop.

    I will bump the item up a few steps on the todo-list.
  • Yeah whats the harm to put it back, and add a new method later when you get the time.
    Happy customers and happy dev, will have to find cool name for it though.
  • Danik, i think in PS strokes drawing on different bitmap, instead drawing in layer directly.
  • DanikDanik Posts: 776
    I think so too. Question is how to do this with the way tile reference drawing works now (it's currently plotting directly on the tile/canvas bitmaps during the stroke).
    Maybe use a separate bitmap only as a mask, to know which parts have been drawn to during the stroke.
  • WeslomPoWeslomPo Posts: 23
    edited September 2013
    Can you фllow to add files "*.as" the forum?
    I think thats doing like this.

    On tiles thats draw by copyPixels part of buffer.

    (example in ImageEditor.zip)
  • DanikDanik Posts: 776
    Thanks WeslomPo. Yea, the problem is updating all the tiles live. Some tiles/pixels are hidden by other layers, so I can't just use a single stroke buffer. Tile references means you are drawing on multiple layers at once.
  • Danik, that's intersting. I did not see how a quick fix. But, i do think about it..
  • WeslomPoWeslomPo Posts: 23
    edited September 2013
    Hey-hey! I did it! But code looks ugly(...
    Example and source in archive.

    P.S. add _bfr.fillRect(_buffer.rect, 0); before second for-cycle, for optimization
  • I forgot, why are we even started talking about it :) Transparency!
    Added transparency example.
    I think thats works nice.
  • DanikDanik Posts: 776
    Still one problem though (unless I misunderstand your code).
    If you have a layer on top the preview is incorrectly drawn over that layer.
    See the image I attached, the bottom part shows what would happen when you draw on the grass layer.
    But I'm a bit too tired to think of how to solve it right now. ;P
  • Danik, that is not a problem (both).
    First, code i write to solve problem fast, before i go to sleep (and your comment i read on my phone wakes me up in at midnight).Now i clear it, and, i think, it will become easier.
    Second, thats is not problem. I think my code solve that situation already.
  • I clear code, refactored and commented all things.

    There I added some commetns about what you see in screen:

    image
  • WeslomPoWeslomPo Posts: 23
    edited October 2013
    Why if you have a layer on top the preview is incorrectly drawn over that layer is not problem for my code?
    Because my code draw buffer to tileset first, then draw buffered tileset on layer (not on screen). If you have layer over current, you need only redraw it, if it needed.

    for some reason, a file won't attach to the last post
  • DanikDanik Posts: 776
    WeslomPo, thanks for the code (and thanks for the efla function, it's faster than what I use).
    Why if you have a layer on top the preview is incorrectly drawn over that layer is not problem for my code?
    Because my code draw buffer to tileset first, then draw buffered tileset on layer (not on screen). If you have layer over current, you need only redraw it, if it needed.
    But if two layers have the tile in them, I need to update both layers (or layer previews) during the stroke. I still don't understand how to do that with correct occlusion. (again, sorry if I'm misunderstanding)

    Lay1  Lay2  Lay3
    0000  0000  0000
    0110  0000  0000
    0110  0110  0022
    0000  0110  0022

    If I'm drawing on tile1 in layer1 (bottom layer), I need to update that tile in both layer1 and layer2. If tile2 is only partly covering then the stroke preview need to be partly updated "under" that tile.

    There would need to be separate preview buffers for each layer or something.

    Or (which is what I'm currently considering) there can be a grayscale buffer ("cover buffer") that stores how much color has been applied to each screen pixel. When drawing pixels I can check this buffer to see whether a pixel is already drawn to or not.
    This buffer can store a binary value per pixel 1/0, or it can store a range 0-255 to allow for drawing with flow (adding color continuously during the stroke until a pixel reaches 255).
    Then the stroke would not be stored in a buffer. The pixels would be changed directly in the layers but the buffer limits their value. This means it would work nice with my current tile pixel update system.
    Sadly though I don't have any time to work on it right now, so I have to wait to try it out.
  • Danik, i still not view problem in that. But. But i can spend a bit of time to experiment (add layers, some classes, etc.). The evening I will show what I did. 
    About grayscale buffer. I have that technique in that example - "_bufferMask" - where I a little clumsy checks where user was draw.

    efla - function is not mine, I finded it in internet. She is a little inaccurate - though fast. Or I user bad algoritm to save previous-current points.
Sign In or Register to comment.