bitmapsave.c

来自「在brew环境下」· C语言 代码 · 共 124 行

C
124
字号
/*===========================================================================

FILE: bitmapsave.c
===========================================================================*/

/*===============================================================================
INCLUDES AND VARIABLE DEFINITIONS
=============================================================================== */
#include "AEEModGen.h"          // Module interface definitions
#include "AEEAppGen.h"          // Applet interface definitions
#include "AEEShell.h"           // Shell interface definitions
#include "AEEFile.h"			// File interface definitions
#include "AEEDB.h"				// Database interface definitions
#include "AEENet.h"				// Socket interface definitions
#include "AEESound.h"			// Sound Interface definitions
#include "AEETapi.h"			// TAPI Interface definitions

#include "bitmapsave.bid"

#include "SaveBitmapUtil/BitmapSave.h"

/*-------------------------------------------------------------------
Applet structure. All variables in here are reference via "pMe->"
-------------------------------------------------------------------*/
typedef struct _bitmapsave {
	AEEApplet      a ;
    AEEDeviceInfo  DeviceInfo;

} bitmapsave;

/*-------------------------------------------------------------------
Function Prototypes
-------------------------------------------------------------------*/
static  boolean bitmapsave_HandleEvent(bitmapsave* pMe, AEEEvent eCode, 
                                             uint16 wParam, uint32 dwParam);
boolean bitmapsave_InitAppData(bitmapsave* pMe);
void    bitmapsave_FreeAppData(bitmapsave* pMe);

void bitmapsave_Test(bitmapsave* pMe);

/*===========================================================================
FUNCTION: AEEClsCreateInstance
===========================================================================*/
int AEEClsCreateInstance(AEECLSID ClsId, IShell *pIShell, IModule *po, void **ppObj)
{
	*ppObj = NULL;

	if( ClsId == AEECLSID_BITMAPSAVE )
	{
		if( AEEApplet_New(sizeof(bitmapsave),
                          ClsId,
                          pIShell,
                          po,
                          (IApplet**)ppObj,
                          (AEEHANDLER)bitmapsave_HandleEvent,
                          (PFNFREEAPPDATA)bitmapsave_FreeAppData) )
		{
			if(bitmapsave_InitAppData((bitmapsave*)*ppObj))
			{
				return(AEE_SUCCESS);
			}
			else
			{
				IAPPLET_Release((IApplet*)*ppObj);
				return EFAILED;
			}
        }
    }
	return(EFAILED);
}

/*===========================================================================
FUNCTION SampleAppWizard_HandleEvent
===========================================================================*/
static boolean bitmapsave_HandleEvent(bitmapsave* pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{  
    switch (eCode) 
	{
        case EVT_APP_START:  
			bitmapsave_Test( pMe );
            return(TRUE);

        case EVT_APP_STOP:
      		return(TRUE);

        case EVT_APP_SUSPEND:
      		return(TRUE);

        case EVT_APP_RESUME:
      		return(TRUE);

        case EVT_APP_MESSAGE:
      		return(TRUE);

        case EVT_KEY:
      		return(TRUE);

        default:
            break;
   }
   return FALSE;
}

boolean bitmapsave_InitAppData(bitmapsave* pMe)
{
    pMe->DeviceInfo.wStructSize = sizeof(pMe->DeviceInfo);
    ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&pMe->DeviceInfo);

    return TRUE;
}

void bitmapsave_FreeAppData(bitmapsave* pMe)
{
}

void bitmapsave_Test(bitmapsave* pMe)
{
	IBitmap* pIBitmap = NULL;

	pIBitmap = ISHELL_LoadBitmap( pMe->a.m_pIShell, "test.bmp");
	SaveScreen24(pIBitmap, pMe->a.m_pIDisplay, "test_save.bmp");
}

⌨️ 快捷键说明

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