Skip to content

foresight_backend_block ​

foresight_backend_block, text output device drawing with Unicode block or Braille characters (gnuplot block).

The page is the character grid of foresight_backend_dumb, its layout and text unchanged; the graphics (frame, ticks, grid, series, key samples) are drawn on a bitmap of sx x sy dots per cell, each cell written as the character of its dots: half (1x2, half blocks), quadrants (2x2, the default as in gnuplot), sextants (2x3, Unicode 13) or braille (2x4). Text is written over the graphics. Unlike gnuplot, a cell without dots is a blank, Braille included, so rows trim and copy as text; a point is its dot and the four neighbours. A cell takes the color of the last series drawn in it.

Source: src/lib/foresight_backend_block.F90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
BLOCK_CHARSETScharacter(len=*)parameterCharacter sets (gnuplot names).

Derived Types ​

backend_block ​

Block character text device.

Inheritance

Extends: backend_dumb

Components ​

NameTypeAttributesDescription
themetype(theme_object)Output theme: colors the layout's ones are mapped to (foresight_theme).
clear_screenlogicalClear the terminal before writing to standard output.
filecharacter(len=:)allocatableOutput file, - for standard output.
gridcharacter(len=1)allocatableCells, (column, row).
symbolstype(color_symbol)allocatableSymbols in use.
tintinteger(kind=I4P)allocatableCell color, index in symbols, 0 for the default.
colorscharacter(len=7)Color mode: mono, ansi, ansi256, ansirgb.
cwreal(kind=R8P)Cell width [px].
chreal(kind=R8P)Cell height [px].
font_sizereal(kind=R8P)Font size [px].
areareal(kind=R8P)Plot area: left, top, width, height [px].
hiddenlogicalInside a hidden group: nothing is drawn.
charsetcharacter(len=9)Character set.
sxinteger(kind=I4P)Dots per cell, horizontally.
syinteger(kind=I4P)Dots per cell, vertically.
dots_onlogicalallocatableBitmap, (dot column, dot row).
clipinteger(kind=I4P)Dots of the open plot area: first, last column, first, last row;

Type-Bound Procedures ​

NameAttributesDescription
end_pagepass(self)
begin_axespass(self)
end_axespass(self)
begin_grouppass(self)
end_grouppass(self)
dotspass(self)
polygonpass(self)
imagepass(self)
textpass(self)
data_polylinepass(self)
data_dotspass(self)
data_barspass(self)
data_polygonpass(self)
data_imagepass(self)
text_widthpass(self)
readoutpass(self)
readout_extentpass(self)
data_arrowspass(self)
data_labelpass(self)
colpass(self)Column of an abscissa [px].
color_indexpass(self)Index of a color in symbols.
rowpass(self)Row of an ordinate [px].
putpass(self)Set a cell.
begin_pagepass(self)
begin_plot_areapass(self)
end_plot_areapass(self)
cellpass(self)
clearpass(self)
polylinepass(self)
px_fillpass(self)
px_pointpass(self)
px_segmentpass(self)
rectpass(self)
dotpass(self)Set a dot.
dot_linepass(self)Rasterise a dot segment.

Subroutines ​

begin_page ​

Start a blank page and its bitmap.

fortran
subroutine begin_page(self, file, width, height, font_size)

Arguments

NameTypeIntentAttributesDescription
selfclass(backend_block)inoutDevice.
filecharacter(len=*)inOutput file, - for standard output.
widthreal(kind=R8P)inPage width [px].
heightreal(kind=R8P)inPage height [px].
font_sizereal(kind=R8P)inFont size [px].

Call graph

begin_plot_area ​

Remember the plot area and its dots, where point markers are clipped.

fortran
subroutine begin_plot_area(self, x, y, width, height)

Arguments

NameTypeIntentAttributesDescription
selfclass(backend_block)inoutDevice.
xreal(kind=R8P)inLeft side [px].
yreal(kind=R8P)inTop side [px].
widthreal(kind=R8P)inWidth [px].
heightreal(kind=R8P)inHeight [px].

Call graph

end_plot_area ​

Leave the plot area: markers are no longer clipped (key samples).

