/usr/include/synfig-1.0/synfig/target.h is in libsynfig-dev 1.0.2-1.
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 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | /* === S Y N F I G ========================================================= */
/*! \file target.h
** \brief Target Class Implementation
**
** $Id$
**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
** Copyright (c) 2007 Chris Moore
** Copyright (c) 2010 Diego Barrios Romero
**
** This package 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 package 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.
** \endlegal
*/
/* ========================================================================= */
/* === S T A R T =========================================================== */
#ifndef __SYNFIG_TARGET_H
#define __SYNFIG_TARGET_H
/* === H E A D E R S ======================================================= */
#include <sigc++/signal.h>
#include "string.h"
#include <utility>
#include <map>
#include <ETL/handle>
#include "renddesc.h"
#include "color.h"
#include "canvas.h"
#include "targetparam.h"
/* === M A C R O S ========================================================= */
//! Defines various variables and the create method, common for all Targets.
//! To be used in the private part of the target class definition.
#define SYNFIG_TARGET_MODULE_EXT \
public: static const char name__[], version__[], ext__[], cvs_id__[];\
static Target* create (const char *filename, synfig::TargetParam p);
//! Sets the name of the target
#define SYNFIG_TARGET_SET_NAME(class,x) const char class::name__[]=x
//! Sets the primary file extension of the target
#define SYNFIG_TARGET_SET_EXT(class,x) const char class::ext__[]=x
//! Sets the version of the target
#define SYNFIG_TARGET_SET_VERSION(class,x) const char class::version__[]=x
//! Sets the CVS ID of the target
#define SYNFIG_TARGET_SET_CVS_ID(class,x) const char class::cvs_id__[]=x
//! Defines implementation of the create method for the target
//! \param filename The file name to be created by the target.
//! \param p The parameters passed to the target (bit rate and vcodec)
#define SYNFIG_TARGET_INIT(class) \
synfig::Target* class::create (const char *filename, \
synfig::TargetParam p) \
{ return new class(filename, p); }
/* === T Y P E D E F S ===================================================== */
/* === C L A S S E S & S T R U C T S ======================================= */
namespace synfig {
class Surface;
class CairoSurface;
class RendDesc;
class Canvas;
class ProgressCallback;
struct TargetParam;
enum TargetAlphaMode
{
TARGET_ALPHA_MODE_KEEP, // 0
TARGET_ALPHA_MODE_FILL, // 1
TARGET_ALPHA_MODE_REDUCE, // 2
TARGET_ALPHA_MODE_EXTRACT // 3
}; // END enum TargetAlphaMode
/*! \class Target
** \brief Used to produce rendered animations of the documents
**
* It is the base class for all the target renderers. It defines the has a static Book
* pointer class that is a map for the targets factory creators and the strings
* of the extension that the renderer can understand. It allows to create the a
* pointer to a particular renderer just by using the extension of the name of file
* to import. Also it creates a virtual member render() that must be declared in
* the inherited classes.
*/
class Target : public etl::shared_object
{
public:
typedef etl::handle<Target> Handle;
typedef etl::loose_handle<Target> LooseHandle;
typedef etl::handle<const Target> ConstHandle;
/*
-- ** -- S I G N A L S -------------------------------------------------------
*/
private:
sigc::signal<void> signal_progress_;
/*
-- ** -- S I G N A L I N T E R F A C E -------------------------------------
*/
public:
sigc::signal<void>& signal_progress() { return signal_progress_; }
/*
-- ** -- C O N S T R U C T O R S ---------------------------------------------
*/
public:
//! Type that represents a pointer to a Target's constructor.
/*! As a pointer to the constructor, it represents a "factory" of targets.
** Receives the output filename (including path) and the parameters of the target.
*/
typedef Target* (*Factory)(const char *filename, TargetParam p);
struct BookEntry
{
Factory factory;
String filename; ///< Output filename including path
TargetParam target_param; ///< Target module parameters
};
//! Book of types of targets indexed by the name of the Target.
typedef std::map<String,BookEntry> Book;
//! Book of types of targets indexed by the file extension
typedef std::map<String,String> ExtBook;
//! Target Book, indexed by the target's name
static Book* book_;
//! Map of target names indexed by associated file extension
static ExtBook* ext_book_;
static Book& book();
static ExtBook& ext_book();
//! Initializes the Target module by creating a book of targets names
//! and its creators
static bool subsys_init();
//! Stops the Target module by deleting the book and the extension book
static bool subsys_stop();
//! Adjusted Render description set by set_rend_desc()
RendDesc desc;
//! Canvas being rendered in this target module
/*!
** \sa set_canvas()
*/
etl::handle<Canvas> canvas;
//! Render quality used for the render process of the target.
int quality_;
//! Gamma value used for the render process of the target
Gamma gamma_;
//! Tells how to handle alpha. Used by non alpha supported targets to decide if the background must be filled or not
TargetAlphaMode alpha_mode;
//! When set to true, the target doesn't sync to canvas time.
bool avoid_time_sync_;
//! The current frame being rendered
int curr_frame_;
protected:
//! Default constructor
Target();
public:
virtual ~Target() { }
//! Gets the target quality
int get_quality()const { return quality_; }
//! Sets the target quality
void set_quality(int q) { quality_=q; }
//! Sets the target avoid time synchronization
void set_avoid_time_sync(bool x=true) { avoid_time_sync_=x; }
//! Gets the target avoid time synchronization
bool get_avoid_time_sync()const { return avoid_time_sync_; }
//! Tells how to handle alpha
/*! Used by non alpha supported targets to decide if the background
** must be filled or not
*/
TargetAlphaMode get_alpha_mode()const { return alpha_mode; }
//! Sets how to handle alpha
void set_alpha_mode(TargetAlphaMode x=TARGET_ALPHA_MODE_KEEP) { alpha_mode=x; }
Gamma &gamma() { return gamma_; }
//! Sets the target gamma
const Gamma &gamma()const { return gamma_; }
//! Sets the target canvas. Must be defined by derived targets
virtual void set_canvas(etl::handle<Canvas> c);
//! Gets the target canvas.
const etl::handle<Canvas> &get_canvas()const { return canvas; }
//! Gets the target particular render description
RendDesc &rend_desc() { return desc; }
//! Gets the target particular render description
const RendDesc &rend_desc()const { return desc; }
//! Sets the RendDesc for the Target to \a desc.
/*! If there are any parts of \a desc that the render target
** is not capable of doing, the render target will adjust
** \a desc to fit its needs.
** \param d an RendDesc pointer.
** \return true on success
*/
virtual bool set_rend_desc(RendDesc *d) { desc=*d; return true; }
//! Renders the canvas to the target
virtual bool render(ProgressCallback *cb=NULL)=0;
//! Initialization tasks of the derived target.
/*!
** \returns true if the initialization has no errors
*/
virtual bool init(ProgressCallback *cb=NULL) { (void)cb; return true; }
//! Creates a new Target described by \a type, outputting to a file described by \a filename.
static Handle create(const String &type, const String &filename,
synfig::TargetParam params);
//! Sets the time for the next frame at \a time
/*! It modifies the curr_frame_ member which has to be set to zero when next_frame is called for the first time
** \param time The time reference to be modified
** \return The number of remainig frames to render
** \sa curr_frame_
*/
virtual int next_frame(Time& time);
}; // END of class Target
}; // END of namespace synfig
/* === E N D =============================================================== */
#endif
|