1 / 15

12. IImage API

12. IImage API. 비트맵 이미지를 그리는 것부터 간단한 기하학적 도형 까지 , BREW 는 인상적인 이미지를 제공하기 위하여 다수의 기능들을 가지고 있다 . BREW 는 비트맵과 기하학적 그래픽스의 디스플레이를 위한 적절한 기능을 가지고 있다 . BREW 는 BMP 이미지를 직접 다루기 위한 다수의 기능을 포함한다 . 그러한 가능은 BMP 적재하는 기능 뿐만 아니라 그러한 이미지들의 디스플레이와 애니메이션을 포함한다 .

Download Presentation

12. IImage API

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 12. IImage API • 비트맵 이미지를 그리는 것부터 간단한 기하학적 도형 까지, BREW는 인상적인 이미지를 제공하기 위하여 다수의 기능들을 가지고 있다. • BREW는 비트맵과 기하학적 그래픽스의 디스플레이를 위한 적절한 기능을 가지고 있다. • BREW는 BMP 이미지를 직접 다루기 위한 다수의 기능을 포함한다. 그러한 가능은 BMP 적재하는 기능 뿐만 아니라 그러한 이미지들의 디스플레이와 애니메이션을 포함한다. • IImage 인터페이스를 사용하여 비트맵 이미지를 그리고 애니메이션 비트맵을 화면에 표시할 수 있다. • IImage 인터페이스 사용방법 IImage 인터페이스 생성 이미지 적재 Draw 작업 IImage 해제 임베디드 모바일 프로그래밍

  2. 12. IImage API 12.1 IImage API 관련 자료형 임베디드 모바일 프로그래밍

  3. 12. IImage API • 12.2 IImage API 함수 • IImage_SetParm 함수 • IImage 인터페이스 개체의 다양한 이미지 관련 매개 변수를 설정할 수 있다. 설정할 매개 변수는 nParm에 의해 지정되며 IPARM_SIZE, IPARM_OFFSET, IPARM_CXFRAME, IPARM_NFRAMES, IPARM_RATE, IPARM_ROP 또는 IPARM_OFFSCREEN 중 하나이다. • 새 매개 변수 값은 p1과 p2를 사용하여 지정합니다. 임베디드 모바일 프로그래밍

  4. 12. IImage API • IImage_Start 함수 • 주어진 이미지의 애니메이션을 시작한다. 이미지의 각 프레임 사이를 순환한다. 각 프레임이 x 및 y 매개 변수가 지정한 좌표에 나타난다. 두 연속 프레임이 표시되는 애니메이션 타이머의 시간 간격은 150 밀리초이다. 애니메이션은 IIMAGE_Stop() 을 호출할 때까지 계속된다. 임베디드 모바일 프로그래밍

  5. 12. IImage API • IImage_Draw 함수 • 화면의 지정된 위치에 이미지를 그린다. 임베디드 모바일 프로그래밍

  6. 12. IImage API • 12.3 IImage API – 애니메이션 예제 프로그램(animation.c) • 하나의 폭 넓은 BMP내의 애니메이션 프레임등(anim.bmp) 임베디드 모바일 프로그래밍

  7. 12. IImage API • animation.h #ifndef __HELLO_H__ #define __HELLO_H__ #include "AEE.h" #include "AEEDisp.h" #include "AEEModGen.h" #include "AEEAppGen.h" #include "AEEDisp.h" #include "AEEClassIDs.h" #include "AEEStdLib.h" #include "AEEImage.h" #include "AEEShell.h" #include "AEEMenu.h" // Menu Services #include "AEEFile.h" // AEEFile Services #include "AEEText.h" typedef struct myapp_s { AEEApplet a; //applet header AEEDeviceInfo di; IImage* pImage; //our animated BMP image } myapp_t; static boolean Animation_HandleEvent(IApplet * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam); void Animation_CleanUp(myapp_t* pApp); #endif 임베디드 모바일 프로그래밍

  8. 12. IImage API • animation.c #include "animation.h" #include "animation.bid"int AEEClsCreateInstance(AEECLSID ClsId, IShell * pIShell, IModule * po, void ** ppObj){ *ppObj = NULL; if( ClsId == AEECLSID_ANIMATION ) { if(AEEApplet_New(sizeof(myapp_t), ClsId, pIShell, po, (IApplet**)ppObj, (AEEHANDLER)Animation_HandleEvent, (PFNFREEAPPDATA)Animation_CleanUp) == TRUE) { return(AEE_SUCCESS); } } return(EFAILED);} static boolean Animation_HandleEvent(IApplet * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam){ myapp_t* pApp = (myapp_t*)pi; AEEApplet * pMe = &pApp->a; switch (eCode) { case EVT_APP_START: //get info about the handset (resolution, etc.) ISHELL_GetDeviceInfo(pMe->m_pIShell, &pApp->di); //clear screen (default color is white) IDISPLAY_ClearScreen(pMe->m_pIDisplay); pApp->pImage = ISHELL_LoadImage(pMe->m_pIShell, "anim.bmp"); //set up image animation properties IIMAGE_SetParm(pApp->pImage, IPARM_CXFRAME, 51, 0); IIMAGE_SetParm(pApp->pImage, IPARM_NFRAMES, 3, 0); IIMAGE_SetParm(pApp->pImage, IPARM_RATE, 200, 0); 임베디드 모바일 프로그래밍

  9. 12. IImage API //start the animation IIMAGE_Start(pApp->pImage, pApp->di.cxScreen / 4, pApp->di.cyScreen / 5); //we've successfully handled this message return(TRUE); break; } return(FALSE);} void Animation_CleanUp(myapp_t* pApp) { IIMAGE_Stop(pApp->pImage); IIMAGE_Release(pApp->pImage); } 임베디드 모바일 프로그래밍

  10. 12. IImage API • 실행결과 임베디드 모바일 프로그래밍

  11. 12. IImage API • 12-4 IImage API – 슬라이드쇼 예제 프로그램(slideshow.c) • slideshow.h #ifndef __SLIDESHOW_H__ #define __SLIDESHOW_H__ #include "AEE.h" #include "AEEDisp.h" #include "AEEModGen.h" #include "AEEAppGen.h" #include "AEEDisp.h" #include "AEEClassIDs.h" #include "AEEStdLib.h" #include "AEEImage.h" #include "AEEShell.h" #include "AEEMenu.h" #include "AEEFile.h" #include "AEEText.h" #define MAX_IMAGES 4 #define DISPLAY_DELAY 1000 static boolean Slideshow_HandleEvent(IApplet * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam); typedef struct myapp_s { AEEApplet a; //applet header AEEDeviceInfo di; int nImage; IImage* pImages[MAX_IMAGES]; } myapp_t; 임베디드 모바일 프로그래밍

  12. 12. IImage API void Slideshow_CleanUp(myapp_t* pApp); void Slideshow_Timer(myapp_t * pApp); #endif • slideshow.c #include "slideshow.h" #include "slideshow.bid” int AEEClsCreateInstance(AEECLSID ClsId, IShell * pIShell, IModule * po, void ** ppObj){ *ppObj = NULL; if(ClsId == AEECLSID_SLIDESHOW ) { if(AEEApplet_New(sizeof(myapp_t), ClsId, pIShell,po,(IApplet**)ppObj, (AEEHANDLER)Slideshow_HandleEvent, (PFNFREEAPPDATA)Slideshow_CleanUp) == TRUE) { return (AEE_SUCCESS); } } return (EFAILED);}static boolean Slideshow_HandleEvent(IApplet * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam){ myapp_t * pApp = (myapp_t*)pi; AEEApplet * pMe = &pApp->a; switch (eCode) { case EVT_APP_START: //get info about the handset (resolution, etc.) ISHELL_GetDeviceInfo(pMe->m_pIShell, &pApp->di); //clear whole screen IDISPLAY_ClearScreen (pMe->m_pIDisplay); //load our images pApp->pImages[0] = ISHELL_LoadImage(pMe->m_pIShell, "slide1.bmp"); pApp->pImages[1] = ISHELL_LoadImage(pMe->m_pIShell, "slide2.bmp"); pApp->pImages[2] = ISHELL_LoadImage(pMe->m_pIShell, "slide3.bmp"); pApp->pImages[3] = ISHELL_LoadImage(pMe->m_pIShell, "slide4.bmp"); 애플릿의 참조 카운트가 0이 되면 호출되는 함수. 애플릿 데이터를 해제(free)시키는 함수 임베디드 모바일 프로그래밍

  13. 12. IImage API pApp->nImage = 0; //draw the first image IIMAGE_Draw(pApp->pImages[pApp->nImage], 10, 10); IDISPLAY_Update(pMe->m_pIDisplay); //Set the timer...let's go! ISHELL_SetTimer(pApp->a.m_pIShell, DISPLAY_DELAY, (PFNNOTIFY)Slideshow_Timer, pApp); return(TRUE); break; case EVT_APP_SUSPEND: //If we've paused the applet for some reason, kill the timer ISHELL_CancelTimer(pApp->a.m_pIShell, NULL, NULL); return(TRUE); break; case EVT_APP_RESUME: //When the applet is re-activated, redraw and start the timer IDISPLAY_ClearScreen (pMe->m_pIDisplay); IIMAGE_Draw(pApp->pImages[pApp->nImage], 10, 10); IDISPLAY_Update(pMe->m_pIDisplay); ISHELL_SetTimer(pApp->a.m_pIShell, DISPLAY_DELAY, (PFNNOTIFY)Slideshow_Timer, pApp); return(TRUE); break; } return FALSE;} void Slideshow_CleanUp(myapp_t* pApp) { //delete our loaded BMPs int i; for (i = 0; i < MAX_IMAGES; i++) { IIMAGE_Release(pApp->pImages[i]); } } 임베디드 모바일 프로그래밍

  14. 12. IImage API void Slideshow_Timer(myapp_t * pApp) { //Toggle between the two images, draw image, and start //timer again for next image. AEEApplet * pMe = &pApp->a; ++pApp->nImage; if (pApp->nImage >= MAX_IMAGES) pApp->nImage = 0; IIMAGE_Draw(pApp->pImages[pApp->nImage], 10, 10); IDISPLAY_Update(pMe->m_pIDisplay); ISHELL_SetTimer(pApp->a.m_pIShell, DISPLAY_DELAY, (PFNNOTIFY)Slideshow_Timer, pApp); } 임베디드 모바일 프로그래밍

  15. 12. IImage API • 실행결과 임베디드 모바일 프로그래밍

More Related