libtthimage/Lib/zoom.c

92 lines
1.9 KiB
C
Raw Normal View History

2022-06-26 20:06:35 +11:00
/*
Zooms sur les images
--------------------
new 31 janvier 2009 - avenue Saint Exupery
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
2022-06-27 11:19:31 +11:00
#include "../tthimage.h"
2022-06-26 20:06:35 +11:00
/*::------------------------------------------------------------------::*/
/* private variables */
/*::------------------------------------------------------------------::*/
/* private functions */
/*::------------------------------------------------------------------::*/
int Image_essai_zoom(Image_Desc *src, Image_Desc *dst,
double kx, double ky, int flags)
{
int xd, yd, xs, ys;
int rd, gd, bd;
double dxs, dys; /* destination float position */
#if DEBUG_LEVEL
long hit, mess;
#endif
#if DEBUG_LEVEL
fprintf(stderr, "%s : %p -> %p %f %f 0x%x\n", __func__,
src, dst, kx, ky, flags);
#endif
/* initilaisation de variables de debug/comptage */
#if DEBUG_LEVEL
hit = mess = 0L;
#endif
for (xd=0; xd<dst->width; xd++)
{
dxs = (double)xd * kx;
for (yd=0; yd<dst->height; yd++)
{
rd = gd = bd = 42;
dys = (double)yd * ky; /* kikoo lol */
xs = (int)dxs;
ys = (int)dys;
if ( Image_xy_inside(src, xs, ys) )
{
Image_getRGB(src, xs, ys, &rd, &gd, &bd);
#if DEBUG_LEVEL
hit++;
#endif
}
#if DEBUG_LEVEL
else mess++;
#endif
Image_plotRGB(dst, xd, yd, rd, gd, bd);
}
}
#if DEBUG_LEVEL
fprintf(stderr, "%s -> hit=%ld mess=%ld\n", __func__, hit, mess);
#endif
return BAD_ZOOM;
}
/*::------------------------------------------------------------------::*/
int Image_zoom_000(Image_Desc *src, Image_Desc *dst, Image_Rect *rect)
{
int xd, yd, r, g, b;
double fxd, fyd;
#if DEBUG_LEVEL
fprintf(stderr, "%s ( %p %p %p )\n", __func__, src, dst, rect);
#endif
for (yd=0; yd<dst->height; yd++)
{
fyd = (double)yd;
for (xd=0; xd<dst->height; xd++)
{
fxd = (double)xd;
}
}
return FULL_NUCKED;
}
/*::------------------------------------------------------------------::*/