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

glaciall-bitmap

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glaciall-bitmap - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

25

bitmap.js

@@ -153,2 +153,25 @@ var Base64Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');

// 预先使用 getPixel() 生成RGB数值的二维数组,便于调用者稍后以之快速定位像素,因为查表的速度远高于即时计算 getPixel()
// 返回的内容为[ [0xrrggbb, 0xrrggbb], [0xrrggbb, 0xrrggbb] ]的[[x维],[x维]]二维数组内容
// 如果位图原始数据被比如 setPixel() 修改了,则需要重新调用本函数来更新RGB二维数组
this.getRgbRect = function()
{
let rect = [];
for (let y = 0; y < this.height; y++) {
let rectX = [];
for (let x = 0; x < this.width; x++) {
const p = this.getPixel(x, y);
rectX.push((p[0] << 16) | (p[1] << 8) | p[2]);
}
rect.push(rectX);
}
return rect;
}
// 将 0xrrggbb 转换为 '#rrggbb'
this.rgbToHexString = function(rgb)
{
return '#' + (rgb & 0xFFFFFF).toString(16).padStart(6, '0');
}
// 获取当前bitmap的datauri串,用于显示或发送到服务器端

@@ -207,2 +230,4 @@ this.toBase64 = function()

this.height = this.getHeaderValue(BitMapFormat.biHeight);
var biSizeImage = parseInt((this.width * 24 + 31) / 32) * 4 * this.height;
_length_to_fit = biSizeImage / this.height - (this.width * 3);
}

@@ -209,0 +234,0 @@ }

5

package.json
{
"name": "glaciall-bitmap",
"version": "1.0.0",
"version": "1.1.0",
"description": "Manipulate bitmap image with pure JavaScript, and can be base64 format to display on web",

@@ -19,3 +19,4 @@ "main": "bitmap.js",

"jsbitmap",
"react"
"react",
"rgb"
],

@@ -22,0 +23,0 @@ "contributors": [

@@ -61,5 +61,13 @@ jsBitmap

十、Bitmap.getRgbRect()<br/>
&nbsp;&nbsp;&nbsp;&nbsp;预先使用 getPixel() 生成RGB数值的二维数组,便于调用者稍后以之快速定位像素,因为查表的速度远高于即时计算 getPixel()<br/>
&nbsp;&nbsp;&nbsp;&nbsp;返回的内容为[ [0xrrggbb, 0xrrggbb], [0xrrggbb, 0xrrggbb] ]的[[x维],[x维]]二维数组内容<br/>
&nbsp;&nbsp;&nbsp;&nbsp;如果位图原始数据被比如 setPixel() 修改了,则需要重新调用本函数来更新RGB二维数组<br/>
十一、Bitmap.rgbToHexString(rgb)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;将 0xrrggbb 转换为 '#rrggbb'<br/>
PS
========
[glaciall](https://github.com/glaciall) [authorized](https://github.com/glaciall/jsBitmap/pull/2#issuecomment-566343119) [flyskywhy](https://github.com/flyskywhy) to publish glaciall-bitmap on npm.
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