2007-11-16 18:25:45 +00:00
|
|
|
/* ASE - Allegro Sprite Editor
|
2007-09-18 23:57:02 +00:00
|
|
|
* Copyright (C) 2001-2005, 2007 David A. Capello
|
|
|
|
*
|
|
|
|
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef RASTER_DIRTY_H
|
|
|
|
#define RASTER_DIRTY_H
|
|
|
|
|
|
|
|
struct Brush;
|
|
|
|
struct Image;
|
|
|
|
struct Mask;
|
|
|
|
|
|
|
|
#define DIRTY_VALID_COLUMN 1
|
|
|
|
#define DIRTY_MUSTBE_UPDATED 2
|
|
|
|
|
|
|
|
#define IMAGE_ADDRESS(d,x,y) \
|
|
|
|
((void *)((d)->imgtype == IMAGE_RGB)? \
|
|
|
|
(void *)(((unsigned long **)(d)->line)[(y)]+(x)): \
|
|
|
|
((d)->imgtype == IMAGE_GRAYSCALE)? \
|
|
|
|
(void *)(((unsigned short **)(d)->line)[(y)]+(x)): \
|
|
|
|
((d)->imgtype == IMAGE_INDEXED)? \
|
|
|
|
(void *)(((unsigned char **)(d)->line)[(y)]+(x)): 0)
|
|
|
|
|
|
|
|
#define IMAGE_SHIFT(d) \
|
|
|
|
(((d)->imgtype == IMAGE_RGB)? 2: \
|
|
|
|
((d)->imgtype == IMAGE_GRAYSCALE)? 1: 0)
|
|
|
|
|
|
|
|
#define IMAGE_LINE_SIZE(image, width) \
|
|
|
|
((width) << IMAGE_SHIFT (image))
|
|
|
|
|
|
|
|
#define DIRTY_LINE_SIZE(width) \
|
|
|
|
(IMAGE_LINE_SIZE (dirty->image, width))
|
|
|
|
|
|
|
|
typedef struct Dirty Dirty;
|
|
|
|
|
|
|
|
struct Dirty
|
|
|
|
{
|
|
|
|
struct Image *image;
|
|
|
|
int x1, y1;
|
|
|
|
int x2, y2;
|
|
|
|
int tiled;
|
|
|
|
int rows;
|
|
|
|
struct DirtyRow {
|
|
|
|
int y;
|
|
|
|
int cols;
|
|
|
|
struct DirtyCol {
|
|
|
|
int x, w;
|
|
|
|
char flags;
|
|
|
|
void *data;
|
|
|
|
void *ptr;
|
|
|
|
} *col;
|
|
|
|
} *row;
|
|
|
|
struct Mask *mask;
|
|
|
|
};
|
|
|
|
|
|
|
|
Dirty *dirty_new(struct Image *image, int x1, int y1, int x2, int y2, int tiled);
|
|
|
|
Dirty *dirty_new_copy(Dirty *src);
|
|
|
|
void dirty_free(Dirty *dirty);
|
|
|
|
|
|
|
|
void dirty_putpixel(Dirty *dirty, int x, int y);
|
|
|
|
void dirty_hline(Dirty *dirty, int x1, int y, int x2);
|
|
|
|
void dirty_vline(Dirty *dirty, int x, int y1, int y2);
|
|
|
|
void dirty_line(Dirty *dirty, int x1, int y1, int x2, int y2);
|
|
|
|
void dirty_rect(Dirty *dirty, int x1, int y1, int x2, int y2);
|
|
|
|
void dirty_rectfill(Dirty *dirty, int x1, int y1, int x2, int y2);
|
|
|
|
|
|
|
|
/* void dirty_putpixel_thick(Dirty *dirty, int x, int y, int thickness); */
|
|
|
|
/* void dirty_line_thick(Dirty *dirty, int x1, int y1, int x2, int y2, int thickness); */
|
|
|
|
|
|
|
|
void dirty_putpixel_brush(Dirty *dirty, struct Brush *brush, int x, int y);
|
|
|
|
void dirty_hline_brush(Dirty *dirty, struct Brush *brush, int x1, int y, int x2);
|
|
|
|
void dirty_line_brush(Dirty *dirty, struct Brush *brush, int x1, int y1, int x2, int y2);
|
|
|
|
|
|
|
|
/* void dirty_optimize (Dirty *dirty); */
|
|
|
|
|
|
|
|
void dirty_get(Dirty *dirty);
|
|
|
|
void dirty_put(Dirty *dirty);
|
|
|
|
void dirty_swap(Dirty *dirty);
|
|
|
|
|
|
|
|
#endif /* RASTER_DIRTY_H */
|
|
|
|
|