- Main Page
- Files
- Related Pages

- File List
- Globals

# simplewidget.h File Reference

## Detailed Description

Version:
  00.10

Put the file comments here.

     * ============================================================================
     * Copyright (c) Texas Instruments Inc 2005
     *
     * Use of this software is controlled by the terms and conditions found in the
     * license agreement under which this software has been supplied or provided.
     * ============================================================================
     *

Go to the source code of this file.

## Defines
#define | BYTES_PER_PIXEL 2
| Only 16 bit color supported.
#define | SIMPLEWIDGET_SUCCESS 0
| Success return code.
#define | SIMPLEWIDGET_FAILURE -1
| Failure return code.
## Typedefs
typedef void * | simplewidget_button
| Opaque handle to a button.
typedef void * | simplewidget_screen
| Opaque handle to a screen.
typedef void * | simplewidget_text
| Opaque handle to a line of text.
typedef void * | simplewidget_jpeg
| Opaque handle to a jpeg image.
typedef void * | simplewidget_png
| Opaque handle to a png image.
## Functions
int | simplewidget_screen_init (void *fbp, int fbw, int fbh, simplewidget_screen *swsp)
| Initializes a simplewidget screen. Must be called before any other simplewidget API call on this screen.
int | simplewidget_screen_clear (simplewidget_screen sws, int x, int y, int w, int h)
| Clear an area of the screen.
int | simplewidget_screen_draw_rectangle (simplewidget_screen sws, int x, int y, int w, int h, int r, int g, int b)
| Draw a rectangle on the screen.
int | simplewidget_screen_exit (simplewidget_screen sws)
| Deinitalize the simplewidget screen and free up associated resources.
int | simplewidget_button_create (int x, int y, int w, int h, int r, int g, int b, int font_height, int border, char *txt, simplewidget_button *swbp)
| Creates a button, but does not show it on screen.
int | simplewidget_button_show (simplewidget_button swb, simplewidget_screen sws)
| Show the button on the screen.
int | simplewidget_button_hide (simplewidget_button swb, simplewidget_screen sws)
| Hide a button (un-show it).
int | simplewidget_button_press (simplewidget_button swb, simplewidget_screen sws)
| Press the button.
int | simplewidget_button_release (simplewidget_button swb, simplewidget_screen sws)
| Release the button from being pressed.
int | simplewidget_button_delete (simplewidget_button swb)
| Delete the button and resources associated with it.
int | simplewidget_text_create (int x, int y, int height, char *txt, simplewidget_text *swtp)
| Creates a line of text.
int | simplewidget_text_show (simplewidget_text swt, simplewidget_screen sws)
| Show the line of text on the screen.
int | simplewidget_text_delete (simplewidget_text swt)
| Delete the line of text and resources associated with it.
int | simplewidget_jpeg_create (char *filename, simplewidget_jpeg *swjp)
| Creates a jpeg image in memory from a file.
int | simplewidget_jpeg_show (simplewidget_jpeg swj, simplewidget_screen sws, int x, int y)
| Shows a previously created jpeg image on screen.
int | simplewidget_jpeg_delete (simplewidget_jpeg swj)
| Free up resources associated with a previously created jpeg image.
int | simplewidget_png_create (char *filename, simplewidget_png *swpp)
| Creates a jpeg image in memory from a file.
int | simplewidget_png_show (simplewidget_png swp, simplewidget_screen sws, int x, int y)
| Shows a previously created png image on screen.
int | simplewidget_png_delete (simplewidget_png swp)
| Free up resources associated with a previously created png image.

## Define Documentation

#define BYTES_PER_PIXEL 2

| Only 16 bit color supported.

#define SIMPLEWIDGET_SUCCESS 0

| Success return code.

#define SIMPLEWIDGET_FAILURE -1

| Failure return code.

## Typedef Documentation

typedef void* simplewidget_button

| Opaque handle to a button.

typedef void* simplewidget_screen

| Opaque handle to a screen.

typedef void* simplewidget_text

| Opaque handle to a line of text.

typedef void* simplewidget_jpeg

| Opaque handle to a jpeg image.

typedef void* simplewidget_png

| Opaque handle to a png image.

## Function Documentation

