npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gw-canvas

v1.2.0

Published

Library for rendering colorized bitmap fonts. Very fast, suitable for applications where the whole canvas needs frequent redrawing.

Downloads

20

Readme

gw-canvas

Library for fast rendering colorized bitmap fonts.

Features

  • Supports up to 256 glyphs from a 16x16 image
  • Allows changing glyphs
  • Updates are batched via requestAnimationFrame
  • Uses 4096 colors
  • Written in TypeScript
  • Can generate bitmap font images

Speed

  • WebGL2
  • No per-render memory allocations
  • Only one GL draw call for the whole canvas
  • Minimized JS data transfer (data set only for Provoking vertices)
  • Thousands of tiles rendered at 60 fps

Colors

Colors are represented by 12 bit numbers with 4 bits each for red, green, and blue values.

const red = 0xF00;
const green = 0x0F0;
const blue = 0x00F;
const yellow = 0xFF0;

These color integers are used for both the foreground and background drawing colors.

Glyphs

The Canvas works by using a bitmap font image that it loads into WebGL. The image MUST be a 16x16 layout for the glyphs. The size of the glyphs is inferred by the Canvas at construction time.

const canvas = GW.canvas.withImage({ image: 'image_id', width: 50, height: 38 });
document.body.appendChild(canvas.node);

canvas.draw(0, 0, 97, 0xF00, 0xFFF); // usually a red 'a' on white background.

More Information

Check out the online interactive Manual.

Credit

This project started as an attempt to modify Fastiles, but @ondras and I figured out that we had different goals. Based on that I created this library. However, the hard work in the code is all done by @ondras - by that I mean setting up the initial WebGl pipeline and getting it to work. I changed some things, but the heart of it is still the same as Fastiles. Many thanks to @ondras for the inspiration and the launching point.