Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Erasing a region

In this example, the application has drawn a cursor on the screen, which the user can move by pressing keys. To move the cursor, the application erases the region that currently contains the cursor, then draws the cursor in the new location and updates the screen.

AEEImageInfo iInfo;  
int min, max;
int x = pMe->nCursorX; // x & y are initialized w/coordinates of the current
int y = pMe->nCursorY; // cursor position

// IImage_GetInfo gets the image information
IImage_GetInfo (pMe->pIImage, &iInfo);  
IDisplay_EraseRgn (pMe->pIDisplay, x, y,
            iInfo.cx,  iInfo.cy); // erases the region where 
                                  // the cursor was previously displayed                           
x += xc;    
y += yc;   // Delimit the x & y coordinates to lower half of the screen
min = 0; 
max = pMe->nWidth - iInfo.cx;  
x = ((x < min) ? (min) : (x > max) ? max : (x));   
min = pMe->nHeight/2;  
max = pMe->nHeight - iInfo.cy;  
y = ((y < min) ? (min) : (y > max) ? max : (y)); 
IImage_Draw (pMe->pIImage, x, y);  // Draw the cursor at new coordinates
pMe->nCursorX  = x;   // Store new x coordinate
pMe->nCursorY = y;   // Store new y coordinate

IDisplay_Update(pMe->pIDisplay);      // Update display