Set alignment

Description

For characters output:

  There are 3 settings on horizontal for characters on the screen: 1) left alignment (default, value: 0), the characters output on screen start from current (x,y) position to right; 2) center alignment(value: 1) the characters output on the screen centered at the draw window on the horizontal, doesn't matter where is the current x position; 3) right alignment(value: 2) the characters shift to the most right side on the draw window, the current x position not affected either.

For JPEG images output(flash chip pre-installed and firmware version at least V7.0 or higher):

  There are 3 settings on horizontal that similar with above character alignments, but all based on the current x position.

  There are also 3 settings on vertical for JPEG images: 1) top alignment(default, value: 0), the first line of image start from current y position; 2) middle alignment (value: 4), the vertical middle line of image is at the current y position; 3)bottom alignment (value: 8), the bottom line of image is at the current y position.

  eg.: If set the alignment value to 5(4+1), then the JPEG image will centered at current (x,y) position.

Usage:

Direct:

 "ALIGNa"

Arduino:

void setTextAlignment(char a)

C:

void Digole_setTextAlignment(char a)

Parameters:

a

The alignment value, (0, 1, 2) for horizontal alignment, (0,4,8) for vertical alignment.

Return:

none

Example (Arduino):

mydisp.setTextAlignment(5);  //set center alignment for character, center/middle alignment for JPEG images

Example(direct)

serial.writeString("ALIGN\x05"); //set center alignment for character, center/middle alignment for JPEG images

Changelog

Version Description
   

See Also

Draw Window

Set cursor position

Draw character(s)

Display JPEG image(s)