VCLib Documentation  6.12.2

Debug Display Environment

Debug Display Environment

Output several labelled images to an image (display screen) for Development Purposes. More...

Data Structures

struct  SDebugDisplay
 Data Keeper and Management for the Debug Display Output Routine. More...
 

Functions

I32 init_debug_display (SDebugDisplay *psDD, char *pcTitle, U32 u32RasterRows, U32 u32RasterCols, U16 *pu16Meld, image *psDisplay, image *psOvlOrNULL)
 First Initialisation of the Debug Display Environment. More...
 
I32 deinit_debug_display (SDebugDisplay *psDD)
 Frees Memory allocated by the Function init_debug_display(). More...
 
void debug_display_draw_environment (SDebugDisplay *psDD)
 Draws Surroundings, Title, etc. More...
 
I32 debug_display_insert (image *psImgIn, char *pcImgAnchor, U8 u8ToOverlayIff1, char *pcText, U8 u8ScaleContentIff1, U8 u8FitWillCropIff1, SDebugDisplay *psDD, U16 u16ImageIdx)
 Insert Image Data and Label Text to the requested Debug Image. More...
 

Detailed Description

The functions in this group allow the display of a large number of images on the screen in an ordered way. The images are resized by request to the desired format. Each image can be assigned a text string which is displayed underneath the image.

debug_display_raster.png

You configure a raster containing rectangular regions of indices, where the images will later be drawn to. This is done by passing numbers starting at '0' and raising up to the count of needed images. For convinience, it is the easiest way to define them in an array and provide it as pointer to the specific information holder.

First Initialisation is made by calling the function init_debug_display(). To free allocated memory, one has to call deinit_debug_display() at the end.

Access to the images is easy:

SDebugDisplay sDD = NULL_DEBUGDISPLAY;
U16 au16[2][5] =
{
{ 0, 0, 1, 1, 2 },
{ 0, 0, 3, 4, 2 }
};
init_debug_display(&sDD, "Title Text", 2, 5, &(au16[0][0]), &dispImgOut, NULL);
// ...
debug_display_insert(&capt,"mc",0,"Image0 Label",1,1,&sDD,0);
debug_display_insert(&capt,"mc",0,"Image1 Label",1,0,&sDD,1);
debug_display_insert(&capt,"mc",0,"Image2 Label",1,0,&sDD,2);
debug_display_insert(&capt,"mc",0,"Image3 Label",1,0,&sDD,3);
debug_display_insert(&capt,"mc",0,"Image4 Label",1,1,&sDD,4);
// ...

Data Structure Documentation

◆ SDebugDisplay

struct SDebugDisplay
Data Fields
U8 u8InactiveIff1

A switch that turns the processing off, useful for deactivating debug displaying.

image sDisp

The whole Output Image.

image sOvl

The whole Output Overlay Image (optional).

char * pcTitle

The Title of the Debug Display.

U32 u32RasterRows

Main Raster Row Count of the Image Gallery.

U32 u32RasterCols

Main Raster Column Count of the Image Gallery.

U16 u16ImageCount

The Maximum valid Image Nr available for Destination Request.

U16 ** ppu16MeldIdx

Each Image Area will be going over the raster cells with the same number therein.

image * psImg

The Images accessable by the MeldIdx as Index.

image * psLabel

The Label Text Area for the Images.

image * psOvlImg

The Images accessable by the MeldIdx as Index.

image * psOvlLabel

The Label Text Area for the Images.

U8 u8TitleSize

Size in 8* is Px Height of Title Chars.

U8 u8TitleHeightPx

Height for the Title.

U8 u8TextHeightPx

Height for the Subtext.

U8 u8PadColsPx

Horizontal Space between Images.

U8 u8PadRowsPx

Vertical Space between Images.

U8 u8ImgColorBg

Color Value for the Image Background.

U8 u8ImgColorText

Color Value for the Label Text.

U8 u8ImgColorTextBg

Color Value for the Label Areas.

U8 u8ImgColorTitle

Color Value for the Title Text.

U8 u8ImgColorTitleBg

Color Value for the Title Area.

U8 u8ImgColorBorder

Color Value for the Border around the Images.

U8 u8OvlColorBg

Color Value for the Overlay Background (mostly 0).

U8 u8OvlColorText

Color Value for the Overlay Label Text.

