Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Diff of /src/vips/transform.c [000000] .. [f48183] Maximize Restore

  Switch to side-by-side view

--- a
+++ b/src/vips/transform.c
@@ -0,0 +1,65 @@
+#include "stdio.h"
+#include "stdlib.h"
+#include <string.h>
+#include <ctype.h>
+#include <stdarg.h>
+#include <assert.h>
+
+#include <parser/tparser.h>
+
+#include "transform.h"
+
+#define DEBUG
+
+pt_transform *
+transform_new_from_file( char *transform , int *width, int *height )
+{
+	pt_script *script = NULL;    
+	script = panoScriptParse(transform, FALSE);
+    if (script == NULL) {
+		printf("Parsing error\n");
+		return NULL;
+    } else {
+		panoScriptDump(script);
+
+		printf("\n\n===============================\n\n");
+		pt_transform * trn = panoTransformCreate(script,0);
+		/*Transform *trn;
+
+		if( !(trn = malloc( sizeof( Transform )) ) )
+			return( NULL );
+		trn->stuff = 42;*/
+
+#ifdef DEBUG
+		printf( "transform_new_from_file: \"%s\" (%p)\n", transform, trn );
+#endif /*DEBUG*/
+	    
+		*width = script->pano.width;
+		*height = script->pano.height;
+		/*hope after this step pt_script is of no use, so we can dispose it*/
+		panoParserDispose(&script);
+		return( trn );
+	}
+}
+
+int
+transform_destroy( pt_transform *trn )
+{
+#ifdef DEBUG
+	printf( "transform_destroy: %p\n", trn );
+#endif /*DEBUG*/
+
+	/*I think panoTransformDispose will take care of freeing the memory	*/
+	panoTransformDispose(&trn);
+	/*free( trn );*/
+
+	return( 0 );
+}
+
+/*this dummy function is no longer needed and can be removed*/
+void
+transform_coordinates( Transform *trn, int x, int y, double *xp, double *yp )
+{
+	*xp = x + trn->stuff;
+	*yp = y;
+}