aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Murphy <alec@checksum.fail>2017-07-08 12:10:14 -0400
committerAlec Murphy <alec@checksum.fail>2017-07-08 12:10:14 -0400
commit26915252b0ba04446377d9235abb775891e7d943 (patch)
treee3562811e9280b2db1aaf6f4570f4f5d4a11ed45
parent9eabaeab79df776c35b8833e3bb64719c1136052 (diff)
Add Endian.HC functions from minexew's SnailNet library
-rw-r--r--Endian.HC15
-rw-r--r--FilePNG.HC2
-rw-r--r--README.md7
3 files changed, 23 insertions, 1 deletions
diff --git a/Endian.HC b/Endian.HC
new file mode 100644
index 0000000..a64b70f
--- /dev/null
+++ b/Endian.HC
@@ -0,0 +1,15 @@
+U16 htons(U16 h) {
+ return ((h >> 8) | (h << 8)) & 0xffff;
+}
+
+U16 ntohs(U16 h) {
+ return ((h >> 8) | (h << 8)) & 0xffff;
+}
+
+U32 htonl(U32 h) {
+ return ((h >> 24) | ((h & 0x00ff0000) >> 8) | ((h & 0x0000ff00) << 8) | (h << 24)) & 0xffffffff;
+}
+
+U32 ntohl(U32 h) {
+ return ((h >> 24) | ((h & 0x00ff0000) >> 8) | ((h & 0x0000ff00) << 8) | (h << 24)) & 0xffffffff;
+}
diff --git a/FilePNG.HC b/FilePNG.HC
index b8ca3ed..6a34e72 100644
--- a/FilePNG.HC
+++ b/FilePNG.HC
@@ -234,7 +234,7 @@ public I64 PNGWrite(U8 *filename,CDC *dc,I64 bits=4)
FileWrite(filename,png,size);
Free(png);
return size;
-}
+}
#help_index "Graphics/PNG Files;Graphics/Scrn"
public I64 PNGScrnCapture(U8 *filename,I64 bits=4,Bool include_zoom=TRUE)
diff --git a/README.md b/README.md
index 9757828..636b9e4 100644
--- a/README.md
+++ b/README.md
@@ -2,3 +2,10 @@
PNG support for TempleOS
![FilePNG](https://raw.githubusercontent.com/tramplersheikhs/filepng/master/example.png "FilePNG")
+
+`#include "Endian"` (if needed)
+
+`#include "FilePNG"`
+
+
+`PNGScrnCapture;` and `PNGWrite("filename.png");` functions are present.