[PLUGIN] Canvas

2 favourites
From the Asset Store
Pixel Destruction like in "Worms" (Drawing Canvas based)
  • i am using canvas Eval() to run external script

    this code runs fine

    var sections = ['choice 1', 'choice 2','choice 3','choice 4','choice 5','choice 6','choice 7','choice 8'];

    but i want to load variables from array (arrayChoices) into sections

    i am doing it like this, but failing always

    var j = " & arrayChoices.Width & "; // size of array for loop

    your help is appreciated !

  • Hey R0J0hound

    First thank you for all your efforts for making Canvas and helping here.

    I am trying to do a simple "fill area with color" much like the MS Paint bucket coloring or Photoshop.

    • I have a problem where I can't use floodfill with color on a canvas object, it freezes the preview. and I have to quit the chrome window.
    • Tested many times on blanc projects: the only thing that works so far is fill canvas with color, but then all the object is colored as square or rectangle etc.
    • I'm on R 244, Win7 - 64bit, but a friend using Win 10 - 64 bit can create the floodfill with color interaction, yet if he sends me his capx, it still doesn't work for me.

    Is there something I can do? Also is there another way to fill areas with color other than using Canvas? I am thinking of other ways but my C2 knowledge is limited and it's been a while I didn't use it, but I like thinking of problems to solve...

    If anyone has a suggestion for making a simple area color fill (like the color bucket of MS Paint) then please feel free to share ideas

    Thanks in advance for any help!

  • The flood fill action doesn't work with transparent pixels. Rect fill it to a color first before drawing. I think that should work.

  • Hey R0J0hound

    thanks for your reply,

    Unfortunately doesn't work with filled colors either for me (but works for a friend, weird, and his capx gives me the same result: no coloring,)

    The simple capx:

    https://www.dropbox.com/s/zlv7n5z5mjnle ... .capx?dl=0

    reinstalled the graphics card driver to latest, verified Chrome version to latest etc (tried turning off Intel Virtualization but was told it's unrelated) so i don't understand the problem (I also reinstalled the canvas plugin again just in case)

    No Idea how I can fix that, what would you do?

    Otherwise I'd think of other techniques, but it would add more work, so if I can make the Canvas plugin work, that would save me a lot of time and energy, thanks again for any suggestion!

  • Oh, right. I looked at your example and you need to make the x,y values of the flood fill integers:

    int(Mouse.X-Canvas.X)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • R0J0hound it works! Thank you, you're a genius ^^

    Even though the coloring is not perfect on the edges (uncolored pixels showing up,) I think I can find a workaround, unless you have any tips, thanks again! ^^

  • It's just a flaw that non integer positions cause it to freeze. I really shouldn't make plugins since I have no intention to edit the plugin to fix it.

    The pixels at the edges that aren't filling are actually slightly different colors due to antialiasing and filtering. A threshold flood fill that is able to fill similar colors would work better. It's not terribly useful for me to mention it as the plugin doesn't have that feature and I won't be implimenting it.

  • Don't we have the close path action?

    I really need it

    edit: doesn't matter I added Close Path to the plugin

  • R0J0hound thanks again for the details, no worries I understand that it may be impossible to keep working on updates for free (it never ends i guess!)

    But if you ever think of making plugins then please do! Sometimes there are no other ways to do certain types of things (floodfill in my case) I wish I could do programming, alas i'm just a graphics guy

    So i'll always prefer finding a plugin for something, even if it doesn't work 100%, instead of finding nothing at all hehe.

    Thanks again for the tips (my workaround would be using a top sprite to hide the edges, and the canvas object under it, so the pixels will not show, already tested)

    I wish C2 supported vector objects, I guess it would have made this simple interaction so much easier!

    Thanks again!

  • Could someone please port this to a proper .c3addon so I can use it in Construct 3? Please and THANK YOU

  • i'm developing a coloring book and some leads are pointing me to this plug in. i just want to know if there will be an option such as a paint bucket, drag and drop colors to a line art. I would like to have a tutorial on that =(

  • I could use some help on this one - how would one do the following?

    • On Right Mouse down...

    Fill Canvas2 color "rbg("&Canvas.redAt(Mouse.X, Mouse.Y)&","&Canvas.greeAt(Mouse.X, Mouse.Y)& etc. etc. etc.

    When I do this, it works great, but when I zoom in the canvas or move the canvas, it visually zooms and moves around, but the color picker doesn't work properly. It's as if the canvas isn't updating when it moves or is resized.

    Am I doing something wrong?

  • Okay, I've managed to figure that out (it appears you just have to clear and redraw anytime the canvas is moved).

    However, now I'm unable to fill a canvas using variables. If I do "rbg("&variable1&","&variable2&","&variable3&")", it doesn't do anything (but if I set that to text, it comes out as "rgb(150, 150, 150)"). If I set the fill to those exact numbers, it fills fine. Any idea why it can't handle variables? I've tried putting it all to a string and setting the fill based on the string, putting str() around it...I can't for the life of me figure it out.

  • Hi I'm struggling with this Plugin but it's difficult as the URL to the example capx is broken

    How can I resize an image in order to change its resolution? For example: I choose a 128x128 image with the FileChooser, use this Plugin to make it 32x32 and then load this image to a sprite. It is important because I want to encode images into base64 and I need the URLs to be as short as possible (and I don't really care about resolution).

    Any clue?

  • ome6a1717

    Put int() around all the values. Numbers with decimals will make it not work.

    ChesVCF

    There should be an action to set the canvas' resolution. That won't resize the image though. For that load the image in a sprite or something, make the sprite size 32x32 and paste it to a canvas of size 32x32.

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