浏览代码

Merge pull request #22 from bmx-ng/task/png-zlib-import

Ensure libpng uses the correct zlib header.
Brucey 2 年之前
父节点
当前提交
61a3a3a77f
共有 3 个文件被更改,包括 141 次插入2 次删除
  1. 135 1
      README.md
  2. 2 1
      png.mod/common.bmx
  3. 4 0
      png.mod/png.bmx

+ 135 - 1
README.md

@@ -1,2 +1,136 @@
 # image.mod
 # image.mod
-Image handlers
+
+BlitzMax includes support for loading many different image formats.
+
+Simply import one of the image modules, and you will be able to load images of that format into a `TPixmap`.
+
+## Supported formats
+
+The following image formats are currently supported : 
+
+### BMP
+
+Usage :
+```blitzmax
+Import Image.BMP
+```
+
+See [Wikipedia](https://en.wikipedia.org/wiki/BMP_file_format) for more information about the format.
+
+### GIF
+
+Usage :
+```blitzmax
+Import Image.GIF
+```
+
+Supports both static and animated GIFs.
+
+To load an animated GIF, use the following function, `TGifImage.LoadImage(url:Object)` :
+```blitzmax
+Local image:TImage = TGifImage.LoadImage("image-name.gif")
+```
+This function returns a fully populated Max2D `TImage` object directly (similar to calling `LoadAnimImage`), rather than a `TPixmap`.
+GIF frame delays are stored in the `frameDuration:Int[]` field of `TImage` as a time in milliseconds.
+
+See [Wikipedia](https://en.wikipedia.org/wiki/GIF) for more information about the format.
+
+### IFF/ILBM
+
+Usage :
+```blitzmax
+Import Image.ILBM
+```
+
+See [Wikipedia](https://en.wikipedia.org/wiki/ILBM) for more information about the format.
+
+### JPG
+
+Usage :
+```blitzmax
+Import Image.JPG
+```
+
+See [Wikipedia](https://en.wikipedia.org/wiki/JPEG) for more information about the format.
+
+### PCX
+
+Usage :
+```blitzmax
+Import Image.PCX
+```
+
+See [Wikipedia](https://en.wikipedia.org/wiki/PCX) for more information about the format.
+
+### PIC
+
+Usage :
+```blitzmax
+Import Image.PIC
+```
+
+See [Wikipedia](https://en.wikipedia.org/wiki/PICtor_PIC_image_format) for more information about the format.
+
+### PNG
+
+Usage :
+```blitzmax
+Import Image.PNG
+```
+
+See [Wikipedia](https://en.wikipedia.org/wiki/Portable_Network_Graphics) for more information about the format.
+
+### PNM
+
+Usage :
+```blitzmax
+Import Image.PNM
+```
+
+See [Wikipedia](https://en.wikipedia.org/wiki/Netpbm#File_formats) for more information about the format.
+
+### QOI
+
+Usage :
+```blitzmax
+Import Image.QOI
+```
+
+See https://qoiformat.org/
+
+### RAW
+
+Usage :
+```blitzmax
+Import Image.RAW
+```
+
+See [Wikipedia](https://en.wikipedia.org/wiki/Raw_image_format) for more information about the format.
+
+### SVG
+
+Usage :
+```blitzmax
+Import Image.SVG
+```
+
+See [Wikipedia](https://en.wikipedia.org/wiki/Scalable_Vector_Graphics) for more information about the format.
+
+### TGA
+
+Usage :
+```blitzmax
+Import Image.TGA
+```
+
+See [Wikipedia](https://en.wikipedia.org/wiki/Truevision_TGA) for more information about the format.
+
+### WEBP
+
+Usage :
+```blitzmax
+Import Image.WEBP
+```
+
+See [Wikipedia](https://en.wikipedia.org/wiki/WebP) for more information about the format.
+

+ 2 - 1
png.mod/common.bmx

@@ -22,7 +22,8 @@
 '
 '
 SuperStrict
 SuperStrict
 
 
-Import Pub.ZLib
+Import Archive.ZLib
+Import "../../archive/zlib.mod/zlib/*.h"
 
 
 Import "libpng/png.c"
 Import "libpng/png.c"
 Import "libpng/pngerror.c"
 Import "libpng/pngerror.c"

+ 4 - 0
png.mod/png.bmx

@@ -22,6 +22,10 @@
 '
 '
 SuperStrict
 SuperStrict
 
 
+Rem
+bbdoc: Image/PNG load/save
+about: The PNG loader module provides the ability to load PNG format #pixmaps.
+End Rem
 Module Image.PNG
 Module Image.PNG
 
 
 ModuleInfo "Version: 1.09"
 ModuleInfo "Version: 1.09"