/************************************************************************** * * pbmtools.h -- Routines for dealing with portable bitmap files (PBM) * Copyright (C) 1994 Stuart Inglis * * This program 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 program 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 program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: pbmtools.h 3745 2003-02-20 21:20:24Z mdewsnip $ * **************************************************************************/ #ifndef __PBMTOOLS_H #define __PBMTOOLS_H #include "sysfuncs.h" #include "basictypes.h" #include "utils.h" #include "marklist.h" #define PBITS 32 #define PSH 5 /* The next two are ordered pixels col0=left, cols31=right */ /* #define pbm_getpixel(bitmap,c,r) \ ((bitmap[r][(c)>>PSH] >> ((PBITS-1)-((c)&(PBITS-1))))&1) #define pbm_putpixel(bitmap,c,r,val) \ if((val)) \ bitmap[r][(c)>>PSH] |= (((unsigned)1<<(PBITS-1)) >> ((c)&(PBITS-1))); \ else \ bitmap[r][(c)>>PSH] &= ~(((unsigned)1<<(PBITS-1)) >> ((c)&(PBITS-1))) */ /* The next two defines are ordered pixel cols0=right, cols31=left */ #define pbm_getpixel(bitmap,c,r) \ ((bitmap[r][(c)>>PSH] >> ((c)&(PBITS-1)))&1) #define pbm_putpixel(bitmap,c,r,val) \ if((val)) \ bitmap[r][(c)>>PSH] |= (1<<((c)&(PBITS-1))); \ else \ bitmap[r][(c)>>PSH] &= ~(1<<((c)&(PBITS-1))) #define pbm_putpixel_trunc(bitmap,c,r,val,cols,rows) \ if(((c)>=0)&&((c)=0)&&((r)=0)&&((c)=0)&&((r)