Image & Font Functions

Download the inPulse SDK
/**
 * @return whether an image resource is likely to be valid.
 *
 * Simulator status: Implemented
 */

bool pulse_image_valid(PulseResource f);

/**
 * Retrieves the image dimensions from a pre-stored image
 *
 * Simulator status: Implemented
 *
 * @param image the image to retrieve information about
 * @param width a variable used to return the width of the image
 * @param height a variable used to return the height of the image
 *
 * @return a pulse_dimentions_t type (includes dimensions width and height)
 */

pulse_dimensions_t pulse_get_image_info(PulseResource image);

/**
 * Draws the given image onto the screen at the location specified.
 *
 * @param image                 The PulseResource image to draw to the screen
 * @param x                     The x-value of the location on the screen where the
 *                              top-left corner of the image should be drawn
 * @param y                     The y-value of the location on the screen where the
 *                              top-left corner of the image should be drawn
 *
 * Note: follow the tutorial here <<link>> to pack your own images and fonts into
 *       PulseResource format
 *
 * Simulator status: Implemented
 */

void pulse_draw_image(PulseResource image, uint8_t x, uint8_t y);

/**
 * Draws the given image onto the screen at the location specified.
 *
 * @param image                 The PulseResource image to draw to the screen
 * @param x                     The x-value of the location on the screen where the
 *                              top-left corner of the image should be drawn
 * @param y                     The y-value of the location on the screen where the
 *                              top-left corner of the image should be drawn
 * @param transparent_color     The flagged color which you want to make transparent
 *                              (pixels of this color are not written to the screen,
 *                               so previously drawn pixels "underneath" will still
 *                               be visible)
 *
 * Note: follow the tutorial here <<link>> to pack your own images and fonts into
 *       PulseResource format
 *
 *       The transparency option is useful for drawing overlapping images.
 *       Like the hands of an analog watch face!
 *
 * Simulator status: Implemented
 */

void pulse_draw_image_with_transparency(PulseResource image, uint8_t x, uint8_t y,
        color24_t transparent_color);

/**
 * @return whether a font resource is likely to be valid.
 *
 * Simulator status: Implemented
 */

bool pulse_font_valid(PulseResource f);

/**
 * Initializes a text widget
 *
 * @param widget        Pointer to PWidgetTextDynamic to initialize
 * @param text_buffer   Text buffer to write to the screen
 * @param font          Font to use
 * @param font_color    color of the widget text
 * @param style         Style of text (i.e., truncate, wrap, etc.)
 *                      see code examples for use. Note that style's
 *                      can be OR'd together.
 *                      Example: (PWTS_WRAP_AT_SPACE | PWTS_CENTER)
 *
 * Simulator status: Implemented
 */

void pulse_init_dynamic_text_widget(struct PWidgetTextDynamic *widget,
        const char * text_buffer, PulseResource font, color24_t font_color,
        enum PWTextStyle style);

/**
 * Render an initialized text widget to the screen
 *
 * @param draw_context  Pointer to PWTextBox that specifies the bounds
 *                      of the text box
 * @param text_widget   Poitner to an initialized text widget
 *
 * Simulator status: Implemented
 */

void pulse_render_text(struct PWTextBox* draw_context,
        struct PWidgetTextDynamic* text_widget);