Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@thi.ng/adapt-dpi

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/adapt-dpi

HDPI canvas adapter / styling utility

  • 2.2.30
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
increased by66.67%
Maintainers
1
Weekly downloads
 
Created
Source

@thi.ng/adapt-dpi

npm version npm downloads Mastodon Follow

This project is part of the @thi.ng/umbrella monorepo and anti-framework.

[!IMPORTANT] This package has been deprecated and merged into @thi.ng/canvas.

About

HDPI canvas adapter / styling utility.

Attempts to determine display pixel density via window.devicePixelRatio (default 1.0) and resizes canvas accordingly. I.e. If DPR != 1.0, attaches explicit width and height CSS properties to force canvas to given CSS pixel size, and resizes canvas pixel buffer itself based on DPR (e.g. 2x size).

Status

DEPRECATED - superseded by other package(s)

Search or submit any issues for this package

Installation

yarn add @thi.ng/adapt-dpi

ES module import:

<script type="module" src="https://cdn.skypack.dev/@thi.ng/adapt-dpi"></script>

Skypack documentation

For Node.js REPL:

const adaptDpi = await import("@thi.ng/adapt-dpi");

Package sizes (brotli'd, pre-treeshake): ESM: 135 bytes

Dependencies

None

API

Generated API docs

import { adaptDPI, isHighDPI } from "@thi.ng/adapt-dpi";

const canvas = document.createElement("canvas");

adaptDPI(canvas, 640, 480);

if (isHighDPI()) {
    // ...
}

Authors

If this project contributes to an academic publication, please cite it as:

@misc{thing-adapt-dpi,
  title = "@thi.ng/adapt-dpi",
  author = "Karsten Schmidt",
  note = "https://thi.ng/adapt-dpi",
  year = 2015
}

License

© 2015 - 2023 Karsten Schmidt // Apache License 2.0

Keywords

FAQs

Package last updated on 28 Dec 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc