summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--changelog.html82
-rw-r--r--changelog.md81
-rw-r--r--include/benoit/d/ver.hh2
-rw-r--r--src/benoit/arghandl.cc7
-rw-r--r--src/benoit/plotmandelbrot.cc2
-rw-r--r--src/benoit/wrtimg.cc17
7 files changed, 95 insertions, 97 deletions
diff --git a/.gitignore b/.gitignore
index 3d32b92..bd6d5c7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,5 @@
*.o
*.png
-*.ppm
*.webp
*.xml
/benoit
diff --git a/changelog.html b/changelog.html
deleted file mode 100644
index 51d3b6c..0000000
--- a/changelog.html
+++ /dev/null
@@ -1,82 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- </head>
- <body>
- <h1>8</h1>
- <ul>
- <li>Fix #2.</li>
- </ul>
- <h1>7</h1>
- <ul>
- <li>Fix #1.</li>
- <li>Fix some language mistakes.</li>
- <li>Add a <i>Copyright & License</i> page in <i>README.md</i>.</li>
- <li>Create logo.</li>
- <li>Update <i>README.md</i>.</li>
- </ul>
- <h1>6</h1>
- <ul>
- <li>Actually switch compiler from Clang++ to G++.</li>
- <li>Add more command-line arguments.</li>
- <li>Move all data variables into seperate files.</li>
- <li>Update <i>README.md</i>.</li>
- <li>Remove PPM as a supported format.</li>
- <li>Change maximum resolution to 65536.</li>
- <li>Change maximum number of threads to 65536.</li>
- <li>Fix WebP encoding.</li>
- <li>Create temporary renderer that renders a <i>test</i> image using multiple threads.</li>
- </ul>
- <h1>5</h1>
- <ul>
- <li>Automatically detect number of threads.</li>
- <li>Improve debugging.</li>
- <li>Enable POSIX C.</li>
- <li>Create foundation for loading and creating XML configurations.</li>
- <li>Improve help screen.</li>
- <li>Fix the static_assert in <i>include/benoit.hh</i> comparing to bits instead of bytes.</li>
- <li>Switch compiler from Clang++ to G++ as it has better C++20 support.</li>
- <li>Rework code structure.</li>
- <li>Resize maximum resolution from <i>65535</i> to <i>4294967295</i>.</li>
- <li>Make renderer able to create and use threads.</li>
- <li>Create <i>purge</i> target in Makefile.</li>
- </ul>
- <h1>4</h1>
- <ul>
- <li>Remove build artifacts.</li>
- <li>Update .gitignore to ignore more build artifacts.</li>
- </ul>
- <h1>3</h1>
- <ul>
- <li>Remove unused variables from Makefile.</li>
- <li>Require the LLP64 data model when compiling.</li>
- <li>Create working multithrded example.</li>
- <li>Depend also on libpng.</li>
- <li>Remove JPEG as a supported image format.</li>
- </ul>
- <h1>2</h1>
- <ul>
- <li>Cleanup code.</li>
- <li>Create argument handler.</li>
- <li>Create better support for different image formats.</li>
- <li>Remove C-string functions in favour of the ones in &ltcstring&gt.</li>
- <li>Greatly improve debugging.</li>
- <li>Create foundation for new multithrded multiprecision renderer.</li>
- <li>Remove old renderer.</li>
- <li>Completely remove Rust artifacts.</li>
- </ul>
- <h1>1</h1>
- <ul>
- <li>Add changelog.</li>
- <li>Add README.</li>
- <li>Move codebase to C++.</li>
- <li>Copy renderer from MandelbrotSDL.</li>
- <li>Change default filetype to PPM.</li>
- </ul>
- <h1>0</h1>
- <ul>
- <li>First.</li>
- </ul>
- </body>
-</html>
diff --git a/changelog.md b/changelog.md
new file mode 100644
index 0000000..da27b30
--- /dev/null
+++ b/changelog.md
@@ -0,0 +1,81 @@
+# 9
+
+* Remove *\*.ppm* from *.gitignore*.
+* Reformat changelog from HTML to Markdown.
+* Add an alpha channel to the image data.
+* Use *std::from_chars* instead of *std::stoi* for in argument handler.
+* Inline the *benoit::wrtimg::iterwrt* lambda expression.
+
+# 8
+
+* Fix #2.
+
+# 7
+
+* Fix #1.
+* Fix some language mistakes.
+* Add a *Copyright & License* page in *README.md*.
+* Create logo.
+* Update *README.md*.
+
+# 6
+
+* Actually switch compiler from Clang++ to G++.
+* Add more command-line arguments.
+* Move all data variables into seperate files.
+* Update *README.md*.
+* Remove PPM as a supported format.
+* Change maximum resolution to 65536.
+* Change maximum number of threads to 65536.
+* Fix WebP encoding.
+* Create temporary renderer that renders a *test* image using multiple threads.
+
+# 5
+
+* Automatically detect number of threads.
+* Improve debugging.
+* Enable POSIX C.
+* Create foundation for loading and creating XML configurations.
+* Improve help screen.
+* Fix the static_assert in *include/benoit.hh* comparing to bits instead of bytes.
+* Switch compiler from Clang++ to G++ as it has better C++20 support.
+* Rework code structure.
+* Resize maximum resolution from *65535* to *4294967295*.
+* Make renderer able to create and use threads.
+* Create *purge* target in Makefile.
+
+# 4
+
+* Remove build artifacts.
+* Update .gitignore to ignore more build artifacts.
+
+# 3
+
+* Remove unused variables from Makefile.
+* Require the LLP64 data model when compiling.
+* Create working multithrded example.
+* Depend also on libpng.
+* Remove JPEG as a supported image format.
+
+# 2
+
+* Cleanup code.
+* Create argument handler.
+* Create better support for different image formats.
+* Remove C-string functions in favour of the ones in &ltcstring&gt.
+* Greatly improve debugging.
+* Create foundation for new multithrded multiprecision renderer.
+* Remove old renderer.
+* Completely remove Rust artifacts.
+
+# 1
+
+* Add changelog.
+* Add README.
+* Move codebase to C++.
+* Copy renderer from MandelbrotSDL.
+* Change default filetype to PPM.
+
+# 0
+
+* First.
diff --git a/include/benoit/d/ver.hh b/include/benoit/d/ver.hh
index 9eb8730..ae4b026 100644
--- a/include/benoit/d/ver.hh
+++ b/include/benoit/d/ver.hh
@@ -1,6 +1,6 @@
# pragma once
namespace benoit {
namespace d {
- unsigned long long constexpr ver = 0x8;
+ unsigned long long constexpr ver = 0x9;
}
}
diff --git a/src/benoit/arghandl.cc b/src/benoit/arghandl.cc
index 5cae6ad..0b0b4cc 100644
--- a/src/benoit/arghandl.cc
+++ b/src/benoit/arghandl.cc
@@ -14,6 +14,7 @@
# include <benoit/logfuncret.hh>
# include <benoit/print.hh>
# include <benoit/t/imgfmt.hh>
+# include <charconv>
# include <fmt/core.h>
# include <string>
# include <unordered_map>
@@ -63,7 +64,7 @@ void benoit::arghandl(int const & argc,char const * * & argv) {
}
}
else if(obj == "height"s) {
- benoit::d::resy = std::stoi(val);
+ std::from_chars(val.c_str(),(val.c_str() + val.size()),benoit::d::resy);
if(benoit::d::resy > 0x10000) {
benoit::print(fmt::format("Argument “{}” sets the height to {}, but the maximum width is 65536.",arg,benoit::d::resy),true);
benoit::d::resy = 0x10000;
@@ -73,14 +74,14 @@ void benoit::arghandl(int const & argc,char const * * & argv) {
benoit::d::outimg = val;
}
else if(obj == "threads"s) {
- benoit::d::numthrds = std::stoi(val);
+ std::from_chars(val.c_str(),(val.c_str() + val.size()),benoit::d::numthrds);
if(benoit::d::numthrds > 0x10000) {
benoit::print(fmt::format("Argument “{}” sets the number of threads to {}, but the maximum number of threads is 65536."s,arg,benoit::d::numthrds),true);
benoit::d::numthrds = 0x10000;
}
}
else if(obj == "width"s) {
- benoit::d::resx = std::stoi(val);
+ std::from_chars(val.c_str(),(val.c_str() + val.size()),benoit::d::resx);
if(benoit::d::resx > 0x10000) {
benoit::print(fmt::format("Argument “{}” sets the width to {}, but the maximum width is 65536."s,arg,benoit::d::resx),true);
benoit::d::resx = 0x10000;
diff --git a/src/benoit/plotmandelbrot.cc b/src/benoit/plotmandelbrot.cc
index eb02ee9..bbc5f8a 100644
--- a/src/benoit/plotmandelbrot.cc
+++ b/src/benoit/plotmandelbrot.cc
@@ -24,6 +24,7 @@ namespace {
thrddat->img[px].r = *thrddat->thrdcol;
thrddat->img[px].g = *thrddat->thrdcol;
thrddat->img[px].b = *thrddat->thrdcol;
+ thrddat->img[px].a = 0xBF;
}
pthread_exit(nullptr);
}
@@ -68,6 +69,7 @@ std::vector<std::uint8_t> * benoit::plotmandelbrot() {
img->push_back(rgbaimg[pos].r);
img->push_back(rgbaimg[pos].g);
img->push_back(rgbaimg[pos].b);
+ img->push_back(rgbaimg[pos].a);
}
::delete rgbaimg;
benoit::logfuncret(funcname);
diff --git a/src/benoit/wrtimg.cc b/src/benoit/wrtimg.cc
index f0c12d0..0f10257 100644
--- a/src/benoit/wrtimg.cc
+++ b/src/benoit/wrtimg.cc
@@ -28,20 +28,17 @@ void benoit::wrtimg(std::vector<std::uint8_t> * img) {
case benoit::t::imgfmt::png:
break;
case benoit::t::imgfmt::webp:
- datsiz = WebPEncodeLosslessRGB(img->data(),benoit::d::resx,benoit::d::resy,(benoit::d::resx * 0x3),&dat);
+ datsiz = WebPEncodeLosslessRGBA(img->data(),benoit::d::resx,benoit::d::resy,(benoit::d::resx * 0x4),&dat);
break;
}
int file = ::open(benoit::d::outimg.c_str(),(O_CREAT | O_TRUNC | O_WRONLY),0x1B4);
- auto iterwrt = [](int & file,std::uint8_t * & dat,unsigned long long & datsiz) {
- for(unsigned long long pos = 0x0;(pos < datsiz);++pos) {
- ::ssize_t byteswrtn = ::write(file,&dat[pos],0x1);
- if(byteswrtn < 0x0) {
- benoit::print(fmt::format("Unable to write to “{}”."s,benoit::d::outimg));
- return;
- }
+ for(unsigned long long pos = 0x0;(pos < datsiz);++pos) {
+ ::ssize_t byteswrtn = ::write(file,&dat[pos],0x1);
+ if(byteswrtn < 0x0) {
+ benoit::print(fmt::format("Unable to write to “{}”."s,benoit::d::outimg));
+ return;
}
- };
- iterwrt(file,dat,datsiz);
+ }
delete dat;
delete img;
if(::close(file) < 0x0) {