123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|303|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Misc Languages -> Javascript draw into new image

Posted : Sunday, 29 May 2022, 13:48
Pakz

Javascript draw into new image.


I think it is impossible to use google to find a answer to this problem. I simply want to use the javascript draw commands to work on a image.

Do I need to set the context to a image? Or some other kind of voodoo?
Posted : Sunday, 29 May 2022, 14:29
Pakz
Well. I give up.

I think it must be a security issue. I can modify a image per pixel. But not use regular draw commands on them.
Posted : Sunday, 29 May 2022, 15:29
Jayenkai
It probably is possible, but like you say, security and whatnot are the likely reason you can't.
Instead, create a canvas, draw using standard canvas drawing commands, then use the canvas.toDataURL() to convert the canvas' current content into an image.



-=-=-
''Load, Next List!''
Posted : Sunday, 29 May 2022, 15:54
Jayenkai


This should help you get your foot on the ground, here, I think..
... Maybe!

-=-=-
''Load, Next List!''
Posted : Sunday, 29 May 2022, 21:49
Pakz
Yes!

It took me a bit of reading and experimenting. But I was able to modify it to fit into my code.



I spent a couple of hours yesterday trying to find how to do this. Google gets confused with words like into and on top of. It also does not help that every one tries to beat the search results to display their pages that offer no real help. One page even showed 1 snippet with a thousand search words below it.
Posted : Monday, 30 May 2022, 02:31
Jayenkai
Further importance,
If you're going to start dabbling with javascript, though the browsers should all be safe with basic operations like this, security issues might arise.
Be sure to test on Firefox and a Chromium based browser, to be sure it works on at least those two main things. You also have your mobile, too.
Additionally, be sure to test the differences between what happens when you run it from your desktop, and what happens when you run it from a server, as .. again, security might intervene,
Audio is particularly annoying when doing this.

But otherwise you should be good to go!
JavaScript isn't "too" different from basic.

-=-=-
''Load, Next List!''
Posted : Monday, 30 May 2022, 03:45
Pakz
Mostly I'm trying to keep up to date with Javascript. I have a couple of new books that also use some Javascript.

I have a old javascript 'getting started' repo. Having it with enough examples so I can quickly do most stuff.

https://github.com/Pakz001/html5examples
Posted : Tuesday, 31 May 2022, 09:12
rychan
I try and keep a good distance behind with Javascript, that ol' problem of older browsers and users hanging on to them means I can't really experiment with newer stuff at work much.

Best of luck with it though

-=-=-
Web / Game Dev, occasionally finishes off coding games also!

Refresh Games - Game Dev Blog - Doll Photos
Posted : Tuesday, 31 May 2022, 10:00
Jayenkai
Yeah, the more simplistic the things you use, the more compatible it all should be.
Drawing to canvas is "usually" a basic thing.
I've purposely avoided using WebGL, so far, since a lot of older mobile devices tend not to have it on by default.

-=-=-
''Load, Next List!''