[Rawstudio-commit] r947 - trunk/src

Anders Brander anders at brander.dk
Tue Nov 21 19:01:06 CET 2006


Author: abrander
Date: 2006-11-21 19:01:05 +0100 (Tue, 21 Nov 2006)
New Revision: 947

Modified:
   trunk/src/rs-image.c
   trunk/src/rs-image.h
Log:
Removed rs_image16_affine().

Modified: trunk/src/rs-image.c
===================================================================
--- trunk/src/rs-image.c	2006-11-21 18:00:41 UTC (rev 946)
+++ trunk/src/rs-image.c	2006-11-21 18:01:05 UTC (rev 947)
@@ -323,99 +323,6 @@
 }
 
 RS_IMAGE16 *
-rs_image16_affine(RS_IMAGE16 *in, RS_IMAGE16 *out, RS_MATRIX3 *affine, RS_MATRIX3 *inverse_affine, RS_RECT *crop)
-{
-	RS_MATRIX3 mat = *affine;
-	gint row;
-	gint col;
-	gdouble x,y;
-	gint destoffset;
-	gdouble minx=100000.0, miny=100000.0;
-	gdouble maxx=0.0, maxy=0.0;
-	gint w,h;
-
-	/* find borders */
-	matrix3_affine_transform_point(&mat, 0.0, 0.0, &x, &y);
-	if (x<minx) minx=x;
-	if (x>maxx) maxx=x;
-	if (y<miny) miny=y;
-	if (y>maxy) maxy=y;
-	matrix3_affine_transform_point(&mat, (gdouble) in->w-1, 0.0, &x, &y);
-	if (x<minx) minx=x;
-	if (x>maxx) maxx=x;
-	if (y<miny) miny=y;
-	if (y>maxy) maxy=y;
-	matrix3_affine_transform_point(&mat, 0.0, (gdouble) in->h-1, &x, &y);
-	if (x<minx) minx=x;
-	if (x>maxx) maxx=x;
-	if (y<miny) miny=y;
-	if (y>maxy) maxy=y;
-	matrix3_affine_transform_point(&mat, (gdouble) in->w-1, (gdouble) in->h-1, &x, &y);
-	if (x<minx) minx=x;
-	if (x>maxx) maxx=x;
-	if (y<miny) miny=y;
-	if (y>maxy) maxy=y;
-
-	matrix3_affine_translate(&mat, -minx, -miny);
-
-	if (crop)
-	{
-		gdouble x1,x2,y1,y2;
-		gdouble tmp;
-
-		matrix3_affine_transform_point(&mat, (gdouble) crop->x1, (gdouble) crop->y1, &x1, &y1);
-		matrix3_affine_transform_point(&mat, (gdouble) crop->x2, (gdouble) crop->y2, &x2, &y2);
-		if (x1 > x2)
-		{
-			tmp = x2;
-			x2 = x1;
-			x1 = tmp;
-		}
-		if (y1 > y2)
-		{
-			tmp = y2;
-			y2 = y1;
-			y1 = tmp;
-		}
-		matrix3_affine_translate(&mat, -x1, -y1);
-		w = (x2-x1);
-		h = (y2-y1);
-	}
-	else
-	{
-		w = (gint) (maxx - minx);
-		h = (gint) (maxy - miny);
-	}
-
-	matrix3_affine_invert(&mat);
-	if (inverse_affine)
-		*inverse_affine = mat;
-
-	if (out==NULL)
-		out = rs_image16_new(w, h, in->channels, in->pixelsize);
-	else
-		g_assert((out->w>=w) && (out->h>=h));
-
-	for(row=0;row<out->h;row++)
-	{
-		for(col=0;col<out->w;col++)
-		{
-			matrix3_affine_transform_point(&mat, (gdouble) col, (gdouble) row, &x, &y);
-
-			/* this is stupid */
-			if (unlikely(x<0.0)) continue;
-			if (unlikely(y<0.0)) continue;
-			if (unlikely(x>(in->w-2))) continue;
-			if (unlikely(y>(in->h-2))) continue;
-
-			destoffset = row * out->rowstride + col*out->pixelsize;
-			rs_image16_bilinear(in, &out->pixels[destoffset++], x, y);
-		}
-	}
-	return(out);
-}
-
-RS_IMAGE16 *
 rs_image16_scale_double(RS_IMAGE16 *in, RS_IMAGE16 *out, gdouble scale)
 {
 	gint x,y;

Modified: trunk/src/rs-image.h
===================================================================
--- trunk/src/rs-image.h	2006-11-21 18:00:41 UTC (rev 946)
+++ trunk/src/rs-image.h	2006-11-21 18:01:05 UTC (rev 947)
@@ -31,7 +31,6 @@
 void rs_image16_orientation(RS_IMAGE16 *rsi, gint orientation);
 RS_IMAGE16 *rs_image16_transform(RS_IMAGE16 *in, RS_IMAGE16 *out, RS_MATRIX3 *inverse_affine,
 	RS_RECT *crop, gint width, gint height, gboolean keep_aspect, gdouble scale, gdouble angle, gint orientation);
-RS_IMAGE16 *rs_image16_affine(RS_IMAGE16 *in, RS_IMAGE16 *out, RS_MATRIX3 *affine, RS_MATRIX3 *inverse_affine, RS_RECT *crop);
 RS_IMAGE16 *rs_image16_scale_double(RS_IMAGE16 *in, RS_IMAGE16 *out, gdouble scale);
 RS_IMAGE16 *rs_image16_copy(RS_IMAGE16 *rsi);
 void rs_image16_crop(RS_IMAGE16 **rsi, RS_RECT *rect);




More information about the Rawstudio-commit mailing list