Пример #1
0
static void getDisplayInfo(DisplayInfo& info)
{
    IDisplay* display = reinterpret_cast<AEEApplet*>(GETAPPINSTANCE())->m_pIDisplay;
    PlatformRefPtr<IBitmap> bitmap = adoptPlatformRef(IDisplay_GetDestination(display));

    AEEBitmapInfo bitmapInfo;
    IBitmap_GetInfo(bitmap.get(), &bitmapInfo, sizeof(AEEBitmapInfo));

    info.width  = bitmapInfo.cx;
    info.height = bitmapInfo.cy;
    info.depth  = bitmapInfo.nDepth;
}
Пример #2
0
static void getDisplayInfo(DisplayInfo& info)
{
    IDisplay* display = reinterpret_cast<AEEApplet*>(GETAPPINSTANCE())->m_pIDisplay;
    IBitmap* bitmap = IDisplay_GetDestination(display);
    ASSERT(bitmap);

    AEEBitmapInfo bitmapInfo;
    IBitmap_GetInfo(bitmap, &bitmapInfo, sizeof(AEEBitmapInfo));

    info.width  = bitmapInfo.cx;
    info.height = bitmapInfo.cy;
    info.depth  = bitmapInfo.nDepth;

    IBitmap_Release(bitmap);
}
Пример #3
0
//=============================================================================
//Initializes the GL application
//=============================================================================
boolean GLApp::Init(IShell *shell, IDisplay *display)
{
	m_pIShell = shell;
	m_pIDisplay = display;

	//create GL interfaces
	if(ISHELL_CreateInstance(m_pIShell, AEECLSID_GL, (void**)&m_pIGL) != SUCCESS) 
	{
		return FALSE;
	}
	else 
	{
		IGL_Init(m_pIGL);
	}

	if(ISHELL_CreateInstance(m_pIShell, AEECLSID_EGL, (void**)&m_pIEGL) != SUCCESS) 
	{
		return FALSE;
	}
	else 
	{
		IEGL_Init(m_pIEGL);
	}

	//get device frame buffer info
	if(IDisplay_GetDeviceBitmap(display, &m_pDBitmap) != SUCCESS)
	{
		CleanUp();
		return FALSE;
	}

	if(IBitmap_GetInfo(m_pDBitmap, &m_DBitmapInfo, sizeof(AEEBitmapInfo)) != SUCCESS)
	{
		CleanUp();
		return FALSE;
	}

	if(!SetupEGL(display))
		return FALSE;

	if(!SetupGL())
		return FALSE;

	//setup shapes
	m_Cube.Init(shell);

	return TRUE;
}
Пример #4
0
/*=============================================================================
FUNCTION c_SampleCameraApp_CameraCBFunc

DESCRIPTION
  This callback notifier function handles all callbacks from ICamera.  
     Depending on how complex your application this function may need to handle
     several use cases.  The most common uses are error handling, state 
     transistion, displaying frames, and monitoring status.  

PROTOTYPE:
  static void c_SampleCameraApp_CameraCBFunc(SampleCameraApp* pMe, 
                                         AEECameraNotify * pcn)

PARAMETERS:
   pMe: Pointer to the applet data stucture
  
   pcn: This pointer to a AEECameraNotify structure contains information about
      the ICamera object.  

DEPENDENCIES
   none

RETURN VALUE
   none

SIDE EFFECTS
   none
=============================================================================*/
static void c_SampleCameraApp_CameraCBFunc(c_samplecamera* pMe, 
                                         AEECameraNotify * pcn)
{
   int nErr = AEE_EFAILED;

   // First validate the callback...
   if (!pMe || !pcn)
   {
      DBGPRINTF("NULL ptr in callback.");
      return;
   }

   c_SampleCameraApp_PrintStatus(pMe);
   
   switch (pcn->nStatus)
   {
   case CAM_STATUS_FRAME:
      {
         // A new frame is available, Get the raw frame, check orientation and blit it to the screen
         IBitmap * pFrame;
         AEEBitmapInfo BitmapInfo;

         ICAMERA_GetFrame( pMe->pICamera, &pFrame );
         if (!pFrame) break;

         
         //Check to see if the raw frame does not have the same orientation 
         // as what expected.  If they are not the same, rotate the preview so
         // that the final image on the screen is rotated correctly.  This 
         // will handle the different mounting possitions of the camera.
         IBitmap_GetInfo(pFrame, &BitmapInfo, sizeof(AEEBitmapInfo));
         
         if (BitmapInfo.cx == pMe->ImageSize.cy && BitmapInfo.cy == pMe->ImageSize.cx )
         {
            DBGPRINTF("Frame is %d by %d.  Expected %d by %d", BitmapInfo.cx, BitmapInfo.cy, pMe->ImageSize.cx, pMe->ImageSize.cy );
            if (!pMe->bAdjustedPreviewRotate)
            {
               nErr = ICAMERA_SetParm(pMe->pICamera, CAM_PARM_ROTATE_PREVIEW, 90, 0);
               DBGPRINTF("Rotating the image - nErr is %d", nErr);
               pMe->bAdjustedPreviewRotate = TRUE;
            }
         }
         IDISPLAY_BitBlt(pMe->Applet.m_pIDisplay, 0, 0,
                         pMe->ImageSize.cx, pMe->ImageSize.cy,  
                         pFrame, 0, 0, AEE_RO_COPY);

         //Display buffer is now updated, need to update the screen
         IDISPLAY_Update(pMe->Applet.m_pIDisplay);
         IBITMAP_Release(pFrame);
         break;
      }
   case CAM_STATUS_DONE:
      {
         //if there is a command to execute, call the appropriate function 
         if (pMe->bCommandToExecute)
         {
            pMe->bCommandToExecute = FALSE;
            switch (pMe->nCommandToExecute)
            {
            case RECORD_SNAPSHOT:
               {
                  nErr = ICAMERA_RecordSnapshot(pMe->pICamera);
                  DBGPRINTF("ICAMERA_RecordSnapshot %d", nErr);
                  break;
               }
            case RECORD_MOVIE:
               {
                  nErr = ICAMERA_RecordMovie(pMe->pICamera);
                  DBGPRINTF("ICAMERA_RecordMovie %d", nErr);
                  break;
               }
            }
            pMe->nCommandToExecute = NO_COMMAND;
         }
         break;
      }

   }

}