static void _suspend_backup_screen() { IBitmap* pDeviceBitmap; IDISPLAY_GetDeviceBitmap(BFF_DISPLAY(),&pDeviceBitmap); IBITMAP_CreateCompatibleBitmap( pDeviceBitmap, &GetMainAppData()->pScreenBackup, getDeviceWidth(), getDeviceHeight()); IBITMAP_BltIn( GetMainAppData()->pScreenBackup, 0, 0, getDeviceWidth(),getDeviceHeight(), pDeviceBitmap, 0, 0, AEE_RO_COPY ); IBITMAP_Release( pDeviceBitmap ); }
static boolean task_resume(Bff *bff, uint16 flags, AEEAppStart *appStart, boolean *consumed) { if(GetMainAppData()->pScreenBackup) { IDISPLAY_ClearScreen(BFF_DISPLAY()); IDISPLAY_BitBlt(BFF_DISPLAY(),0,0,getDeviceWidth(),getDeviceHeight(),GetMainAppData()->pScreenBackup,0,0,AEE_RO_COPY); IDISPLAY_Update(BFF_DISPLAY()); IBITMAP_Release(GetMainAppData()->pScreenBackup); GetMainAppData()->pScreenBackup = NULL; } return (*consumed = TRUE); }
//============================================================================= //Performs clean-up //============================================================================= void GLApp::CleanUp() { eglMakeCurrent(EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if(m_pIShell) { ISHELL_Release(m_pIShell); m_pIShell = NULL; } if(m_pDBitmap) { IBITMAP_Release(m_pDBitmap); m_pDBitmap = NULL; } if(m_eglContext) { eglDestroyContext(m_eglDisplay, m_eglContext); m_eglContext = NULL; } if(m_eglSurface) { eglDestroySurface(m_eglDisplay, m_eglSurface); m_eglSurface = NULL; } if(m_eglDisplay) { eglTerminate(m_eglDisplay); m_eglDisplay = NULL; } if(m_pIEGL) { IEGL_Release(m_pIEGL); m_pIEGL = NULL; } if(m_pIGL) { IGL_Release(m_pIGL); m_pIGL = NULL; } }
/*============================================================================= 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; } } }