colour-rgba
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "colour-rgba", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A module for creating RGBA Colour objects and manipulating, un/packing and de/serializing them.", | ||
@@ -33,3 +33,2 @@ "main": "src/colour.js", | ||
"dependencies": { | ||
"bytebuffer": "^5.0.1", | ||
"extended-math": "^1.0.4", | ||
@@ -36,0 +35,0 @@ "extra-utilities": "^1.3.0" |
@@ -20,3 +20,3 @@ # Colour RGBA | ||
// or use a pre-defined colour | ||
var red = Colour.RED; | ||
var red = Colour.LimeGreen; | ||
@@ -23,0 +23,0 @@ // convert a colour to an array excluding the alpha channel |
@@ -5,3 +5,2 @@ "use strict"; | ||
const extendedMath = require("extended-math"); | ||
const ByteBuffer = require("bytebuffer"); | ||
@@ -161,6 +160,2 @@ class Colour { | ||
static deserialize(buffer) { | ||
if(ByteBuffer.isByteBuffer(buffer)) { | ||
buffer = buffer.toBuffer(); | ||
} | ||
if(!Buffer.isBuffer(buffer)) { | ||
@@ -194,16 +189,13 @@ return null; | ||
let paletteByteBuffer = new ByteBuffer(includeAlpha ? 4 : 3); | ||
paletteByteBuffer.order(true); | ||
let paletteBuffer = Buffer.alloc(includeAlpha ? 4 : 3); | ||
paletteByteBuffer.writeUint8(this.r); | ||
paletteByteBuffer.writeUint8(this.g); | ||
paletteByteBuffer.writeUint8(this.b); | ||
paletteBuffer.writeUInt8(this.r, 0); | ||
paletteBuffer.writeUInt8(this.g, 1); | ||
paletteBuffer.writeUInt8(this.b, 2); | ||
if(includeAlpha) { | ||
paletteByteBuffer.writeUint8(this.a); | ||
paletteBuffer.writeUInt8(this.a, 3); | ||
} | ||
paletteByteBuffer.flip(); | ||
return paletteByteBuffer.toBuffer(); | ||
return paletteBuffer; | ||
} | ||
@@ -210,0 +202,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2
16300
337
- Removedbytebuffer@^5.0.1
- Removedbytebuffer@5.0.1(transitive)
- Removedlong@3.2.0(transitive)