📄 jpgwidget.h
字号:
//*****************************************************************************
//
// jpgwidget.h - Prototypes for the JPEG image display/button widget class.
//
// Copyright (c) 2009 Luminary Micro, Inc. All rights reserved.
// Software License Agreement
//
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
// exclusively on LMI's microcontroller products.
//
// The software is owned by LMI and/or its suppliers, and is protected under
// applicable copyright laws. All rights are reserved. You may not combine
// this software with "viral" open-source software in order to form a larger
// program. Any use in violation of the foregoing restrictions may subject
// the user to criminal sanctions under applicable laws, as well as to civil
// liability for the breach of the terms and conditions of this license.
//
// THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
//
// This is part of revision 5228 of the DK-LM3S9B96 Firmware Package.
//
//*****************************************************************************
#ifndef __JPGWIDGET_H__
#define __JPGWIDGET_H__
//*****************************************************************************
//
//! \addtogroup jpgwidget_api
//! @{
//
//*****************************************************************************
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C"
{
#endif
//*****************************************************************************
//
//! The structure containing workspace fields used by the JPEG widget in
//! decompressing and displaying the JPEG image. This structure must not be
//! modified by the application using the widget.
//
//*****************************************************************************
typedef struct
{
//
//! The width of the decompressed JPEG image in pixels.
//
unsigned short usWidth;
//
//! The height of the decompressed JPEG image in lines.
//
unsigned short usHeight;
//
//! The current X image display offset (pan).
//
short sXOffset;
//
//! The current Y image display offset (scan).
//
short sYOffset;
//
//! The x coordinate of the screen position corresponding to the last
//! scrolling calculation check for a JPEGCanvas type widget.
//
short sXStart;
//
//! The y coordinate of the screen position corresponding to the last
//! scrolling calculation check for a JPEGCanvas type widget.
//
short sYStart;
//
//! A pointer to the SDRAM buffer containing the decompressed JPEG image.
//
unsigned short *pusImage;
}
tJPEGInst;
//*****************************************************************************
//
//! The structure that describes a JPEG widget.
//
//*****************************************************************************
typedef struct
{
//
//! The generic widget information.
//
tWidget sBase;
//
//! The style for this widget. This is a set of flags defined by
//! JW_STYLE_xxx.
//
unsigned long ulStyle;
//
//! The 24-bit RGB color used to fill this JPEG widget, if JW_STYLE_FILL is
//! selected.
//
unsigned long ulFillColor;
//
//! The 24-bit RGB color used to outline this JPEG widget, if
//! JW_STYLE_OUTLINE is selected.
//
unsigned long ulOutlineColor;
//
//! The 24-bit RGB color used to draw text on this JPEG widget, if
//! JW_STYLE_TEXT is selected.
//
unsigned long ulTextColor;
//
//! A pointer to the font used to render the JPEG widget text, if
//! JW_STYLE_TEXT is selected.
//
const tFont *pFont;
//
//! A pointer to the text to draw on this JPEG widget, if JW_STYLE_TEXT is
//! selected.
//
const char *pcText;
//
//! A pointer to the compressed JPEG image to be drawn onto this widget.
//! If NULL, the widget will be filled with the provided background color
//! if painted.
//
const unsigned char *pucImage;
//
//! The number of bytes of compressed data in the image pointed to by
//! pucImage.
//
unsigned long ulImageLen;
//
//! The width of the border to be drawn around the widget. This is ignored
//! if JW_STYLE_OUTLINE is not set.
//
unsigned char ucBorderWidth;
//
//! A pointer to the function to be called when the button is pressed
//! This is ignored if JW_STYLE_BUTTON is not set.
//
void (*pfnOnClick)(tWidget *pWidget);
//
//! A pointer to the function to be called if the user scrolls the
//! displayed image. This is ignored if JW_STYLE_BUTTON is set.
//
void (*pfnOnScroll)(tWidget *pWidget, short sX, short sY);
//
//! The following structure contains all the workspace fields required
//! by the widget. The client must initialize this with a valid pointer
//! to a read/write structure.
//
tJPEGInst *psJPEGInst;
}
tJPEGWidget;
//*****************************************************************************
//
//! This flag indicates that the widget should be outlined.
//
//*****************************************************************************
#define JW_STYLE_OUTLINE 0x00000001
//*****************************************************************************
//
//! This flag indicates that the widget should act as a button rather than as
//! a display surface.
//
//*****************************************************************************
#define JW_STYLE_BUTTON 0x00000002
//*****************************************************************************
//
//! This flag indicates that the JPEG widget should have text drawn on it.
//
//*****************************************************************************
#define JW_STYLE_TEXT 0x00000004
//*****************************************************************************
//
//! This flag indicates that the JPEG widget's background area should be filled
//! with color even when there is an image to display.
//
//*****************************************************************************
#define JW_STYLE_FILL 0x00000008
//*****************************************************************************
//
//! This flag indicates that the JPEG widget's image should be repainted as
//! the user scrolls over it. This is CPU intensive but looks better than
//! the alternative which only repaints the image when the user ends their
//! touchscreen drag.
//
//*****************************************************************************
#define JW_STYLE_SCROLL 0x00000010
//*****************************************************************************
//
//! This flag indicates that the JPEG widget should ignore all touchscreen
//! activity.
//
//*****************************************************************************
#define JW_STYLE_LOCKED 0x00000020
//*****************************************************************************
//
//! This flag indicates that the JPEG widget is pressed.
//
//*****************************************************************************
#define JW_STYLE_PRESSED 0x00000040
//*****************************************************************************
//
//! This flag indicates that the JPEG widget callback should be made when
//! the widget is released rather than when it is pressed. This style flag is
//! ignored if JW_STYLE_BUTTON is not set.
//
//*****************************************************************************
#define JW_STYLE_RELEASE_NOTIFY 0x00000080
//*****************************************************************************
//
//! Declares an initialized JPEG image widget data structure.
//!
//! \param pParent is a pointer to the parent widget.
//! \param pNext is a pointer to the sibling widget.
//! \param pChild is a pointer to the first child widget.
//! \param pDisplay is a pointer to the display on which to draw the push
//! button.
//! \param lX is the X coordinate of the upper left corner of the JPEG widget.
//! \param lY is the Y coordinate of the upper left corner of the JPEG widget.
//! \param lWidth is the width of the JPEG widget.
//! \param lHeight is the height of the JPEG widget.
//! \param ulStyle is the style to be applied to the JPEG widget.
//! \param ulFillColor is the color used to fill in the JPEG widget.
//! \param ulOutlineColor is the color used to outline the JPEG widget.
//! \param ulTextColor is the color used to draw text on the JPEG widget.
//! \param pFont is a pointer to the font to be used to draw text on the push
//! button.
//! \param pcText is a pointer to the text to draw on this JPEG widget.
//! \param pucImage is a pointer to the compressed image to draw on this JPEG
//! widget.
//! \param ulImgLen is the length of the data pointed to by pucImage.
//! \param ucBorderWidth is the width of the border to paint if \b
//! #JW_STYLE_OUTLINE is specified.
//! \param pfnOnClick is a pointer to the function that is called when the JPEG
//! button is pressed assuming \b #JW_STYLE_BUTTON is specified.
//! \param pfnOnScroll is a pointer to the function that is called when the
//! image is scrolled assuming \b #JW_STYLE_BUTTON is not specified.
//! \param psInst is a pointer to a read/write tJPEGInst structure that the
//! widget can use for workspace.
//!
//! This macro provides an initialized jpeg image widget data structure, which
//! can be used to construct the widget tree at compile time in global
//! variables (as opposed to run-time via function calls). This must be
//! assigned to a variable, such as:
//!
//! \verbatim
//! tJPEGWidget g_sImageButton = JPEGWidgetStruct(...);
//! \endverbatim
//!
//! Or, in an array of variables:
//!
//! \verbatim
//! tJPEGWidget g_psImageButtons[] =
//! {
//! JPEGWidgetStruct(...),
//! JPEGWidgetStruct(...)
//! };
//! \endverbatim
//!
//! \e ulStyle is the logical OR of the following:
//!
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -