plz send me source code to draw a circle/rectangle | developer.brewmp.com plz send me source code to draw a circle/rectangle | developer.brewmp.com

Developer

plz send me source code to draw a circle/rectangle

Forums:

hi all,
i am trying to draw a circle but i am getting "Module fail to free all memory" error my code is

//ShapeApp.h
#if !defined(ShapeApp_h)
#define ShapeApp_h

#include "AEEModGen.h" // Module interface definitions
#include "AEEAppGen.h" // Applet interface definitions
#include "AEEGraphics.h"

class ShapeApp :public AEEApplet
{
public:
static boolean HandleEvent(ShapeApp * pApp, AEEEvent eCode, uint16 wparam, uint32 dwParam);
static boolean initAppData(IApplet * pIApplet);
static void freeAppData(ShapeApp * pApp);

protected:
void freeData();
boolean onEvent(AEEEvent evt, uint16 wParam, uint32 dwParam);
boolean initData();

private:

};

#endif

//ShapeApp.cpp

#include "ShapeApp.h"
#include "ShapeApp.bid"
#include "AEEStdLib.h"

extern "C"
{
int AEEClsCreateInstance(AEECLSID ClsId,IShell * pIShell,IModule * po,void ** ppObj)
{
*ppObj = NULL;

if(ClsId == AEECLSID_SHAPEAPP)
{
if(AEEApplet_New(sizeof(ShapeApp), ClsId, pIShell,po,(IApplet**)ppObj,
(AEEHANDLER)ShapeApp::HandleEvent,(PFNFREEAPPDATA)ShapeApp::freeAppData))
{
if(ShapeApp::initAppData((IApplet *) *ppObj))
{
return (AEE_SUCCESS);
}
}

}
return (EFAILED);

boolean ShapeApp::HandleEvent(ShapeApp * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
return pi->onEvent(eCode, wParam, dwParam);

}

boolean ShapeApp::initAppData(IApplet * pIApplet)
{
return ((ShapeApp *) pIApplet)->initData();

void ShapeApp::freeAppData(ShapeApp * pApp)
{
pApp->freeData();

boolean ShapeApp::initData()
{
return TRUE;

boolean ShapeApp::onEvent(AEEEvent evt, uint16 wParam, uint32 dwParam)
{
//AECHAR szText[] = {'H','e','l','l','o',' ','W','o', 'r', 'l', 'd', '\0'};
IGraphics *pg = NULL;
IShell *pIShell=m_pIShell;
switch (evt){
case EVT_APP_START:
/*IDISPLAY_DrawText(this->m_pIDisplay, // Display instance
AEE_FONT_BOLD, // Use BOLD font
szText, // Text - Normally comes from resource
-1, // -1 = Use full string length
0, // Ignored - IDF_ALIGN_CENTER
0, // Ignored - IDF_ALIGN_MIDDLE
NULL, // No clipping
IDF_ALIGN_CENTER | IDF_ALIGN_MIDDLE);
IDISPLAY_Update (this->m_pIDisplay);*/
AEECircle c;
c.cx = 50;
c.cy = 50;
c.r = 10;

if(ISHELL_CreateInstance(pIShell,AEECLSID_GRAPHICS,(void**)&pg) != SUCCESS)
return FALSE;
IGRAPHICS_SetBackground(pg,255,255,255);
IGRAPHICS_ClearViewport(pg);
IGRAPHICS_SetFillMode(pg, TRUE);
IGRAPHICS_SetPaintMode(pg, AEE_PAINT_COPY);
IGRAPHICS_SetColor(pg, 255,225,0, 1);
IGRAPHICS_SetFillColor(pg, 255,0,0, 1);
if(!IGRAPHICS_DrawCircle(pg,&c))
return FALSE;

IGRAPHICS_Update(pg);
IGRAPHICS_Release(pg);
return TRUE;
//return (IGRAPHICS_DrawCircle(pg,&c) == SUCCESS);
//return rval;

//return(TRUE);

case EVT_APP_STOP:
return(TRUE);

default:
break;
}
return FALSE;

void ShapeApp::freeData()
{
//delete m_pIShell;
//m_pIShell= NULL;

madhu,
IGRAPHICS_DrawCircle will return 0 if success,
Remove ! from if(!IGRAPHICS_DrawCircle(pg,&c)) and check, it will work

madhu,
IGRAPHICS_DrawCircle will return 0 if success,
Remove ! from if(!IGRAPHICS_DrawCircle(pg,&c)) and check, it will work