Amith: But the stuff you find on stackoverflow is for text content of nodes, not attributes or script tags
Gull: Madsy: do you want to do it on the server or in a browser?
Gull: So why not create DOM nodes?
Gull: Madsy: what are you trying to do?
Okane: What’s a good approach for ‘wrapping’ a canvas’s 2d context? e.g. if my canvas is 100 height, and I render a 200 height image to x 0, y 50, it would show the top 50 pixels from 50 to 99, on the canvas, and the bottom pixels from my image at 0 to 49
Reidel: Jkoudys, you’d have to manually tile it
Mazzacano: Draw it 4 times or whatever
Somerfield: Gull: I made a peer-to-peer chat as a demo with WebRTC. The content sent between users needs to be escaped before it is displayed.
Casilla: Madsy, if it’s just text, the best thing to do is set element.textContent
Fordham: Cheerio is quite powerful and still lightweight to handle such issues
Senk: Madsy, second best is to use a template library like handlebars
Fordham: Like escaping html etc
Fulwider: It does basic escaping by default
Riggle: Biddlecome, gotcha – so I’ll just putImageData the same image once where the y aligns with the top of my image, and again where the y aligns on the bottom
Petzold: So if my x offset is 0 but y offset is set, 2 tiles, if they’re both something, 4 tiles, and if both 0 just 1 tile
Reik: Yeah, better to generalize it, though
Schlitz: Biddlecome, I built a screen rendering engine for Game Boy on top of a 2d-context. Trying to recompile to a less-accurate but more modern approach of essentially just drawing all the sprites as ImageData on a canvas
Thavichith: Works really well, but I didn’t realize I’d need to write this scrolly logic. Could slow it down quite a bit :
Royals: Jkoudys, you might want to try pixi.js
Traw: Webgl is really fast with tiled textures
Laskowitz: 2d canvas is really terrible for tiled textures
Gibbings: Biddlecome, yeah I’m finding that. I’m already using webgl shaders for my scaling engine using a hq4x algo that looks maaahvelous
Arey: So maybe I’ll just convert it to 100% webgl rendering right now and save myself the headaches later
Fordham: Just put into addressbar and hit enter. or bookmark
Lickert: I’m actually finding canvas much less useful than I thought it would be. If I want to manage vector shapes, I’ll do them in SVG. If I want tiles, that can be pushed to WebGL which many browsers probably render SVG in already
Erenrich: Canvas is great for modifying raster images, but I don’t love it otherwise
Fordham: It just draws sth to screen
Fordham: And it does very quick
Fordham: If you expect vector imaging .no
Fordham: You have to put it on top
Ornelaz: Imo canvas2d is great for getting an idea on the screen quickly
Ornelaz: You can also usually make it reasonably performant with a bit of work
Fordham: You can nicely get every 2d context and overdraw it
Ornelaz: Webgl is better for a lot of things but also isnt as widely supported
Fordham: Doesn’t webgl draw on canvas?
Ornelaz: That’s why i said canvas2d
Fordham: So webgl is better than canvas2s, right?
Loera: Biddlecome, any good resources to read up on other than pixi.js? Looks like a good lib, but I’m mostly playing with this to learn the technologies involved
Fordham: Anyway. yea. im lazy and even use three.js