aseprite/src/raster/layer.h

90 lines
2.8 KiB
C
Raw Normal View History

2007-11-16 18:25:45 +00:00
/* ASE - Allegro Sprite Editor
2008-02-10 12:52:15 +00:00
* Copyright (C) 2001-2008 David A. Capello
2007-09-18 23:57:02 +00:00
*
* 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_LAYER_H
#define RASTER_LAYER_H
#include "jinete/jbase.h"
2007-09-18 23:57:02 +00:00
#include "raster/gfxobj.h"
2007-11-16 20:49:40 +00:00
struct Cel;
2007-09-18 23:57:02 +00:00
struct Image;
struct Sprite;
2007-09-18 23:57:02 +00:00
2008-03-23 02:08:06 +00:00
#define LAYER_NAME_SIZE 256
#define LAYER_IS_READABLE 0x0001
#define LAYER_IS_WRITABLE 0x0002
#define LAYER_IS_LOCKMOVE 0x0004
#define LAYER_IS_BACKGROUND 0x0008
typedef struct Layer Layer;
struct Layer
2007-09-18 23:57:02 +00:00
{
GfxObj gfxobj;
2008-03-23 02:08:06 +00:00
char name[LAYER_NAME_SIZE]; /* layer name */
struct Sprite *sprite; /* owner of the layer */
Layer *parent_layer; /* parent layer */
unsigned short flags;
2007-09-18 23:57:02 +00:00
/* for GFXOBJ_LAYER_IMAGE */
int blend_mode; /* constant blend mode */
2007-11-16 20:49:40 +00:00
JList cels; /* list of cels */
2007-09-18 23:57:02 +00:00
/* for GFXOBJ_LAYER_SET */
JList layers;
};
Layer *layer_new(struct Sprite *sprite);
Layer *layer_set_new(struct Sprite *sprite);
Layer *layer_new_copy(struct Sprite *dst_sprite, const Layer *src_layer);
Layer *layer_new_flatten_copy(struct Sprite *dst_sprite, const Layer *src_layer,
int x, int y, int w, int h, int frmin, int frmax);
void layer_free(Layer *layer);
void layer_free_images(Layer *layer);
void layer_configure_as_background(Layer *layer);
2007-09-18 23:57:02 +00:00
bool layer_is_image(const Layer *layer);
bool layer_is_set(const Layer *layer);
bool layer_is_background(const Layer *layer);
bool layer_is_moveable(const Layer *layer);
bool layer_is_readable(const Layer *layer);
bool layer_is_writable(const Layer *layer);
Layer *layer_get_prev(Layer *layer);
Layer *layer_get_next(Layer *layer);
2007-09-18 23:57:02 +00:00
void layer_set_name(Layer *layer, const char *name);
void layer_set_blend_mode(Layer *layer, int blend_mode);
2007-09-18 23:57:02 +00:00
/* for LAYER_IMAGE */
2007-11-16 20:49:40 +00:00
void layer_add_cel(Layer *layer, struct Cel *cel);
void layer_remove_cel(Layer *layer, struct Cel *cel);
struct Cel *layer_get_cel(const Layer *layer, int frame);
2007-09-18 23:57:02 +00:00
/* for LAYER_SET */
void layer_add_layer(Layer *set, Layer *layer);
void layer_remove_layer(Layer *set, Layer *layer);
void layer_move_layer(Layer *set, Layer *layer, Layer *after);
void layer_render(const Layer *layer, struct Image *image, int x, int y, int frame);
2007-09-18 23:57:02 +00:00
#endif /* RASTER_LAYER_H */