Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
bresenham-zingl
Advanced tools
Port of C code by Alois Zingl from this paper
npm i -S bresenham-zingl
These are two callbacks you will have to provide in order to make use of the output:
setPixel(x, y)
Use that callback to fill the pixel on canvas.
parameter | type | description |
---|---|---|
x | number | |
y | number |
setPixelAlpha(x, y, alpha)
Callback that would also receive the alpha value for the pixel
parameter | type | description |
---|---|---|
x | number | |
y | number | |
alpha | number |
line(x0, y0, x1, y1, setPixel)
Line segment rasterisation
parameter | type | description |
---|---|---|
x0 | number | |
y0 | number | |
x1 | number | |
y1 | number | |
setPixel | setPixel |
ellipse(xm, ym, a, b, setPixel)
Draws ellipse
parameter | type | description |
---|---|---|
xm | number | |
ym | number | |
a | number | |
b | number | |
setPixel | setPixel |
circle(xm, ym, r, setPixel)
Circel rasterisation
parameter | type | description |
---|---|---|
xm | number | |
ym | number | |
r | number | |
setPixel | setPixel |
quadBezierSegment(x0, y0, x1, y1, x2, y2, setPixel)
plot a limited quadratic Bezier segment
parameter | type | description |
---|---|---|
x0 | number | |
y0 | number | |
x1 | number | |
y1 | number | |
x2 | number | |
y2 | number | |
setPixel | setPixel |
quadBezierAA(x0, y0, x1, y1, x2, y2, setPixelAA)
Plot any quadratic Bezier curve with anti-alias
parameter | type | description |
---|---|---|
x0 | number | |
y0 | number | |
x1 | number | |
y1 | number | |
x2 | number | |
y2 | number | |
setPixelAA | setPixelAlpha |
quadBezier(x0, y0, x1, y1, x2, y2, setPixel)
Plot any quadratic Bezier curve
parameter | type | description |
---|---|---|
x0 | number | |
y0 | number | |
x1 | number | |
y1 | number | |
x2 | number | |
y2 | number | |
setPixel | setPixel |
quadRationalBezierSegment(x0, y0, x1, y1, x2, y2, w, setPixel)
plot a limited rational Bezier segment, squared weight
parameter | type | description |
---|---|---|
x0 | number | |
y0 | number | |
x1 | number | |
y1 | number | |
x2 | number | |
y2 | number | |
w | number | |
setPixel | setPixel |
quadRationalBezier(x0, y0, x1, y1, x2, y2, w, setPixel)
plot any quadratic rational Bezier curve
parameter | type | description |
---|---|---|
x0 | number | |
y0 | number | |
x1 | number | |
y1 | number | |
x2 | number | |
y2 | number | |
w | number | |
setPixel | setPixel |
rotatedEllipse(x, y, a, b, angle, setPixel)
Plot ellipse rotated by angle (radian)
parameter | type | description |
---|---|---|
x | number | |
y | number | |
a | number | |
b | number | |
angle | number | |
setPixel | setPixel |
rotatedEllipseRect(x0, y0, x1, y1, zd, setPixel)
Rectangle enclosing the ellipse, integer rotation angle
parameter | type | description |
---|---|---|
x0 | number | |
y0 | number | |
x1 | number | |
y1 | number | |
zd | number | |
setPixel | setPixel |
ellipseRect(x0, y0, x1, y1, setPixel)
Rectangular parameter enclosing the ellipse
parameter | type | description |
---|---|---|
x0 | number | |
y0 | number | |
x1 | number | |
y1 | number | |
setPixel | setPixel |
cubicBezierSeg(x0, y0, x1, y1, x2, y2, x3, y3, setPixel)
Plot limited cubic Bezier segment
parameter | type | description |
---|---|---|
x0 | number | |
y0 | number | |
x1 | number | |
y1 | number | |
x2 | number | |
y2 | number | |
x3 | number | |
y3 | number | |
setPixel | setPixel |
cubicBezier(x0, y0, x1, y1, x2, y2, x3, y3, setPixel)
plot any cubic Bezier curve
parameter | type | description |
---|---|---|
x0 | number | |
y0 | number | |
x1 | number | |
y1 | number | |
x2 | number | |
y2 | number | |
x3 | number | |
y3 | number | |
setPixel | setPixel |
lineAA(x0, y0, x1, y1, setPixelAA)
Draw a black (0) anti-aliased line on white (255) background
parameter | type | description |
---|---|---|
x0 | number | |
y0 | number | |
x1 | number | |
y1 | number | |
setPixelAA | setPixelAlpha |
Returns number
,
circleAA(xm, ym, r, setPixelAA)
Draw a black anti-aliased circle on white background
parameter | type | description |
---|---|---|
xm | number | |
ym | number | |
r | number | |
setPixelAA | setPixelAlpha |
quadBezierSegmentAA(x0, y0, x1, y1, x2, y2, setPixelAA)
Draw an limited anti-aliased quadratic Bezier segment
parameter | type | description |
---|---|---|
x0 | number | |
y0 | number | |
x1 | number | |
y1 | number | |
x2 | number | |
y2 | number | |
setPixelAA | setPixelAlpha |
quadRationalBezierSegmentAA(x0, y0, x1, y1, x2, y2, w, setPixelAA)
draw an anti-aliased rational quadratic Bezier segment, squared weight
parameter | type | description |
---|---|---|
x0 | number | |
y0 | number | |
x1 | number | |
y1 | number | |
x2 | number | |
y2 | number | |
w | number | |
setPixelAA | setPixelAlpha |
lineWidth(x0, y0, x1, y1, wd, setPixel)
Plot an anti-aliased line of width wd
parameter | type | description |
---|---|---|
x0 | number | |
y0 | number | |
x1 | number | |
y1 | number | |
wd | number | |
setPixel | setPixel |
(The MIT License)
Copyright (c) 2012 Alois Zingl
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Bresenham rasterisation algorithms by Alois Zingl
The npm package bresenham-zingl receives a total of 175 weekly downloads. As such, bresenham-zingl popularity was classified as not popular.
We found that bresenham-zingl demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.