/usr/include/ClanLib-1.0/ClanLib/Display/sprite_description.h is in libclanlib-dev 1.0~svn3827-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | /*
** ClanLib SDK
** Copyright (c) 1997-2005 The ClanLib Team
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any damages
** arising from the use of this software.
**
** Permission is granted to anyone to use this software for any purpose,
** including commercial applications, and to alter it and redistribute it
** freely, subject to the following restrictions:
**
** 1. The origin of this software must not be misrepresented; you must not
** claim that you wrote the original software. If you use this software
** in a product, an acknowledgment in the product documentation would be
** appreciated but is not required.
** 2. Altered source versions must be plainly marked as such, and must not be
** misrepresented as being the original software.
** 3. This notice may not be removed or altered from any source distribution.
**
** Note: Some of the libraries ClanLib may link to may have additional
** requirements or restrictions.
**
** File Author(s):
**
** Magnus Norddahl
** (if your name is missing here, please add it)
*/
//! clanDisplay="Sprites"
//! header=display.h
#ifndef header_sprite_description
#define header_sprite_description
#ifdef CL_API_DLL
#ifdef CL_DISPLAY_EXPORT
#define CL_API_DISPLAY __declspec(dllexport)
#else
#define CL_API_DISPLAY __declspec(dllimport)
#endif
#else
#define CL_API_DISPLAY
#endif
#if _MSC_VER > 1000
#pragma once
#endif
#ifdef _MSC_VER
#pragma warning( disable : 4786)
#endif
#include <string>
#include <map>
#include <list>
#include "../Core/Math/rect.h"
#include "surface.h"
class CL_ResourceManager;
class CL_PixelBuffer;
class CL_SpriteDescription_Generic;
//: This class contains everything to construct a sprite - its data, default settings etc.
//- !group=Display/Sprites!
//- !header=display.h!
//- <p>CL_SpriteDescription is used by CL_Sprite to construct itself based
//- on the description. The description class give a big flexibility
//- creating a sprite, individual frames can come from different image
//- sources, or be cut out from an image source using various different
//- techniques.</p>
class CL_API_DISPLAY CL_SpriteDescription
{
//! Construction:
public:
//: Constructs a sprite description.
//param resource_id: Resource name of a sprite description resource.
//param resources: Resource manager used to load resource.
CL_SpriteDescription(const std::string &resource_id, CL_ResourceManager *resources);
CL_SpriteDescription();
CL_SpriteDescription(const CL_SpriteDescription ©);
~CL_SpriteDescription();
//! Attributes:
public:
//: CL_PixelBuffer provider, CL_Rect position.
typedef std::pair<CL_PixelBuffer, CL_Rect> FramePair;
//: Returns a list over all available frames.
const std::list<FramePair> &get_frames() const;
//: Returns the surface flag to be used.
int get_surface_flag() const;
//! Operations:
public:
//: Copy assignment operator.
CL_SpriteDescription &operator =(const CL_SpriteDescription ©);
//: Sets what surface flag CL_Sprite should use for its surfaces.
void set_surface_flag(int flag);
//: Adds a single image.
//param provider: Image source.
//param delete_provider: If true, deletes provider when sprite description is destroyed.
void add_frame(CL_PixelBuffer provider);
//: Adds images formed in a grid.
//- <p>This function will cut out a grid of frames from one image.</p>
//param provider: Image source.
//param xpos, ypos: Position of where image grid starts.
//param width, height: Size of a frame in the grid.
//param xarray, yarray: Number of columns and rows in grid.
//param array_skipframes: Number of frames to skip at last gridline.
//param xspacing, yspacing: Pixel interspacing between grid frames.
//param delete_provider: If true, deletes provider when sprite description is destroyed.
void add_gridclipped_frames(CL_PixelBuffer provider, int xpos, int ypos, int width, int height, int xarray = 1, int yarray = 1, int array_skipframes = 0, int xspacing = 0, int yspacing = 0);
//: Adds images separated with pure alpha (within trans_limit).
//- <p>The alpha clipper will cut out frames from an image based on
//- the transparency in the picture. It first determines the height
//- of a row by searching for the first line that it considers
//- completely transparent. Then it finds the width of each frame on
//- this line by looking for columns that are completely transparency.</p>
//param provider: Image source.
//param xpos, ypos: Upper left position where alpha cutting should begin.
//param trans_limit: Amount of non-transparent alpha allowed before a pixel is not considered transparent.
//param delete_provider: If true, deletes provider when sprite description is destroyed.
void add_alphaclipped_frames(CL_PixelBuffer provider, int xpos = 0, int ypos = 0, float trans_limit = 0.05f);
//: Adds images separated with pure alpha (within trans_limit).
//- <p>The alpha clipper will cut out frames from an image based on
//- the transparency in the picture. It scans the lines horizontally
//- from top to bottom. As soon as a non-transarent pixel is discovered,
//- the clipper finds the bounding box for that region and then moves on.</p>
//param provider: Image source.
//param xpos, ypos: Upper left position where alpha cutting should begin.
//param trans_limit: Amount of non-transparent alpha allowed before a pixel is not considered transparent.
//param delete_provider: If true, deletes provider when sprite description is destroyed.
void add_alphaclipped_frames_free(CL_PixelBuffer provider, int xpos = 0, int ypos = 0, float trans_limit = 0.05f);
//: Adds images separated with palette-colours defining the boundaries.
//param provider: Image source.
//param xpos, ypos: Upper left position where cutting should begin.
//param delete_provider: If true, deletes provider when sprite description is destroyed.
void add_paletteclipped_frames(CL_PixelBuffer provider, int xpos = 0, int ypos = 0);
//! Implementation:
private:
//: SpriteDescription implementation.
CL_SpriteDescription_Generic *impl;
};
#endif
|