diff options
author | Daniel <790119+DanTheMan827@users.noreply.github.com> | 2017-12-01 00:49:50 +0300 |
---|---|---|
committer | Daniel <790119+DanTheMan827@users.noreply.github.com> | 2017-12-01 01:41:25 +0300 |
commit | 39924ba0ab4a0c3fabdf562bb695ca247b13fb2a (patch) | |
tree | a5eca9984898b06940e640b3f1a787ab739812dd |
Initial commit
-rw-r--r-- | .gitattributes | 2 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | Makefile | 12 | ||||
-rw-r--r-- | decodepng.cpp | 23 | ||||
m--------- | lodepng | 0 |
6 files changed, 41 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..2b9b79e --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +* text=auto eol=lf + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e660fd9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +bin/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..ff9f918 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lodepng"] + path = lodepng + url = https://github.com/lvandeve/lodepng.git diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..229e12a --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +BUILD_FLAGS := -DBUILD_COMMIT="\"`git rev-parse --short HEAD``git diff --shortstat --quiet || echo ' (dirty)'`\"" -DBUILD_DATE="\"`date -u +'%Y-%m-%d %H:%M:%S %Z'`\"" + +all: + mkdir -p bin + g++ -o bin/decodepng decodepng.cpp lodepng/lodepng.cpp $(BUILD_FLAGS) + +armhf: + mkdir -p bin + arm-linux-gnueabihf-g++ -o bin/decodepng-armhf decodepng.cpp lodepng/lodepng.cpp $(BUILD_FLAGS) + +clean: + rm -r bin
\ No newline at end of file diff --git a/decodepng.cpp b/decodepng.cpp new file mode 100644 index 0000000..9a30a25 --- /dev/null +++ b/decodepng.cpp @@ -0,0 +1,23 @@ +#include <stdio.h> +#include <iostream> +#include <iterator> +#include "lodepng/lodepng.h" + +int main(int argc, char *argv[]) +{ + fprintf(stderr, "decodepng by DanTheMan827\n\n"); + fprintf(stderr, "Build Date: %s \n", BUILD_DATE); + fprintf(stderr, " Commit: %s \n", BUILD_COMMIT); + + if(argc == 1){ + return 1; + } + + std::vector<unsigned char> image; //the raw pixels + unsigned width, height; + + //decode + unsigned error = lodepng::decode(image, width, height, argv[1]); + + std::copy(image.begin(), image.end(), std::ostream_iterator<char>(std::cout)); +} diff --git a/lodepng b/lodepng new file mode 160000 +Subproject c7bb19ad54a53f0d9917da37de7288b1aadf6d0 |