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

📄 sma_swim_image.c

📁 sharp的arm920t 7A400的评估板附带光盘Sharp KEVLH7A400 v0.3b Welcome to the SHARP KEV7A400 Evaluation board
💻 C
字号:
/***********************************************************************
 * $Workfile:   SMA_swim_image.c  $
 * $Revision:   1.0  $
 * $Author:   WellsK  $
 * $Date:   Aug 27 2002 08:36:56  $
 *
 * Project: Image management for SWIM
 *
 * Description:
 *  See the swim.h header file for a description of this package.
 *
 * Revision History:
 * $Log:   //smaicnt2/pvcs/VM/CHIPS/archives/SOC/Source/Graphics/SWIM/SWIM_Image/SMA_swim_image.c-arc  $
 * 
 *    Rev 1.0   Aug 27 2002 08:36:56   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) 2002 SHARP MICROELECTRONICS OF THE AMERICAS, INC.
 *     CAMAS, WA
 **********************************************************************/
#include "SMA_types.h"
#include "SMA_swim_image.h"

//**********************************************************************
// 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 (INT_32 win, const color_type *image,
    INT_32 xsize, INT_32 ysize)
{
    color_type *fb;
    INT_32 x, y;

    // Physical image coordinates inside window
    y = window [win].ypvmin;
    xsize = xsize + window [win].xpvmin;
    ysize = ysize + window [win].ypvmin;

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

        // Render a single line
        while ((x <= window [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_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
 *
 * 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_scale_image (INT_32 win, const color_type *image,
    INT_32 xsize, INT_32 ysize)
{
    INT_32 xsc, ysc;
    INT_32 x, y;
    color_type *fb;

    // Top of window
    y = window [win].ypvmin;

    // Rescale image into window
    while (y <= window [win].ypvmax)
    {
        x = window [win].xpvmin;

        // Get 'y' line in image
        ysc = (y - window [win].ypvmin) *
            ysize / (window [win].yvsize + 1);
        fb = window [win].fb + x + (y * window [win].xpsize);

        // Render a single line
        while (x <= window [win].xpvmax)
        {
            // Get x pixel in image
            xsc = (x - window [win].xpvmin) *
                xsize / window [win].xvsize;
            *fb = image [xsc + ysc * xsize];
            fb++;
            x++;
        }
      
        y++;
    }
}

⌨️ 快捷键说明

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