Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
get-canvas-context
Advanced tools
Readme
Creates a new HTML5 Canvas Context with the given dimensions and options. Returns null
if not supported.
Supports 'webgl'
, 'webgl2'
and '2d'
, handles vendor prefixing, and runs in Node and the Browser.
npm install get-canvas-context --save
var getContext = require('get-canvas-context')
// create a new 50x50 2D canvas
var ctx = getContext('2d', {
width: 50,
height: 50
})
// add to DOM
document.body.appendChild(ctx.canvas)
// draw to it
ctx.fillRect(0, 0, 50, 50)
Or, WebGL using an existing canvas:
var canvas = document.createElement('canvas')
var gl = getContext('webgl', {
canvas: canvas,
antialias: true
})
if (!gl) {
throw new Error('webgl not supported')
}
ctx = createContext(type, [opt])
Returns a new canvas context for the given type
, a string which is either '2d'
, 'webgl'
or 'webgl2'
. The options:
canvas
- an existing canvas element to re-use rather than creating a new onewidth
- if specified, will set the canvas widthheight
- if specified, will set the canvas height{...contextAttributes}
any other options for the rendering context, like alpha
Handles vendor prefixing for WebGL contexts. Returns null
if we are not in a browser, or if the context is not available, or if there was an error creating the context.
Note: As of the time of writing (Jun 2015), "webgl2"
is only supported through special flags in Chrome Canary and FireFox Nightly.
MIT, see LICENSE.md for details.
FAQs
gets canvas context by name
The npm package get-canvas-context receives a total of 173,242 weekly downloads. As such, get-canvas-context popularity was classified as popular.
We found that get-canvas-context 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.