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 !-)
|
* do not use in production !-)
|
||||||
*/
|
*/
|
||||||
int
|
int Image_scale_simple(Image_Desc *src, Image_Desc *dst, int k)
|
||||||
Image_scale_simple(Image_Desc *src, Image_Desc *dst, int k)
|
|
||||||
{
|
{
|
||||||
float coefX, coefY, fx, fy;
|
float coefX, coefY, fx, fy;
|
||||||
int xd, yd, xs, ys;
|
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
|
* bon, pour les interpolations, il faut que je trouve
|
||||||
* un peu de doc... mais ou ?
|
* un peu de doc... mais ou ?
|
||||||
*/
|
*/
|
||||||
for (yd=0; yd<dst->height; yd++)
|
for (yd=0; yd<dst->height; yd++) {
|
||||||
{
|
for (xd=0; xd<dst->width; xd++) {
|
||||||
for (xd=0; xd<dst->width; xd++)
|
|
||||||
{
|
|
||||||
fx = (float)xd / coefX;
|
fx = (float)xd / coefX;
|
||||||
fy = (float)yd / coefY;
|
fy = (float)yd / coefY;
|
||||||
xs = (int)fx;
|
xs = (int)fx;
|
||||||
@ -70,9 +67,12 @@ return FUNC_IS_ALPHA;
|
|||||||
}
|
}
|
||||||
/*::------------------------------------------------------------------::*/
|
/*::------------------------------------------------------------------::*/
|
||||||
/* new 2 nov 2009 - ave StEx */
|
/* 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,
|
static int getpix_bilin(Image_Desc *src, double fx, double fy,
|
||||||
int *pr, int *pg, int *pb)
|
int *pr, int *pg, int *pb)
|
||||||
{
|
{
|
||||||
@ -95,12 +95,8 @@ drw = fx - x11; drh = fy - y11;
|
|||||||
xx = (int)x11; yy = (int)y11;
|
xx = (int)x11; yy = (int)y11;
|
||||||
|
|
||||||
#if DEBUG_LEVEL > 2
|
#if DEBUG_LEVEL > 2
|
||||||
if ( ! (rand() % 40000) )
|
printf("X %10.3f %10.3f %10.3f %10.3f %4d\n", fx, x11, x22, drw, xx);
|
||||||
printf("X %10.3f %10.3f %10.3f %10.3f %4d\n",
|
printf("Y %10.3f %10.3f %10.3f %10.3f %4d\n", fy, y11, y22, drh, yy);
|
||||||
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);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( ! Image_xy_inside(src, xx, yy) )
|
if ( ! Image_xy_inside(src, xx, yy) )
|
||||||
@ -203,7 +199,7 @@ int nw, nh, foo;
|
|||||||
Image_Desc *dst;
|
Image_Desc *dst;
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#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);
|
src->width, src->height, scaleX, scaleY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -223,9 +219,8 @@ fprintf(stderr, "\t%f %f\n", fx, fy);
|
|||||||
fprintf(stderr, "\tnew dims: %d x %d\n", nw, nh);
|
fprintf(stderr, "\tnew dims: %d x %d\n", nw, nh);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( (dst = Image_alloc(nw, nh, 3)) == NULL )
|
if ( (dst = Image_alloc(nw, nh, 3)) == NULL ) {
|
||||||
{
|
fprintf(stderr, "%s: no memory\n", __func__);
|
||||||
fprintf(stderr, "Image new/scale: no memory\n");
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,8 +11,7 @@
|
|||||||
/*
|
/*
|
||||||
* Rotation d'image. le parametre 'angle' est en degres.
|
* Rotation d'image. le parametre 'angle' est en degres.
|
||||||
*/
|
*/
|
||||||
int
|
int Image_center_rotate(Image_Desc *src, Image_Desc *dst, double angle)
|
||||||
Image_center_rotate(Image_Desc *src, Image_Desc *dst, double angle)
|
|
||||||
{
|
{
|
||||||
int xs, ys, xd, yd;
|
int xs, ys, xd, yd;
|
||||||
double arad, fxs, fys, fxd, fyd;
|
double arad, fxs, fys, fxd, fyd;
|
||||||
@ -66,8 +65,7 @@ return FUNC_IS_BETA;
|
|||||||
*
|
*
|
||||||
* reste plus qu'à coder...
|
* reste plus qu'à coder...
|
||||||
*/
|
*/
|
||||||
int
|
int Image_center_rotate_xy(Image_Desc *src, Image_Desc *dst, double angle,
|
||||||
Image_center_rotate_xy(Image_Desc *src, Image_Desc *dst, double angle,
|
|
||||||
double x, double y)
|
double x, double y)
|
||||||
{
|
{
|
||||||
int foo, xd, yd;
|
int foo, xd, yd;
|
||||||
|
Loading…
Reference in New Issue
Block a user