Skip to content

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=:)

fortran
function png_base64(rgba) result(code)

Arguments

NameTypeIntentAttributesDescription
rgbainteger(kind=I4P)inPixels.

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)

fortran
function stored(data) result(stream)

Arguments

NameTypeIntentAttributesDescription
datainteger(kind=I1P)inData.

Call graph

chunk ​

PNG chunk: length, type, data, CRC-32 of type and data.

Attributes: pure

Returns: integer(kind=I1P)

fortran
function chunk(kind, data) result(bytes)

Arguments

NameTypeIntentAttributesDescription
kindcharacter(len=4)inChunk type.
datainteger(kind=I1P)inChunk data.

Call graph

crc32 ​

CRC-32 (ISO 3309, as PNG) of data, as a signed 32-bit integer.

Attributes: pure

Returns: integer(kind=I4P)

fortran
function crc32(data) result(crc)

Arguments

NameTypeIntentAttributesDescription
datainteger(kind=I1P)inData.

Call graph

adler32 ​

Adler-32 of data, as a signed 32-bit integer.

Attributes: pure

Returns: integer(kind=I4P)

fortran
function adler32(data) result(sum)

Arguments

NameTypeIntentAttributesDescription
datainteger(kind=I1P)inData.

Call graph

be32 ​

Big-endian bytes of the 32-bit integer v (two's complement).

Attributes: pure

Returns: integer(kind=I1P)

fortran
function be32(v) result(bytes)

Arguments

NameTypeIntentAttributesDescription
vinteger(kind=I4P)inValue.

Call graph

byte ​

Byte of the unsigned value v (0..255), stored two's complement.

Attributes: elemental

Returns: integer(kind=I1P)

fortran
function byte(v) result(b)

Arguments

NameTypeIntentAttributesDescription
vinteger(kind=I4P)inValue.

Call graph