fs/_tests/fsDraw/main.cpp

Go to the documentation of this file.
00001 
00002 //---------------------------------------------------------------------------
00003 #include <fs/ras/fsDraw.h>
00004 
00005 #include <stdio.h> // putchar
00006 #include <cassert>
00007 //---------------------------------------------------------------------------
00008 int main()
00009 {
00010     using namespace fs::ras;
00011     
00012     // simulate a RGBA-8888 bitmap surface
00013     const int w = 60;
00014     const int h = 20;
00015     nsDraw::PxFmt8888_t aData[w * h] = { 0 };
00016     
00017     const nsDraw::PxFmt8888_t Clr = { 255, 255, 255, 255 };
00018     
00019     // draw a line
00020     DrawLine<nsDraw::Cl8888DwPcy_t>(0, 0, w - 1, h - 1, Clr, aData, w, h);
00021     
00022     // draw two circles
00023     DrawCirc<nsDraw::Cl8888DwPcy_t>(w/2, h/2, h/2 - 1, Clr, aData, w, h);
00024     DrawCirc<nsDraw::Cl8888DwPcy_t>(w/2, h/2, h/4, Clr, aData, w, h);
00025     
00026     // show the surface
00027     for(int y = 0; y < h; ++y)
00028     {
00029         for(int x = 0; x < w; ++x)
00030         {
00031             ::putchar(aData[y * w + x].a ? 'o' : '.');
00032         }
00033         ::putchar('\n');
00034     }
00035 
00036     return 0;
00037 }
00038 //---------------------------------------------------------------------------
00039 //oo..........................................................
00040 //..ooo.......................ooooo...........................
00041 //.....ooo..................oo.....oo.........................
00042 //........ooo.............oo.........oo.......................
00043 //...........ooo.........o.............o......................
00044 //..............oooo.....o....ooooo....o......................
00045 //..................ooo.o....o.....o....o.....................
00046 //.....................ooo..o.......o...o.....................
00047 //.....................o..ooo........o...o....................
00048 //.....................o...o.ooo.....o...o....................
00049 //.....................o...o....ooo..o...o....................
00050 //.....................o...o.......ooo...o....................
00051 //.....................o...o.........ooooo....................
00052 //......................o...o.......o...oooo..................
00053 //......................o....o.....o....o...oooo..............
00054 //.......................o....ooooo....o........ooo...........
00055 //.......................o.............o...........ooo........
00056 //........................oo.........oo...............ooo.....
00057 //..........................oo.....oo....................ooo..
00058 //............................ooooo.........................oo
00059 //---------------------------------------------------------------------------

FipS' Code (Thu Feb 15 22:43:35 2007) - (c) Filip STOKLAS (FipS) - [ www ] [ Guest Book ]