U8 u8OvlColorTextBg

Color Value for the Overlay Label Areas.

U8 u8OvlColorTitle

Color Value for the Overlay Title Text.

U8 u8OvlColorTitleBg

Color Value for the Overlay Title Area.

U8 u8OvlColorBorder

Color Value for the Overlay Border around the Images.

Function Documentation

◆ init_debug_display()

I32 init_debug_display ( SDebugDisplay psDD,
char *  pcTitle,
U32  u32RasterRows,
U32  u32RasterCols,
U16 pu16Meld,
image psDisplay,
image psOvlOrNULL 
)

This function initializes the debug display environment by allocating memory and setting default values. You provide the row and column count for the image raster and define the cells to be meld together to one big picture by assigning the same number to them. Counting must be starting by 0 and must increment by one without a gap. Cells to be melt together must form a rectangular shape or undefined behaviour occurs. At least the (previously allocated) display output image must be provided. The raster will be equidistant over the image dimensions, so a cell may be of non-square form. Additionally you may provide an overlay image which can also be accessed easily at your program.

SDebugDisplay sDD = NULL_DEBUGDISPLAY;
U16 au16[2][3] =
{
{ 0, 0, 1 },
{ 2, 2, 2 }
};
// ...
result = init_debug_display(&sDD, "Title", 2, 3, &(au16[0][0]), &dispImg, psOvlOrNULL);
//debug_display_draw_environment()
//deinit_debug_display()
debug_display_raster.png
Parameters
psDDInitialisation Candidate.
pcTitleShown at the Top of the Debug Display Image.
u32RasterRows,u32RasterColsRaster Dimensions of the Debug Display.
pu16MeldRaster Points to be Meld to Windows (See Text).
psDisplayThe Output Image.
psOvlOrNULLThe Output Overlay Image, may be set to NULL if unused.
See also
deinit_debug_display().
Return values
ERR_PARAMif Display Image and Overlay Image are not of the same size.
ERR_MEMORYiff Memory Allocation failed.
ERR_PARAMif Disp image too small.
ERR_FORMATif an index number is missing.
ERR_NONEon Success.

◆ deinit_debug_display()

I32 deinit_debug_display ( SDebugDisplay psDD)

The function frees the memory allocated by the function init_debug_display().

Parameters
psDDDeinitialisation Candidate.
See also
init_debug_display().
Return values
ERR_NONEon Success.

◆ debug_display_draw_environment()

void debug_display_draw_environment ( SDebugDisplay psDD)

This function draws surroundings, title, etc. All Information is Cleared! The debug display struct must be initialized beforehand.

Parameters
psDDThe Target Debug Display Environment.

◆ debug_display_insert()

I32 debug_display_insert ( image psImgIn,
char *  pcImgAnchor,
U8  u8ToOverlayIff1,
char *  pcText,
U8  u8ScaleContentIff1,
U8  u8FitWillCropIff1,
SDebugDisplay psDD,
U16  u16ImageIdx 
)

The image data (if not set to NULL, i.e. if only the label text should be updated) will be copied to the debug image specified by the variable u16ImageIdx which is the number used to concatenate the cells at the initialization phase. You may specify the Anchor of the input image, meaning, that the given position docks to the same debug image's position. If you'd want to write to Overlay, use the switch. By selecting scaling, the content will be fitted to either show the whole image or the maximum space of the debug image is used for output (cropping).

Text will be cut off at Text start, if it is too long.

Parameters
psImgInInput Image Data, may be NULL if not needed.
pcImgAnchoris 't'=top 'm'=middle 'b'=bottom followed by 'l'=left 'c'=center 'r'=right.
u8ToOverlayIff1Outputs Input Image Data or Text to Overlay.
pcTextwill be cropped at beginning iff too long, may be NULL.
u8ScaleContentIff1scales Input Image Data to the Debug Image Size.
u8FitWillCropIff1If u8ScaleContentIff1 is 1, the whole Debug Image will be filled with Data iff 1.
psDDThe Target Debug Display Environment.
u16ImageIdxThe Target Image at the Debug Display Environment.
Return values
ERR_NONEif u8InactiveIff1 is 1 and nothing is done.
ERR_PARAMif the Image Index exceeds the maximum Image Number
ERR_PARAMif Overlay not set, but should be filled with content.
ERR_NONEon Success.