#include "Painter.class.h" void CPainter::print(int outtype, int** outarray, int x_width, int y_height){ switch(outtype){ case 1: CPainter::printASCIIMandelbrot(outarray, x_width, y_height); break; case 2: CPainter::printPIXELMandelbrot(outarray, x_width, y_height); break; default: printf("Keine Ausgabe!\n"); } } void CPainter::printASCIIMandelbrot(int** outarray, int x_width, int y_height){ for(int i=0;iformat, R, G, B); if ( SDL_MUSTLOCK(screen) ) { if ( SDL_LockSurface(screen) < 0 ) { return; } } switch (screen->format->BytesPerPixel) { case 1: { /* vermutlich 8 Bit */ Uint8 *bufp; bufp = (Uint8 *)screen->pixels + y*screen->pitch + x; *bufp = color; } break; case 2: { /* vermutlich 15 Bit oder 16 Bit */ Uint16 *bufp; bufp = (Uint16 *)screen->pixels + y*screen->pitch/2 + x; *bufp = color; } break; case 3: { /* langsamer 24-Bit-Modus, selten verwendet */ Uint8 *bufp; bufp = (Uint8 *)screen->pixels + y*screen->pitch + x * 3; if(SDL_BYTEORDER == SDL_LIL_ENDIAN) { bufp[0] = color; bufp[1] = color >> 8; bufp[2] = color >> 16; } else { bufp[2] = color; bufp[1] = color >> 8; bufp[0] = color >> 16; } } break; case 4: { /* vermutlich 32 Bit */ Uint32 *bufp; bufp = (Uint32 *)screen->pixels + y*screen->pitch/4 + x; *bufp = color; } break; } if ( SDL_MUSTLOCK(screen) ) { SDL_UnlockSurface(screen); } }