Canvas and Sprite - image manipulation

This forum is currently in read-only mode.
From the Asset Store
Pixel Destruction like in "Worms" (Drawing Canvas based)
  • Hello, I'd like the following features to be implemented if possible, for greater synergy between Canvas and Sprite objects:

    Canvas: Copy from Sprite (animation frame)

    Canvas: Copy to Sprite (animation frame)

    Canvas would attempt to fit whatever it can into Sprite, filling it with the image. Canvas can take any shape and amount of textures, while Sprite contains one full texture per frame. If no animation frame is specified, the default is assumed. Canvas should respect the current filter and opacity setting of the sprite.

    Canvas: Copy from Sprite (animation frame) to (X,Y offset within Canvas)

    Essentially the same as Paste Object at given coordinates.

    Canvas: Copy to Sprite (animation frame) from (X,Y offset within Canvas)

    The reverse of Paste Object, Sprite's texture is changed to the texture within Canvas, beginning at given offset coordinates and ending at the offset + Sprite's texture size

    Canvas can be freely resizable, while Sprite just stretches its texture. Sometimes we may want the Sprite to change its texture size (not the current size, which just stretches it):

    Sprite: Change texture size (width, height)

    That's not all - Sprite can have a collision mask, so it would be good to be able to copy the image from Canvas to Sprite as collision mask rather than animation frame. Obviously it should go both ways, so we can alter the Sprite's current collision mask.

    Canvas: Copy to Sprite (collision mask)

    Canvas: Copy from Sprite (collision mask)

    The above methods would give us greater freedom in sprite and canvas manipulation. Let me supply a few example cases:

    a) Tileset - Canvas contains the tileset, Sprite represents a tile. At start of the layout, Canvas pastes from a sprite containing the full tileset and then copies individual tiles to tile sprites as necessary. The tileset may freely be changed and the tile sprites updated accordingly (imagine switching between summer and winter tilesets).

    b) Character customization - Canvas copies from sprites containing base graphics (white skin, red hat, blue jacket, pink pants), merges them and then copies the new image to Player sprite. The whole process can be repeated for each animation frame!

    Base images are stored in separate sprites, which can be tinted differently (color filter, etc.).

    c) Visible damage - Paste sprite into Canvas, erase a part of the image, copy it back to the sprite. If the sprite uses per-pixel collisions, we have deformable terrain. Alternatively, copy the image to sprite as collision mask.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can already do most of that with the image manipulator. 'Copy from sprite' works with canvases too. It would be nice if they implemented the ability to set the alpha of a pixel with it, tho.

    Any chance that could get implemented, devs? Please?

  • Well, problem is the image manipulator is terribly inefficient, bringing the FPS down to single digits at times.

  • Well that's because its copying from the gpu. You would be doing the same thing when you transfer the images. Unless there's a different way?

  • Sprite pasting into Canvas is pretty fast compared to the image manipulator. In fact, it is lightning years ahead.

  • All I know is it takes a tick to read from the gpu, and then another to "copy to".

    So I'm guessing(as usual) canvas skips one of these steps.

    Then guessing again its working like a screen capture, given that it can only copy things that exist on screen.

    Something else I wish canvas could do....

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)