fortplot_test_raster_probe Module

Pixel probes for rendering tests.

Images are packed RGB bytes, row-major from the top-left corner, the layout of fortplot's raster buffer and of a binary PPM (P6) body. PDF output is rasterised by poppler's pdftoppm, an implementation that shares no code with fortplot, so PDF probes are independent oracles.


Functions

public function have_command(name) result(found)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: name

Return Value logical


Subroutines

public subroutine color_bbox(img, w, h, rgb, tol, x0, x1, y0, y1, count, region)

Bounding box (0-based columns x0..x1, rows y0..y1) and pixel count of pixels within tol of rgb in every channel. count = 0 when none. region = [col_lo, col_hi, row_lo, row_hi] limits the search.

Arguments

Type IntentOptional Attributes Name
integer(kind=1), intent(in) :: img(:)
integer, intent(in) :: w
integer, intent(in) :: h
integer, intent(in) :: rgb(3)
integer, intent(in) :: tol
integer, intent(out) :: x0
integer, intent(out) :: x1
integer, intent(out) :: y0
integer, intent(out) :: y1
integer, intent(out) :: count
integer, intent(in), optional :: region(4)

public subroutine read_ppm(path, img, w, h, ok)

Read a binary PPM (P6, maxval 255) as written by pdftoppm.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: path
integer(kind=1), intent(out), allocatable :: img(:)
integer, intent(out) :: w
integer, intent(out) :: h
logical, intent(out) :: ok

public subroutine rasterize_pdf(pdf, dpi, img, w, h, ok)

Rasterise page 1 of pdf with pdftoppm at dpi (no anti-aliasing).

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: pdf
integer, intent(in) :: dpi
integer(kind=1), intent(out), allocatable :: img(:)
integer, intent(out) :: w
integer, intent(out) :: h
logical, intent(out) :: ok