home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / xicon05.zip / generic.c < prev    next >
C/C++ Source or Header  |  1993-05-06  |  2KB  |  68 lines

  1. /* This file is generic.c (part of XIcon)
  2.  *
  3.  * Copyright (C) 1993 by Norman Walsh
  4.  *
  5.  *   This program is free software; you can redistribute it and/or modify
  6.  *   it under the terms of the GNU General Public License as published by
  7.  *   the Free Software Foundation; either version 2 of the License, or
  8.  *   (at your option) any later version.
  9.  *
  10.  *   This program is distributed in the hope that it will be useful,
  11.  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  *   GNU General Public License for more details.
  14.  *
  15.  *   You should have received a copy of the GNU General Public License
  16.  *   along with this program; if not, write to the Free Software
  17.  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  ************************************************************************/
  19.  
  20. #include <stdio.h>
  21. #include "iconvars.h"
  22. #include "icondata.h"
  23.  
  24. bitmap_info init_empty_map (int width, int height, int bits)
  25. {
  26.   bitmap_info m;
  27.   BYTE *ch;
  28.   int count;
  29.  
  30.   m.width = width;
  31.   m.height = height;
  32.   m.bits_per_pixel = bits;
  33.   m.bytewidth = ((width*bits)+7) / 8;
  34.   m.size = m.bytewidth * m.height;
  35.   m.num_colors = 2 << (bits - 1);
  36.   m.palette = NULL;
  37.   m.map = (BYTE *) malloc (m.size);
  38.  
  39.   for (count = 0, ch = m.map; count < m.size; count++, ch++)
  40.     *ch = 0;
  41.   
  42.   return m;
  43. }
  44.  
  45. bitmap_info init_generic_map()
  46. {
  47.   bitmap_info m;
  48.  
  49.   m.width = 0;
  50.   m.height = 0;
  51.   m.bits_per_pixel = 0;
  52.   m.size = 0;
  53.   m.bytewidth = 0;
  54.   m.num_colors = 0;
  55.   m.palette = NULL;
  56.   m.map = NULL;
  57.  
  58.   return m;
  59. }
  60.  
  61. void init_generic (int count)
  62. {
  63.   generic[count].and_map = init_generic_map();
  64.   generic[count].xor_map = init_generic_map();
  65.   generic[count].clr_map = init_generic_map();
  66. }
  67.  
  68.