int simplewidget_screen_init | ( | void * | fbp,
|  | int | fbw,
|  | int | fbh,
|  | simplewidget_screen * | swsp
| ) |

  | Initializes a simplewidget screen. Must be called before any other simplewidget API call on this screen. Parameters:
  | fbp | The pointer to the framebuffer.
  | fbw | The width of the framebuffer.
  | fbh | The height of the framebuffer.
  | swsp | Screen pointer returned.
Returns: SIMPLEWIDGET_SUCCESS on success and SIMPLEWIDGET_FAILURE on failure.

int simplewidget_screen_clear | ( | simplewidget_screen | sws,
|  | int | x,
|  | int | y,
|  | int | w,
|  | int | h
| ) |

  | Clear an area of the screen. Parameters:
  | sws | Simplewidget screen to clear on.
  | x | X coordinate of area to clear.
  | y | Y coordinate of area to clear.
  | w | Width of area to clear.
  | h | Height of area to clear.
Returns: SIMPLEWIDGET_SUCCESS on success and SIMPLEWIDGET_FAILURE on failure.

int simplewidget_screen_draw_rectangle | ( | simplewidget_screen | sws,
|  | int | x,
|  | int | y,
|  | int | w,
|  | int | h,
|  | int | r,
|  | int | g,
|  | int | b
| ) |

  | Draw a rectangle on the screen. Parameters:
  | sws | Simplewidget screen to draw rectangle on.
  | x | X coordinate of the rectangle.
  | y | Y coordinate of the rectangle.
  | w | Width of the rectangle.
  | h | Height of the rectangle.
  | r | Red component of rectangle color.
  | g | Green component of rectangle color.
  | b | Blue component of rectangle color.
Returns: SIMPLEWIDGET_SUCCESS on success and SIMPLEWIDGET_FAILURE on failure.

int simplewidget_screen_exit | ( | simplewidget_screen | sws | ) |

  | Deinitalize the simplewidget screen and free up associated resources. Parameters:
  | sws | Simplewidget screen to deinitalize.
Returns: SIMPLEWIDGET_SUCCESS on success and SIMPLEWIDGET_FAILURE on failure.

int simplewidget_button_create | ( | int | x,
|  | int | y,
|  | int | w,
|  | int | h,
|  | int | r,
|  | int | g,
|  | int | b,
|  | int | font_height,
|  | int | border,
|  | char * | txt,
|  | simplewidget_button * | swbp
| ) |

  | Creates a button, but does not show it on screen. Parameters:
  | x | X position of the button on screen.
  | y | Y position of the button on screen.
  | w | Width of button.
  | h | Height of button.
  | r | Red component of button color.
  | g | Green component of button color.
  | b | Blue component of button color.
  | font_height | Height of the button font.
  | border | Size of button border.
  | txt | Text to render inside button.
  | swbp | Simplewidget handle returned.
Returns: SIMPLEWIDGET_SUCCESS on success and SIMPLEWIDGET_FAILURE on failure.

int simplewidget_button_show | ( | simplewidget_button | swb,
|  | simplewidget_screen | sws
| ) |

  | Show the button on the screen. Parameters:
  | swb | Simplewidget handle of the button to show.
  | sws | Simplewidget screen to show button on.
Returns: SIMPLEWIDGET_SUCCESS on success and SIMPLEWIDGET_FAILURE on failure.

int simplewidget_button_hide | ( | simplewidget_button | swb,
|  | simplewidget_screen | sws
| ) |

  | Hide a button (un-show it). Parameters:
  | swb | Simplewidget handle of the button to hide.
  | sws | Simplewidget screen to hide button on.
Returns: SIMPLEWIDGET_SUCCESS on success and SIMPLEWIDGET_FAILURE on failure.

int simplewidget_button_press | ( | simplewidget_button | swb,
|  | simplewidget_screen | sws
| ) |

  | Press the button. Parameters:
  | swb | Simplewidget handle of the button to press.
  | sws | Simplewidget screen to fade in button on.
Returns: SIMPLEWIDGET_SUCCESS on success and SIMPLEWIDGET_FAILURE on failure.

int simplewidget_button_release | ( | simplewidget_button | swb,
|  | simplewidget_screen | sws
| ) |

  | Release the button from being pressed. Parameters:
  | swb | Simplewidget handle of the button to release from being pressed.
  | sws | Simplewidget screen to fade in button on.
