⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 abl_swim_image.c

📁 sharp触摸屏测试代码
💻 C
📖 第 1 页 / 共 2 页
字号:
/***********************************************************************
 * $Workfile:   abl_swim_image.c  $
 * $Revision:   1.0  $
 * $Author:   WellsK  $
 * $Date:   Jun 09 2003 12:06:28  $
 *
 * Project: Image management for SWIM
 *
 * Description:
 *     See the swim.h header file for a description of this package.
 *
 * Revision History:
 * $Log:   //smaicnt2/pvcs/VM/sharpmcu/archives/sharpmcu/software/abl/source/abl_swim_image.c-arc  $
 * 
 *    Rev 1.0   Jun 09 2003 12:06:28   WellsK
 * Initial revision.
 * 
 *
 ***********************************************************************
 * SHARP MICROELECTRONICS OF THE AMERICAS MAKES NO REPRESENTATION
 * OR WARRANTIES WITH RESPECT TO THE PERFORMANCE OF THIS SOFTWARE,
 * AND SPECIFICALLY DISCLAIMS ANY RESPONSIBILITY FOR ANY DAMAGES, 
 * SPECIAL OR CONSEQUENTIAL, CONNECTED WITH THE USE OF THIS SOFTWARE.
 *
 * SHARP MICROELECTRONICS OF THE AMERICAS PROVIDES THIS SOFTWARE SOLELY 
 * FOR THE PURPOSE OF SOFTWARE DEVELOPMENT INCORPORATING THE USE OF A 
 * SHARP MICROCONTROLLER OR SYSTEM-ON-CHIP PRODUCT. USE OF THIS SOURCE
 * FILE IMPLIES ACCEPTANCE OF THESE CONDITIONS.
 *
 * COPYRIGHT (C) 2001 SHARP MICROELECTRONICS OF THE AMERICAS, INC.
 *     CAMAS, WA
 **********************************************************************/

#include "abl_types.h"
#include "abl_swim_image.h"

/***********************************************************************
 * Public functions
 **********************************************************************/

/***********************************************************************
 *
 * Function: swim_put_image
 *
 * Purpose: Puts an raw image in a window unscaled, clips off edges
 *
 * Processing:
 *     See function.
 *
 * Parameters: 
 *     win   : Window identifier
 *     image : Pointer to image data, must be in display color format
 *     xsize : Size of the image in horizontal pixels
 *     ysize : Size of the image in vertical pixels
 *
 * Outputs: None
 *
 * Returns: Nothing
 *
 * Notes:
 *     Pixels should be organized in the image from left to right, top
 *     to bottom. (BMP images are not stored like this.)
 *
 **********************************************************************/
void swim_put_image (SWIM_WINDOW_T *win,
                     const COLOR_T *image,
                     INT_32 xsize,
                     INT_32 ysize)
{
    COLOR_T *fb;
    INT_32 x, y;

    /* Unknown values of rtype will do no rotation */
    y = win->ypvmin;

    xsize = xsize + win->xpvmin;
    ysize = ysize + win->ypvmin;

    /* Move image to window pixel by pixel */
    while ((y <= win->ypvmax) && (y < ysize))
    {
        /* Set physical frame buffer address */
        x = win->xpvmin;
        fb = win->fb + x + (y * win->xpsize);

        /* Render a single line */
        while ((x <= win->xpvmax) && (x < xsize))
        {
            *fb = *image;
            fb++;
            image++;
            x++;
        }

        /* Adjust to end of line if the image was clipped */
        image = image + (xsize - x);

        y++;
    }
}

/***********************************************************************
 *
 * Function: swim_put_invert_image
 *
 * Purpose: Puts an raw image in a window unscaled, inverted, with
 *          clipped edges.
 *
 * Processing:
 *     See function.
 *
 * Parameters: 
 *     win   : Window identifier
 *     image : Pointer to image data, must be in display color format
 *     xsize : Size of the image in horizontal pixels
 *     ysize : Size of the image in vertical pixels
 *
 * Outputs: None
 *
 * Returns: Nothing
 *
 * Notes:
 *     Pixels should be organized in the image from left to right, top
 *     to bottom. (BMP images are not stored like this.)
 *
 **********************************************************************/
