[PLUGIN] Canvas

Post your completed addons to share with the community

Post » Mon Sep 02, 2013 2:25 am

@R0J0hound
Thank you so much for the improvements. This helps a lot with the app we're working on!
ImageImageImage
B
38
S
5
G
4
Posts: 79
Reputation: 5,355

Post » Mon Sep 02, 2013 3:16 am

Great plug-in indeed. Would it be possible to allow drawing only a part of the canvas, by defining a rectangle or something?
B
8
S
1
Posts: 15
Reputation: 455

Post » Mon Sep 02, 2013 2:39 pm

Thanks R0J0, now seems to work great on minify, thanks a lot!
B
12
S
3
G
1
Posts: 347
Reputation: 2,866

Post » Tue Sep 03, 2013 10:15 pm

R0J0, would you be offended if I said I made a new icon?
It may stand out just as much to some because it's not as 2d as the standard ones, but it uses the color scheme.

If anyone wants it.. https://dl.dropboxusercontent.com/u/85412219/forumposts/Canvas-PluginIcon.ico
B
201
S
52
G
30
Posts: 897
Reputation: 36,621

Post » Tue Sep 03, 2013 11:32 pm

[QUOTE=Alpro] Great plug-in indeed. Would it be possible to allow drawing only a part of the canvas, by defining a rectangle or something?[/QUOTE] that would kind of defeat the whole purpose of using it, don't ya think? You could just use a smaller canvas.
B
12
S
3
G
1
Posts: 347
Reputation: 2,866

Post » Wed Sep 04, 2013 1:09 am

[QUOTE=ghost]that would kind of defeat the whole purpose of using it, don't ya think? You could just use a smaller canvas.[/QUOTE]The idea is to build some kind of sprite sheet at runtime, out of many other sprites. I figured dealing with a single canvas would be better than several sprites. I suppose i could use multiple small canvases instead...
B
8
S
1
Posts: 15
Reputation: 455

Post » Wed Sep 04, 2013 6:47 pm

@tulamide
That memory leak comes from the texture not being freed when the canvas is destroyed. It only occurs on xp with webgl on and I can't fix it... but I'm not sure why.

In other news I had a go at making a proper webgl fix and ran into too many issues to get it to work. C2's runtime isn't designed for it and I lack the technical knowledge, ability and time to get something working. So for the foreseeable future my recommendation is to use the plugin with webgl off for the best speed.

@Alpro
I suppose it's doable but it doesn't really fit in with the canvas' purpose. Pasting a canvas with the spritesheet to a smaller one is a cleaner solution imo.

@Paradox
I'm not offended at all. That's one nice looking icon. I'll include it in my next update. Thanks.
B
79
S
24
G
54
Posts: 4,747
Reputation: 40,757

Post » Wed Sep 04, 2013 11:59 pm

@ROJOhound
Thank you for your effort! Also, with XP currently at around 20% market share and falling, this won't be much of an issue in future.
It keeps being a good and useful plugin
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Thu Sep 05, 2013 1:10 am

@R0J0hound
Thanks for taking a look at a full WebGL fix. Even without a full fix, the improvements so far have been great.

Is this something that Ludei could actually address from their end, or would the fix have to come from the plugin?
ImageImageImage
B
38
S
5
G
4
Posts: 79
Reputation: 5,355

Post » Fri Sep 06, 2013 5:21 pm

@ROJOhound
Minor issues:

1) Using floats, as for example created by random(), in the color fields of the gradient function produces a javascript error.

For example:
"rgb(" & random(255) & ", 128, 128)" outputs a "...line 493 (col undefined)" error
"rgb(" & round(random(255)) & ", 128, 128)" works as expected (and any other expression generating an integer)

2) The gradient style "horizontal" reads "hoizontal".

3) Using floats, as for example created by random(), in the color field of the fill function does not produce a javascript error, but isn't working either. The canvas will be filled with black instead of the specified color.

For example:
"rgb(" & random(255) & ", 128, 128)" fills with black
"rgb(" & round(random(255)) & ", 128, 128)" works as expected

4) Using floats, as for example created by random(), in any field of the floodfill function does not produce a javascript error nor fill with black, but isn't working either. Javascript doesn't answer anymore and one can only stop the script.

For example:
random(100) in the x or y field, "rgb(" & random(255) & ", 128, 128)" in the color field, all lead to the script having to be stopped
round(random(100)) in the x or y field, or "rgb(" & round(random(255)) & ", 128, 128)" work as expected.

There may be other functions as well with inconsistencies, but I only tested those three.

I propose that all functions behave the same. If it isn't possible to convert float to int within the plugin, then it would be best to just draw black. If you feel uncomfortable with just drawing then all three should output a javascript error.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 0 guests