Returns: SIMPLEWIDGET_SUCCESS on success and SIMPLEWIDGET_FAILURE on failure.

int simplewidget_button_delete | ( | simplewidget_button | swb | ) |

  | Delete the button and resources associated with it. Parameters:
  | swb | Simplewidget handle of the button to delete.
Returns: SIMPLEWIDGET_SUCCESS on success and SIMPLEWIDGET_FAILURE on failure.

int simplewidget_text_create | ( | int | x,
|  | int | y,
|  | int | height,
|  | char * | txt,
|  | simplewidget_text * | swtp
| ) |

  | Creates a line of text. Parameters:
  | x | Starting X position of the line of text.
  | y | Starting Y position of the line of text.
  | height | Height of font to render text with.
  | txt | Text to render inside button.
  | swtp | Simplewidget handle returned.
Returns: SIMPLEWIDGET_SUCCESS on success and SIMPLEWIDGET_FAILURE on failure.

int simplewidget_text_show | ( | simplewidget_text | swt,
|  | simplewidget_screen | sws
| ) |

  | Show the line of text on the screen. Parameters:
  | swt | Simplewidget handle of the text line to show.
  | sws | Simplewidget screen to show text line on.
Returns: SIMPLEWIDGET_SUCCESS on success and SIMPLEWIDGET_FAILURE on failure.

int simplewidget_text_delete | ( | simplewidget_text | swt | ) |

  | Delete the line of text and resources associated with it. Parameters:
  | swt | Simplewidget handle of the text line to delete.
Returns: SIMPLEWIDGET_SUCCESS on success and SIMPLEWIDGET_FAILURE on failure.

int simplewidget_jpeg_create | ( | char * | filename,
|  | simplewidget_jpeg * | swjp
| ) |

  | Creates a jpeg image in memory from a file. Parameters:
  | filename | The full path and filename of the jpeg file.
  | swjp | Simplewidget handle returned.
Returns: SIMPLEWIDGET_SUCCESS on success and SIMPLEWIDGET_FAILURE on failure.

int simplewidget_jpeg_show | ( | simplewidget_jpeg | swj,
|  | simplewidget_screen | sws,
|  | int | x,
|  | int | y
| ) |

  | Shows a previously created jpeg image on screen. Parameters:
  | swj | Simplewidget handle to the jpeg image previously created.
  | sws | Simplewidget screen to show jpeg image on.
  | x | Starting X position on screen of the jpeg image.
  | y | Starting Y position on screen of the jpeg image.
Returns: SIMPLEWIDGET_SUCCESS on success and SIMPLEWIDGET_FAILURE on failure.

int simplewidget_jpeg_delete | ( | simplewidget_jpeg | swj | ) |

  | Free up resources associated with a previously created jpeg image. Parameters:
  | swj | Simplewidget handle to the jpeg image previously created.
Returns: SIMPLEWIDGET_SUCCESS on success and SIMPLEWIDGET_FAILURE on failure.

int simplewidget_png_create | ( | char * | filename,
|  | simplewidget_png * | swpp
| ) |

  | Creates a jpeg image in memory from a file. Parameters:
  | filename | The full path and filename of the png file.
  | swpp | Simplewidget handle returned.
Returns: SIMPLEWIDGET_SUCCESS on success and SIMPLEWIDGET_FAILURE on failure.

int simplewidget_png_show | ( | simplewidget_png | swp,
|  | simplewidget_screen | sws,
|  | int | x,
|  | int | y
| ) |

  | Shows a previously created png image on screen. Parameters:
  | swp | Simplewidget handle to the png image previously created.
  | sws | Simplewidget screen to show png image on.
  | x | Starting X position on screen of the png image.
  | y | Starting Y position on screen of the png image.
Returns: SIMPLEWIDGET_SUCCESS on success and SIMPLEWIDGET_FAILURE on failure.

int simplewidget_png_delete | ( | simplewidget_png | swp | ) |

  | Free up resources associated with a previously created png image. Parameters:
  | swp | Simplewidget handle to the png image previously created.
Returns: SIMPLEWIDGET_SUCCESS on success and SIMPLEWIDGET_FAILURE on failure.

Copyright 2006, Texas Instruments Incorporated