foresight_png
foresight_png, PNG images as base64 data, for raster plots (gnuplot
with image) in SVG.
8-bit RGBA, no interlace, every row unfiltered and the zlib stream made of stored (uncompressed) deflate blocks: no compression to write, a file a few bytes per pixel, the same bytes for the same image (golden tests). CRC-32 and Adler-32 as the PNG and zlib specifications; base64 by BeFoR64.
Source: src/lib/foresight_png.F90
Contents
Functions
png_base64
Base64 of the PNG of the image rgba(channel, column, row): red, green, blue, alpha (0..255) of each pixel, columns left to right, rows top to bottom.
Returns: character(len=:)
function png_base64(rgba) result(code)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
rgba | integer(kind=I4P) | in | Pixels. |
Call graph
stored
zlib stream of data in stored deflate blocks of at most 65535 bytes, with its Adler-32.
Attributes: pure
Returns: integer(kind=I1P)
function stored(data) result(stream)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
data | integer(kind=I1P) | in | Data. |
Call graph
chunk
PNG chunk: length, type, data, CRC-32 of type and data.
Attributes: pure
Returns: integer(kind=I1P)
function chunk(kind, data) result(bytes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
kind | character(len=4) | in | Chunk type. | |
data | integer(kind=I1P) | in | Chunk data. |
Call graph
crc32
CRC-32 (ISO 3309, as PNG) of data, as a signed 32-bit integer.
Attributes: pure
Returns: integer(kind=I4P)
function crc32(data) result(crc)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
data | integer(kind=I1P) | in | Data. |
Call graph
adler32
Adler-32 of data, as a signed 32-bit integer.
Attributes: pure
Returns: integer(kind=I4P)
function adler32(data) result(sum)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
data | integer(kind=I1P) | in | Data. |
Call graph
be32
Big-endian bytes of the 32-bit integer v (two's complement).
Attributes: pure
Returns: integer(kind=I1P)
function be32(v) result(bytes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
v | integer(kind=I4P) | in | Value. |
Call graph
byte
Byte of the unsigned value v (0..255), stored two's complement.
Attributes: elemental
Returns: integer(kind=I1P)
function byte(v) result(b)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
v | integer(kind=I4P) | in | Value. |
Call graph