SophiaFramework UNIVERSE 5.3 |
Table 12.1. Grid and Pixel Classes
Class Nme | Shape Type | Description |
---|---|---|
SFXGrid | Point (Grid) | Class which represents the grid coordinates. |
SFXPixel | Image element (Pixel) | Class which represents a pixel coordinate. |
Comparing to the "Go" game or the Japanese Chess game, the drawing plain is like the playing board, the grid is like the place to put the "Go" stone, and the pixel is like the place to put the piece of the Japanese Chess game.
Example 12.4. Get the coordinate of grid
SInt32 x = grid.GetX(); // x = 10 SInt32 y = grid.GetY(); // y = 20
Example 12.6. Operate the grid
// move point 3 grids right grid.AddX(3); // move point 3 grids left and 3 grids down grid.Add(-3, 3);
Example 12.7. Draw the grid
SFXGraphicsPtr graphics = SFXGraphics::GetInstance(); // draw text (grid is drawing position) // DrawText function does not take SFXPixel instance as argument graphics->DrawText("drawing", grid); // draw image: at (10, 20) top-left // image: SFBImageSmp type image->Draw(SFXGrid(10, 20));
Example 12.9. Draw the pixel
SFXGraphicsPtr graphics = SFXGraphics::GetInstance();
// DrawPixel function does not take SFXGrid instance as argument
graphics->DrawPixel(pixel);
Get the coordinate of pixel
SInt32 x = pixel.GetX(); // x = 10 SInt32 y = pixel.GetY(); // y = 20
Example 12.11. Operate the pixel
SFXPixel pixel(10, 20); SFXGraphicsPtr graphics = SFXGraphics::GetInstance(); SInt32 i; for (i = 0; i < 50; ++i) { // draw pixel graphics->DrawPixel(pixel, SFXRGBColor(0x00, 0x00, 0x00, 0x00)); // move point 3 pixels right pixel.AddX(3); } for (i = 0; i < 50; ++i) { // draw point graphics->DrawPixel(pixel, SFXRGBColor(0x00, 0x00, 0x00, 0x00)); // move point 3 pixels left and 3 pixels down pixel.Offset(-3, 3); }
Copyright(c) 2002 - 2024 Sophia Cradle Incorporated All Rights Reserved. |