1
/* -*- mode: c; c-basic-offset: 4; -*-
3
* iterative-map.h - The IterativeMap object builds on the ParameterHolder and
4
* HistogramRender objects to provide a rendering of a chaotic
5
* map into a histogram image.
7
* Fyre - rendering and interactive exploration of chaotic functions
8
* Copyright (C) 2004-2005 David Trowbridge and Micah Dowty
10
* This program is free software; you can redistribute it and/or
11
* modify it under the terms of the GNU General Public License
12
* as published by the Free Software Foundation; either version 2
13
* of the License, or (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
#ifndef __ITERATIVE_MAP_H__
27
#define __ITERATIVE_MAP_H__
30
#include "histogram-imager.h"
34
#define ITERATIVE_MAP_TYPE (iterative_map_get_type ())
35
#define ITERATIVE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ITERATIVE_MAP_TYPE, IterativeMap))
36
#define ITERATIVE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ITERATIVE_MAP_TYPE, IterativeMapClass))
37
#define IS_ITERATIVE_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ITERATIVE_MAP_TYPE))
38
#define IS_ITERATIVE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ITERATIVE_MAP_TYPE))
40
typedef struct _IterativeMap IterativeMap;
41
typedef struct _IterativeMapClass IterativeMapClass;
43
struct _IterativeMap {
44
HistogramImager parent;
46
/* Current calculation state */
49
/* Estimated iterations per second, for calculate_timed and friends */
50
gdouble iter_speed_estimate;
52
/* For background rendering in the idle handler */
57
struct _IterativeMapClass {
58
HistogramImagerClass parent_class;
60
void (*iterative_map) (IterativeMap *self);
62
/* Overrideable methods */
63
void (*calculate) (IterativeMap *self,
65
void (*calculate_motion) (IterativeMap *self,
67
gboolean continuation,
68
ParameterInterpolator *interp,
69
gpointer interp_data);
72
/************************************************************************************/
73
/******************************************************************* Public Methods */
74
/************************************************************************************/
76
GType iterative_map_get_type ();
78
/* Simple calculation functions, implemented by subclasses.
79
* They calculate a fixed number of iterations.
81
void iterative_map_calculate (IterativeMap *self,
83
void iterative_map_calculate_motion (IterativeMap *self,
85
gboolean continuation,
86
ParameterInterpolator *interp,
87
gpointer interp_data);
89
/* Calculation functions implemented by this base class,
90
* that stop after an estimated amount of time rather
91
* than a number of iterations. Each time this runs,
92
* it uses the actual time elapsed to update an estimate
93
* of the calculation speed used to come up with a
94
* number of iterations to pass the actual rendering
97
void iterative_map_calculate_timed (IterativeMap *self,
99
void iterative_map_calculate_motion_timed (IterativeMap *self,
101
gboolean continuation,
102
ParameterInterpolator *interp,
103
gpointer interp_data);
105
/* Start or stop running calculation from a main loop
106
* idle handler. The current 'render_time' is the number
107
* of seconds that we nominally calculate for during
108
* each main loop iteration. The default of 15ms is
109
* fine for most interactive use.
111
void iterative_map_start_calculation (IterativeMap *self);
112
void iterative_map_stop_calculation (IterativeMap *self);
113
gboolean iterative_map_is_calculation_running (IterativeMap *self);
117
#endif /* __ITERATIVE_MAP_H__ */