1 /* merge.h - Merge utility headers (merging source - result) 2 * 3 * Copyright (C) 2002, 2010 Patrice St-Gelais 4 * patrstg@users.sourceforge.net 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 */ 20 21 #ifndef _MERGE 22 #define _MERGE 1 23 #include "globals.h" 24 #include "hf.h" 25 26 #ifndef ADD 27 #define ADD 91 28 #endif 29 #ifndef SUBTRACT 30 #define SUBTRACT 92 31 #endif 32 #ifndef MIN_MERGE 33 #define MIN_MERGE 93 34 #endif 35 #ifndef MAX_MERGE 36 #define MAX_MERGE 94 37 #endif 38 #ifndef XOR_MERGE 39 #define XOR_MERGE 95 40 #endif 41 42 #ifndef ALT_MERGE 43 #define ALT_MERGE 96 44 #endif 45 46 #ifndef MERGE_HARDNESS 47 #define MERGE_HARDNESS 0.15 48 #endif 49 50 typedef struct { 51 gint merge_op; 52 // Post-merge function, typically for displaying the result, but can include other computations 53 void (*display_fn) (gpointer); 54 // Data to execute with display_fn, typically a hf_wrapper_struct ** 55 gpointer data; 56 gpointer source1; 57 gpointer source2; 58 gpointer result; 59 gint max_x; 60 gint max_y; 61 gint mix; 62 gint source_offset; 63 gint result_offset; 64 gint x_translate; 65 gint y_translate; // TRUE when one of the parameters change 66 gdouble hardness; // For altitude merge only (added 2010-11) 67 } merge_struct; 68 69 void set_merge_buffers ( 70 merge_struct *mrg, 71 gpointer source1, 72 gpointer source2, 73 gpointer result, 74 gint max_x, 75 gint max_y); 76 77 void reset_merge_buffers (merge_struct *mrg); 78 79 merge_struct *merge_struct_new( 80 gpointer hfw_adr, 81 void (*calc_hf) (gpointer)); 82 83 void merge_calc (merge_struct *mrg); 84 85 void simple_merge (merge_struct *mrg) ; 86 87 #endif // _MERGE 88