/* Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ // // Image.cxx // #include #include #include #include #include #include #include #include #include #include "Image.h" #include #include #include #include class ImageCleanup { public: std::list images; ~ImageCleanup() { fprintf(stderr,"~ImageCleanup called\n"); while (!images.empty()) { delete images.front(); } } }; ImageCleanup imageCleanup; Image::Image(int width, int height) : data(0) { data = new char[width*height*4]; //default image will be three lines across the screen. this->width = width; this->height = height; for (int i = 0; i < width*(height/3)*4; i++) { if ((i % 4) == 0){ data[i] = 255; } } for (int i = width*(height/3)*4 + 1; i < width*(2*height/3)*4; i++) { if (((i + 3) % 4) == 0){ data[i] = 255; } } for (int i = width*(2*height/3)*4 + 1; i < width*(height)*4; i++) { if (((i + 2) % 4) == 0){ data[i] = 255; } } } Image::~Image() { delete [] data; }