00001 00007 /* 00008 Copyright (C) 1998 Jeffrey S. Freedman 00009 00010 This library is free software; you can redistribute it and/or 00011 modify it under the terms of the GNU Library General Public 00012 License as published by the Free Software Foundation; either 00013 version 2 of the License, or (at your option) any later version. 00014 00015 This library is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 Library General Public License for more details. 00019 00020 You should have received a copy of the GNU Library General Public 00021 License along with this library; if not, write to the 00022 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00023 Boston, MA 02111-1307, USA. 00024 */ 00025 00026 #ifdef HAVE_CONFIG_H 00027 # include <config.h> 00028 #endif 00029 00030 #include "imagebuf.h" 00031 00032 /* 00033 * Create buffer. 00034 */ 00035 00036 Image_buffer::Image_buffer 00037 ( 00038 unsigned int w, // Desired width, height. 00039 unsigned int h, 00040 int dpth // Depth (bits/pixel). 00041 ) : width(w), height(h), depth(dpth), bits(0), line_width(w), 00042 clipx(0), clipy(0), 00043 clipw(w), cliph(h) 00044 { 00045 switch (depth) // What depth? 00046 { 00047 case 8: 00048 pixel_size = 1; break; 00049 case 15: 00050 case 16: 00051 pixel_size = 2; break; 00052 case 32: 00053 pixel_size = 4; break; 00054 } 00055 } 00056 00057
1.5.1