Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Goals #1

Open
Kirkman opened this issue Dec 17, 2016 · 0 comments
Open

Goals #1

Kirkman opened this issue Dec 17, 2016 · 0 comments

Comments

@Kirkman
Copy link
Owner

Kirkman commented Dec 17, 2016

The idea

The Remote Imaging Protocol article on Break Into Chat says:

Vector image standards used on the World Wide Web today such as Adobe Flash and Scalable Vector Graphics (SVG) have some similarities to RIP.

That got me thinking ... If RIP is a vector format, why not create a converter that could turn old RIP art into SVG -- or newer SVG drawings into RIP?

That was the genesis of this HTML5 / RIP experiment. Right now I'm learning how to draw RIP art using the HTML5 <canvas> element. But once I have that working, my goal is to adapt the code to use SVG as well.

The problems

At this point it's clear that certain parts of the RIP standard will not translate to SVG, such as flood fill.

In fact, flood fill is also a problem for the built-in canvas API commands. Browsers anti-alias all lines drawn on the canvas, which makes it very tricky to do a border-seeking floodfill when you have lines and shapes drawn with a lineWidth of 1px (which is normal in RIP).

There are ways to avoid anti-aliasing horizontal and vertical lines, by using half-pixel coordinates. But the only solution I see for diagonal lines would be to draw them repeatedly until all the line's pixels become solid. Unfortunately this would cause 1px diagonal lines to render much thicker than they should be.

Another workaround would be to NOT use the canvas API for drawing lines and shapes. Instead, you would calculate lines and curves using Bresenham's line algorithm, and then draw them pixel by pixel onto the canvas. This would allow for nearly pixel-perfect RIP display, but runs against my goal of making displaying RIP as resizable vector art.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant