aseprite/src/raster/layer.h

92 lines
2.8 KiB
C
Raw Normal View History

2007-11-16 18:25:45 +00:00
/* ASE - Allegro Sprite Editor
* Copyright (C) 2001-2009 David 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
*/
2009-08-17 21:38:00 +00:00
#ifndef RASTER_LAYER_H_INCLUDED
#define RASTER_LAYER_H_INCLUDED
2007-09-18 23:57:02 +00:00
#include "jinete/jbase.h"
2007-09-18 23:57:02 +00:00
#include "raster/gfxobj.h"
class Cel;
class Image;
class 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
class Layer : public GfxObj
2007-09-18 23:57:02 +00:00
{
public:
2008-03-23 02:08:06 +00:00
char name[LAYER_NAME_SIZE]; /* layer name */
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(int type, Sprite* sprite);
virtual ~Layer();
2007-09-18 23:57:02 +00:00
};
Layer* layer_new(Sprite* sprite);
Layer* layer_set_new(Sprite* sprite);
Layer* layer_new_copy(Sprite* dst_sprite, const Layer* src_layer);
Layer* layer_new_flatten_copy(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);
void layer_get_cels(const Layer* layer, JList cels);
2007-09-18 23:57:02 +00:00
/* for LAYER_IMAGE */
void layer_add_cel(Layer* layer, Cel *cel);
void layer_remove_cel(Layer* layer, Cel *cel);
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);
2007-09-18 23:57:02 +00:00
void layer_render(const Layer* layer, Image *image, int x, int y, int frame);
2007-09-18 23:57:02 +00:00
2009-08-17 21:38:00 +00:00
#endif