void swim_put_invert_image (SWIM_WINDOW_T *win,
                            const COLOR_T *image,
                            INT_32 xsize,
                            INT_32 ysize)
{
    COLOR_T *fb;
    INT_32 x, y, xr, yr;

    y = win->ypvmin;
    yr = ysize - 1;

    /* Move image to window pixel by pixel */
    while ((y <= win->ypvmax) && (yr >= 0))
    {
        /* Set physical frame buffer address */
        x = win->xpvmin;
        xr = xsize - 1;
        fb = win->fb + x + (y * win->xpsize);

        /* Render a single line */
        while ((x <= win->xpvmax) && (xr >= 0))
        {
            *fb = image [xr + yr * xsize];
            fb++;
            x++;
            xr--;
        }

        y++;
        yr--;
    }
}

/***********************************************************************
 *
 * Function: swim_put_left_image
 *
 * Purpose: Puts an raw image in a window unscaled, rotated left, with
 *          clipped edges.
 *
 * Processing:
 *     See function.
 *
 * Parameters: 
 *     win   : Window identifier
 *     image : Pointer to image data, must be in display color format
 *     xsize : Size of the image in horizontal pixels
 *     ysize : Size of the image in vertical pixels
 *
 * Outputs: None
 *
 * Returns: Nothing
 *
 * Notes:
 *     Pixels should be organized in the image from left to right, top
 *     to bottom. (BMP images are not stored like this.)
 *
 **********************************************************************/
void swim_put_left_image (SWIM_WINDOW_T *win,
                          const COLOR_T *image,
                          INT_32 xsize,
                          INT_32 ysize)
{
    COLOR_T *fb;
    INT_32 x, y, xr, yr;

    x = win->xpvmin;
    yr = ysize - 1;

    /* Move image to window pixel by pixel */
    while ((x <= win->xpvmax) && (yr >= 0))
    {
        /* Set physical frame buffer address to start drawing at
           bottom */
        y = win->ypvmin;
        fb = win->fb + x + (y * win->xpsize);
        xr = 0;

        /* Render a single line */
        while ((y <= win->ypvmax) && (xr < xsize))
        {
            /* Go to next line (y) */
            *fb = image [(xsize - xr - 1) + (ysize - yr - 1) * xsize];
            fb = fb + win->xpsize;

            /* Update picture to next x coordinate */
            y++;
            xr++;
        }

        x++;
        yr--;
    }
}

/***********************************************************************
 *
 * Function: swim_put_right_image
 *
 * Purpose: Puts an raw image in a window unscaled, rotated right, with
 *          clipped edges.
 *
 * Processing:
 *     See function.
 *
 * Parameters: 
 *     win   : Window identifier
 *     image : Pointer to image data, must be in display color format
 *     xsize : Size of the image in horizontal pixels
 *     ysize : Size of the image in vertical pixels
 *
 * Outputs: None
 *
 * Returns: Nothing
 *
 * Notes:
 *     Pixels should be organized in the image from left to right, top
 *     to bottom. (BMP images are not stored like this.)
 *
 **********************************************************************/
void swim_put_right_image (SWIM_WINDOW_T *win,
                           const COLOR_T *image,
                           INT_32 xsize,
                           INT_32 ysize)
{
    COLOR_T *fb;
    INT_32 x, y, xr, yr;

    x = win->xpvmin;
    yr = ysize - 1;

    /* Move image to window pixel by pixel */
    while ((x <= win->xpvmax) && (yr >= 0))
    {
        /* Set physical frame buffer address to start drawing at bottom */
        y = win->ypvmin;
        fb = win->fb + x + (y * win->xpsize);
        xr = 0;

        /* Render a single line */
        while ((y <= win->ypvmax) && (xr < xsize))
        {
            /* Go to next line (y) */
            *fb = image [xr + yr * xsize];
            fb = fb + win->xpsize;

            /* Update picture to next x coordinate */
            y++;
            xr++;
        }

        x++;
        yr--;
    }
}

/***********************************************************************
 *
 * Function: swim_put_scale_image
 *
 * Purpose: Puts an raw image in a window scaled.
 *
 * Processing:
 *     See function.
 *
 * Parameters: 
 *     win   : Window identifier
 *     image : pointer to image data, must be in display color format
 *     xsize : Size of the image in horizontal pixels
 *     ysize : Size of the image in vertical pixels
 *
 * Outputs: None
 *
 * Returns: Nothing
 *

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -