ls027b7dh01_set_rotation ls027b7dh01_save_"display navigation bar

Table of Contents

ls027b7dh01_draw_image

Draws an image on the Sharp LS027B7DH01 LCD display.

Description

The ls027b7dh01_draw_image function draws an image on the Sharp LS027B7DH01 LCD display at the given pixel coordinates (top, left). Note that this function does not clear the display first, so it is possible to draw multiple images at different locations. The image is expected to be a black and white image in column-major order (stored column by column in memory) with each byte representing a single pixel (0 or 255). It also accepts greyscale images, in which case it will use a threshold of pixel <= 127 to differentiate white and black. However, Floyd-Steinberg dithering is recommended for converting greyscale images to black and white before drawing on the LCD display.

Prototype

t_error
ls027b7dh01_draw_image(t_ls027b7dh01 display, t_int pixel_row, t_int pixel_column, t_uint image_width, t_uint image_height, const t_uint8* image);
    

Parameters

t_ls027b7dh01 display

A handle to the display returned by the ls027b7dh01_open function.

t_int pixel_row

The pixel row at which to start drawing the image. The value may be outside the 0 to 239 range.

t_int pixel_column

The pixel column at which to start drawing the image. The value may be outside the 0 to 399 range.

t_uint image_width

The width of the image.

t_uint image_height

The height of the image.

const t_uint8 * image

The bitmap to draw on the display. Each byte represents a black and white pixel interpreted based on whether the value is greater or less than 127. Pixels are stored column by column in memory. Use the ls027b7dh01_set_inversion function to invert the interpretation of black and white.

Return value

The return value is zero if the operation is successful. Otherwise a negative error code is returned. Error codes are defined in quanser_errors.h. A suitable error message may be retrieved using msg_get_error_message.

Error codes

QERR_INVALID_ARGUMENT

One of the arguments is invalid.

Requirements

Include Files

Libraries

quanser_lcd_display.h

quanser_devices.lib;quanser_communications.lib;quanser_runtime.lib;quanser_common.lib

Examples

t_ls027b7dh01 display;
t_error result = 
    ls027b7dh01_open("spi-cpu://localhost:1?word='8',baud='45000000',polarity='on',phase='on',memsize='8192',frame='0'", LCD_ACCESS_EXCLUSIVE, &display);
if (result == 0) {
    ls027b7dh01_draw_image(display, 0, 0, 400, 240, bw_image);
    ...
    ls027b7dh01_close(display);
} else {
    TCHAR message[512];
    msg_get_error_message(NULL, result, message, sizeof(message));
    _tprintf(_T("Failed to open LCD display. %s (error %d)\n"), message, -result);
}
    

See Also

 

navigation bar