Canvas and Sprite - image manipulation

New releases and general discussions.

Post » Tue Feb 16, 2010 12:31 pm

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) [u:xatx9ta2]Tileset [/u:xatx9ta2]- 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) [u:xatx9ta2]Character customization [/u:xatx9ta2]- 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)[u:xatx9ta2] Visible damage[/u:xatx9ta2] - 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.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Mon Sep 27, 2010 1:06 pm

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? :)
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Mon Sep 27, 2010 1:17 pm

Well, problem is the image manipulator is terribly inefficient, bringing the FPS down to single digits at times. :|
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Mon Sep 27, 2010 4:01 pm

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?
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Tue Sep 28, 2010 5:58 am

Sprite pasting into Canvas is pretty fast compared to the image manipulator. In fact, it is lightning years ahead.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Tue Sep 28, 2010 9:27 am

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....
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 0 guests