1 /* subdiv1.h - headers for subdivision algorithms 1 & 2 2 * 3 * Copyright (C) 2001 Patrice St-Gelais 4 * patrstg@users.sourceforge.net 5 * www.oricom.ca/patrice.st-gelais 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 */ 21 22 #ifndef _SUBDIV1 23 #define _SUBDIV1 1 24 25 #include "hf.h" 26 27 #define calc_avrg(a,b,c,d) (a+b+c+d)>>2 28 29 #define OP_HF ^ 30 #define IF_RECALC TRUE 31 #define IF_RECALC2 TRUE 32 #define MAXLAG 99 33 #define MINLAG -99 34 35 typedef struct { 36 // Options for simple subdivision, square or triangle 37 guint seed; 38 gint roughness; // Variation of random displacement at each step 39 // From -5 (smooth result) to 5 (rough) 40 gboolean top_random; // TRUE if top value is random 41 hf_type top_value; // if top_random==FALSE; from 0 to 0xFFFF 42 unsigned short int frq_control_mask; // Fine frequency control 43 // 1 bit for each of a max. of 12 subdivisions 44 } subdiv1_opt; 45 46 subdiv1_opt *subdiv1_opt_new(void); 47 void subdiv1(hf_struct_type *hf, subdiv1_opt *opt); 48 void calc_subdiv1 (hf_type *hf_buf, int max_x, int max_y, subdiv1_opt *opt); 49 50 #endif 51 52 53 54 55 56