cosmetic
This commit is contained in:
parent
2f1f51671c
commit
63b0bce081
31
Lib/scale.c
31
Lib/scale.c
@ -20,8 +20,7 @@
|
||||
/*
|
||||
* do not use in production !-)
|
||||
*/
|
||||
int
|
||||
Image_scale_simple(Image_Desc *src, Image_Desc *dst, int k)
|
||||
int Image_scale_simple(Image_Desc *src, Image_Desc *dst, int k)
|
||||
{
|
||||
float coefX, coefY, fx, fy;
|
||||
int xd, yd, xs, ys;
|
||||
@ -49,10 +48,8 @@ fprintf(stderr, "coefficients: X %f y %f\n", coefX, coefY);
|
||||
* bon, pour les interpolations, il faut que je trouve
|
||||
* un peu de doc... mais ou ?
|
||||
*/
|
||||
for (yd=0; yd<dst->height; yd++)
|
||||
{
|
||||
for (xd=0; xd<dst->width; xd++)
|
||||
{
|
||||
for (yd=0; yd<dst->height; yd++) {
|
||||
for (xd=0; xd<dst->width; xd++) {
|
||||
fx = (float)xd / coefX;
|
||||
fy = (float)yd / coefY;
|
||||
xs = (int)fx;
|
||||
@ -70,9 +67,12 @@ return FUNC_IS_ALPHA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/* new 2 nov 2009 - ave StEx */
|
||||
/* I've lost all my mathematical concepts so I'm going to make
|
||||
some approximations\dots */
|
||||
/*
|
||||
I've lost all my mathematical concepts so I'm going to make
|
||||
some approximations\dots
|
||||
|
||||
this function is PRIVATE, see 'Image_getpix_bilin' for public interface
|
||||
*/
|
||||
static int getpix_bilin(Image_Desc *src, double fx, double fy,
|
||||
int *pr, int *pg, int *pb)
|
||||
{
|
||||
@ -95,12 +95,8 @@ drw = fx - x11; drh = fy - y11;
|
||||
xx = (int)x11; yy = (int)y11;
|
||||
|
||||
#if DEBUG_LEVEL > 2
|
||||
if ( ! (rand() % 40000) )
|
||||
printf("X %10.3f %10.3f %10.3f %10.3f %4d\n",
|
||||
fx, x11, x22, drw, xx);
|
||||
if ( ! (rand() % 40000) )
|
||||
printf("Y %10.3f %10.3f %10.3f %10.3f %4d\n",
|
||||
fy, y11, y22, drh, yy);
|
||||
printf("X %10.3f %10.3f %10.3f %10.3f %4d\n", fx, x11, x22, drw, xx);
|
||||
printf("Y %10.3f %10.3f %10.3f %10.3f %4d\n", fy, y11, y22, drh, yy);
|
||||
#endif
|
||||
|
||||
if ( ! Image_xy_inside(src, xx, yy) )
|
||||
@ -203,7 +199,7 @@ int nw, nh, foo;
|
||||
Image_Desc *dst;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "image\t%d %d, scale %f %f\n",
|
||||
fprintf(stderr, "%s: image\t%d %d, scale %f %f\n", __func__,
|
||||
src->width, src->height, scaleX, scaleY);
|
||||
#endif
|
||||
|
||||
@ -223,9 +219,8 @@ fprintf(stderr, "\t%f %f\n", fx, fy);
|
||||
fprintf(stderr, "\tnew dims: %d x %d\n", nw, nh);
|
||||
#endif
|
||||
|
||||
if ( (dst = Image_alloc(nw, nh, 3)) == NULL )
|
||||
{
|
||||
fprintf(stderr, "Image new/scale: no memory\n");
|
||||
if ( (dst = Image_alloc(nw, nh, 3)) == NULL ) {
|
||||
fprintf(stderr, "%s: no memory\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,7 @@
|
||||
/*
|
||||
* Rotation d'image. le parametre 'angle' est en degres.
|
||||
*/
|
||||
int
|
||||
Image_center_rotate(Image_Desc *src, Image_Desc *dst, double angle)
|
||||
int Image_center_rotate(Image_Desc *src, Image_Desc *dst, double angle)
|
||||
{
|
||||
int xs, ys, xd, yd;
|
||||
double arad, fxs, fys, fxd, fyd;
|
||||
@ -66,8 +65,7 @@ return FUNC_IS_BETA;
|
||||
*
|
||||
* reste plus qu'à coder...
|
||||
*/
|
||||
int
|
||||
Image_center_rotate_xy(Image_Desc *src, Image_Desc *dst, double angle,
|
||||
int Image_center_rotate_xy(Image_Desc *src, Image_Desc *dst, double angle,
|
||||
double x, double y)
|
||||
{
|
||||
int foo, xd, yd;
|
||||
|
Loading…
Reference in New Issue
Block a user