diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json
deleted file mode 100644
index 8c7a55b..0000000
--- a/.vscode/c_cpp_properties.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "configurations": [
- {
- "name": "Win32",
- "includePath": [
- "${workspaceFolder}/node_modules/node-addon-api/**",
- "${workspaceFolder}/color-quant",
- "${workspaceFolder}/color-quant/src",
- "${workspaceFolder}/color-quant/heap/src"
- ],
- "defines": [
- "_DEBUG",
- "UNICODE",
- "_UNICODE",
- "HOST_BINARY \"node.exe\""
- ],
- "windowsSdkVersion": "10.0.17763.0",
- "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe",
- "cStandard": "c11",
- "cppStandard": "c++17",
- "intelliSenseMode": "msvc-x64"
- }
- ],
- "version": 4
-}
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d3513cc..1151fa8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.8)
-
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
project(cquant)
diff --git a/README.md b/README.md
index 042b362..e580cdc 100644
--- a/README.md
+++ b/README.md
@@ -3,9 +3,8 @@
[](https://travis-ci.org/xVanTuring/cquant)
## View Latest Doc on [Github](https://github.com/xVanTuring/cquant)
## Preview
-
-
-
+
+
## Usage
> Current Supported Prebuild binary version: Node 6 | 8 | 10 | 11 \
diff --git a/TODO.md b/TODO.md
index 2f3e2d8..f90b208 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,5 +1,5 @@
-0. add test
-1. add para for subsampling
+0. ~~add test~~
+1. ~~add para for subsampling~~
2. use typescript wrapper
-3. add travis-ci
+3. ~~add travis-ci~~
4. remove rgba or not
\ No newline at end of file
diff --git a/compile_commands.json b/compile_commands.json
new file mode 120000
index 0000000..affbd32
--- /dev/null
+++ b/compile_commands.json
@@ -0,0 +1 @@
+./build/compile_commands.json
\ No newline at end of file
diff --git a/cquant.js b/cquant.js
index e77c205..2bc3e65 100644
--- a/cquant.js
+++ b/cquant.js
@@ -1,14 +1,14 @@
const addon = require('bindings')('cquant')
-function paletteAsync (buffer, depth, maxColor = 5, callback = null) {
+function paletteAsync(buffer, depth, maxColor = 5, maxSub = 0, callback = null) {
if (callback == null) {
if (depth !== 3 && depth !== 4) {
- return Promise.reject(new Error('Wrong Depth'));
+ return Promise.reject(new Error('Wrong depth!'));
}
if (maxColor <= 1 || maxColor > 256) {
- return Promise.reject(new Error('maxColor too small or too large'));
+ return Promise.reject(new Error('maxColor too small or too large!'));
}
return new Promise((res, rej) => {
- addon.PaletteAsync(buffer, maxColor, depth, (err, val) => {
+ addon.PaletteAsync(buffer, maxColor, depth, maxSub, (err, val) => {
if (err) {
rej(err)
} else {
@@ -18,14 +18,14 @@ function paletteAsync (buffer, depth, maxColor = 5, callback = null) {
})
} else {
if (depth !== 3 && depth !== 4) {
- callback(new Error('Wrong Depth'));
+ callback(new Error('Wrong depth!'));
return;
}
if (maxColor <= 1 || maxColor > 256) {
- callback(new Error('maxColor too small or too large'))
+ callback(new Error('maxColor too small or too large!'))
return
}
- addon.PaletteAsync(buffer, maxColor, depth, callback)
+ addon.PaletteAsync(buffer, maxColor, depth, maxSub, callback)
}
}
module.exports = {
diff --git a/img/0.jpg b/img/large.1.jpg
similarity index 100%
rename from img/0.jpg
rename to img/large.1.jpg
diff --git a/img/large.1.jpg.scaled.html b/img/large.1.jpg.scaled.html
new file mode 100644
index 0000000..59b7ef8
--- /dev/null
+++ b/img/large.1.jpg.scaled.html
@@ -0,0 +1,23 @@
+
+
+