fortran
subroutine end_plot_area(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(backend_block)inoutDevice.

Call graph

clear ​

Blank the cells and the dots of the box of top-left corner (x, y) and size width x height [px].

fortran
subroutine clear(self, x, y, width, height)

Arguments

NameTypeIntentAttributesDescription
selfclass(backend_block)inoutDevice.
xreal(kind=R8P)inLeft side [px].
yreal(kind=R8P)inTop side [px].
widthreal(kind=R8P)inWidth [px].
heightreal(kind=R8P)inHeight [px].

Call graph

polyline ​

Frame lines (ticks) and key samples drawn on the bitmap, grid lines dotted (every other dot).

fortran
subroutine polyline(self, x, y, color, line_width, dasharray)

Arguments

NameTypeIntentAttributesDescription
selfclass(backend_block)inoutDevice.
xreal(kind=R8P)inAbscissae [px].
yreal(kind=R8P)inOrdinates [px].
colorcharacter(len=*)inStroke color.
line_widthreal(kind=R8P)inStroke width [px].
dasharraycharacter(len=*)inSVG dash array.

Call graph

px_fill ​

Fill the dots whose centre lies inside the polygon (x, y) [px], coloring their cells (even-odd rule).

fortran
subroutine px_fill(self, x, y, color)

Arguments

NameTypeIntentAttributesDescription
selfclass(backend_block)inoutDevice.
xreal(kind=R8P)inVertex abscissae [px].
yreal(kind=R8P)inVertex ordinates [px].
colorcharacter(len=*)inFill color.

Call graph

px_point ​

A data point at p [px]: its dot and the four neighbours, inside the plot area when in one.

fortran
subroutine px_point(self, p, color)

Arguments

NameTypeIntentAttributesDescription
selfclass(backend_block)inoutDevice.
preal(kind=R8P)inPoint [px].
colorcharacter(len=*)inColor.

Call graph

px_segment ​

A data segment from a to b [px] on the bitmap; symbol (the error bar character in text) is not used, but for the grid one .: a dotted line.

fortran
subroutine px_segment(self, a, b, color, symbol)

Arguments

NameTypeIntentAttributesDescription
selfclass(backend_block)inoutDevice.
areal(kind=R8P)inStart [px].
breal(kind=R8P)inEnd [px].
colorcharacter(len=*)inColor.
symbolcharacter(len=*)in

Call graph

rect ​

Stroked rectangles drawn on the bitmap; a fill blanks the cells and dots covered.

fortran
subroutine rect(self, x, y, width, height, stroke, fill, line_width)

Arguments

NameTypeIntentAttributesDescription
selfclass(backend_block)inoutDevice.
xreal(kind=R8P)inLeft side [px].
yreal(kind=R8P)inTop side [px].
widthreal(kind=R8P)inWidth [px].
heightreal(kind=R8P)inHeight [px].
strokecharacter(len=*)inStroke color.
fillcharacter(len=*)inFill color.
line_widthreal(kind=R8P)inStroke width [px].

Call graph

dot ​

Set dot (i, j) and color its cell with tint (unless 0, or the cell holds text), ignoring dots off the page.

Attributes: pure

fortran
subroutine dot(self, i, j, tint)

Arguments

NameTypeIntentAttributesDescription
selfclass(backend_block)inoutDevice.
iinteger(kind=I4P)inDot column.
jinteger(kind=I4P)inDot row.
tintinteger(kind=I4P)inColor index, 0 to keep the cell color.

Call graph

dot_line ​

Bresenham segment of dots from a to b [px], every other dot if dotted.

Attributes: pure

fortran
subroutine dot_line(self, a, b, tint, dotted)

Arguments

NameTypeIntentAttributesDescription
selfclass(backend_block)inoutDevice.
areal(kind=R8P)inStart [px].
breal(kind=R8P)inEnd [px].
tintinteger(kind=I4P)inColor index, 0 for the default.
dottedlogicalinEvery other dot only.

Call graph

Functions ​

cell ​

Text of the cell (c, r): its text character, else the character of its dots, a blank if none.

Attributes: pure

Returns: character(len=:)

fortran
function cell(self, c, r) result(text)

Arguments

NameTypeIntentAttributesDescription
selfclass(backend_block)inDevice.
cinteger(kind=I4P)inColumn.
rinteger(kind=I4P)inRow.

Call graph

dot_index ​

Dot containing the coordinate p [px] with cells cell_size px wide of per_cell dots, clamped to 1..last.

Attributes: elemental

Returns: integer(kind=I4P)

fortran
function dot_index(p, cell_size, per_cell, last) result(d)

Arguments

NameTypeIntentAttributesDescription
preal(kind=R8P)inCoordinate [px].
cell_sizereal(kind=R8P)inCell size [px].
per_cellinteger(kind=I4P)inDots per cell.
lastinteger(kind=I4P)inLast dot.

Call graph

code_point ​

Unicode code point of the cell character of charset with the dots bits, non-zero: bit i + sx * j for the dot of column i and row j (from 0, left to right, top to bottom).

Attributes: pure

Returns: integer(kind=I4P)

fortran
function code_point(charset, bits) result(code)

Arguments

NameTypeIntentAttributesDescription
charsetcharacter(len=*)inCharacter set.
bitsinteger(kind=I4P)inDots.

Call graph

utf8 ​

UTF-8 encoding of the code point code (at most U+10FFFF).

Attributes: pure

Returns: character(len=:)

fortran
function utf8(code) result(text)

Arguments

NameTypeIntentAttributesDescription
codeinteger(kind=I4P)inCode point.

Call graph