_tests/fsBitBlt/main.cpp

00001 
00002 //---------------------------------------------------------------------------
00003 #include <fs/ras/fsBitBlt.h>
00004 
00005 #include <stdio.h> // printf
00006 #include <memory.h> // memset
00007 //---------------------------------------------------------------------------
00008 int main()
00009 {
00010     using namespace fs::ras;
00011     
00012     const unsigned char aSrcData[9 * 3] = {
00013      1, 1, 1,   2, 2, 2,   3, 3, 3,
00014      4, 4, 4,   5, 5, 5,   6, 6, 6,
00015      7, 7, 7,   8, 8, 8,   9, 9, 9,
00016     };
00017     unsigned char aDstData[9 * 3];
00018     
00019     ::printf("--- original image data ---");
00020     for(int i = 0; i < 9 * 3; ++i) { if(i % 3 == 0) printf(" ");
00021      if(i % 9 == 0) printf("\n"); ::printf("%d", aSrcData[i]); }
00022         
00023     ::memset(aDstData, 0, sizeof(aDstData));
00024     BitBlt<nsBitBlt::Cl888CpPcy_t>(
00025      reinterpret_cast<const nsBitBlt::PxFmt888_t *>(aSrcData),
00026      3, 3, // src size
00027      0, 0, 3, 3, // src pos, reg size
00028      reinterpret_cast<nsBitBlt::PxFmt888_t *>(aDstData),
00029      3, 3, // dst size
00030      -1, -1 // dst pos
00031     );
00032     
00033     ::printf("\n--- move [-1, -1] ---");
00034     for(int i = 0; i < 9 * 3; ++i) { if(i % 3 == 0) printf(" ");
00035     if(i % 9 == 0) printf("\n"); ::printf("%d", aDstData[i]); }
00036         
00037     ::memset(aDstData, 0, sizeof(aDstData));
00038     BitBlt<nsBitBlt::Cl888CpPcy_t>(
00039      reinterpret_cast<const nsBitBlt::PxFmt888_t *>(aSrcData),
00040      3, 3, // src size
00041      0, 0, 2, 2, // src pos, reg size
00042      reinterpret_cast<nsBitBlt::PxFmt888_t *>(aDstData),
00043      3, 3, // dst size
00044      0, 0, // dst pos
00045      1, 0, 2, 3 // clipping
00046     );
00047     
00048     ::printf("\n--- smaller region [2, 2] & clip x~<1, 2) y~<0, 3) ---");
00049     for(int i = 0; i < 9 * 3; ++i) { if(i % 3 == 0) printf(" ");
00050     if(i % 9 == 0) printf("\n"); ::printf("%d", aDstData[i]); }
00051     printf("\n");
00052     
00053     return 0;
00054 }
00055 //---------------------------------------------------------------------------
00056 // --- original image data ---
00057 // 111 222 333
00058 // 444 555 666
00059 // 777 888 999
00060 // --- move [-1, -1] ---
00061 // 555 666 000
00062 // 888 999 000
00063 // 000 000 000
00064 // --- smaller region [2, 2] & clip x~<1, 2) y~<0, 3) ---
00065 // 000 222 000
00066 // 000 555 000
00067 // 000 000 000
00068 //---------------------------------------------------------------------------

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