bitmap.h revision 9b3424d16d013c8b529dc32ca112e56f1cfe3208
/* Copyright (C) 2001-2007 Peter Selinger.
This file is part of Potrace. It is free software and it is covered
by the GNU General Public License. See the file COPYING for details. */
#ifndef BITMAP_H
#define BITMAP_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include <stdlib.h>
/* The bitmap type is defined in potracelib.h */
#include "potracelib.h"
/* The present file defines some convenient macros and static inline
functions for accessing bitmaps. Since they only produce inline
code, they can be conveniently shared by the library and frontends,
if desired */
/* ---------------------------------------------------------------------- */
/* some measurements */
#define BM_WORDSIZE ((int)sizeof(potrace_word))
#define BM_ALLBITS (~(potrace_word)0)
/* macros for accessing pixel at index (x,y). U* macros omit the
bounds check. */
#define bm_range(x, a) ((int)(x) >= 0 && (int)(x) < (a))
/* free the given bitmap. Leaves errno untouched. */
if (bm) {
}
}
/* return new un-initialized bitmap. NULL with errno on error */
static inline potrace_bitmap_t *bm_new(int w, int h) {
if (!bm) {
return NULL;
}
bm->w = w;
bm->h = h;
return NULL;
}
return bm;
}
/* clear the given bitmap. Set all bits to c. */
}
/* duplicate the given bitmap. Return NULL on error with errno set. */
if (!bm1) {
return NULL;
}
return bm1;
}
/* invert the given bitmap. */
int i;
}
}
#endif /* BITMAP_H */