General Terminal

GtDispImage

Display an image in the terminal window

Syntax

Signature
xBool GtDispImage( const char *file, int left, int top, int right, int bottom );

Arguments

file is the path to the image. Pass an empty string to restore text display.

left, top give the horizontal and vertical pixel coordinates. Pass NIL for both to use the whole screen.

right, bottom give the opposite corner in pixels. Pass NIL for both to use the image dimensions when a starting position is provided.

Return value

T if the driver reports that the operation succeeded, otherwise F.

Description

Image formats and rendering support depend on the active driver. Pass the image path as the program’s first argument.

Example

gtdispimage.c
#include "xdev-wtui.h"

#include <stdio.h>

int main( int argc, char **argv )
{
   if( argc != 2 )
   {
      fprintf( stderr, "Usage: %s image-file\n", argv[ 0 ] );
      return 1;
   }

   if( !GtDispImage( argv[ 1 ], NIL, NIL, NIL, NIL ) )
   {
      fputs( "Unable to display the image.\n", stderr );
      return 1;
   }
   Inkey( 0, NIL );
   GtDispImage( "", NIL, NIL, NIL, NIL );

   return 0;
}

See also