41int main(
int argc,
char *argv[]) {
42 mjr::ramCanvas3c8b theRamCanvas;
43 theRamCanvas.setIntAxOrientationY(mjr::ramCanvas3c8b::intAxisOrientation::INVERTED);
46 std::cout <<
"ERROR argument required!" << std::endl;
51 if((rRet=theRamCanvas.readTIFFfile(argv[1]))) {
52 std::cout <<
"ERROR(" << rRet <<
") reading file " << argv[1] << std::endl;
56 rRet = SDL_Init(SDL_INIT_VIDEO);
58 std::cout <<
"ERROR: SDL_Init failed: " << SDL_GetError() << std::endl;
62 SDL_DisplayMode daDisplayMode;
63 rRet = SDL_GetDesktopDisplayMode(0, &daDisplayMode);
65 std::cout <<
"ERROR: SDL_GetDesktopDisplayMode failed: " << SDL_GetError() << std::endl;
69 if ((daDisplayMode.w-100) < theRamCanvas.getNumPixX()) {
70 std::cout <<
"ERROR: The display is not wide enough for image" << std::endl;
74 if ((daDisplayMode.h-200) < theRamCanvas.getNumPixY()) {
75 std::cout <<
"ERROR: The display is not tall enough for image" << std::endl;
80 SDL_Window* daSDLwindow;
81 SDL_Surface* daSDLsurface;
83 daSDLwindow = SDL_CreateWindow(
"ramCanvas Observer", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, theRamCanvas.getNumPixX(), theRamCanvas.getNumPixY(), SDL_WINDOW_SHOWN);
84 daSDLsurface = SDL_GetWindowSurface(daSDLwindow);
87 for (
int y=0; y<theRamCanvas.getNumPixY(); ++y)
88 for (
int x=0; x<theRamCanvas.getNumPixX(); ++x)
89 ((Uint32*)daSDLsurface->pixels)[(y*daSDLsurface->w) + x] = SDL_MapRGB(daSDLsurface->format, theRamCanvas.getPxColorNC(x, y).getRed_byte(), theRamCanvas.getPxColorNC(x, y).getGreen_byte(), theRamCanvas.getPxColorNC(x, y).getBlue_byte());
90 SDL_UpdateWindowSurface(daSDLwindow);
93 if (SDL_PollEvent(&daSDLevent) && daSDLevent.type == SDL_QUIT) {
94 SDL_DestroyWindow(daSDLwindow);