From 8d9c91f1b768700d1f8c2eb3b3d0e9c67ae8644d Mon Sep 17 00:00:00 2001 From: tTh Date: Mon, 12 Sep 2022 23:35:54 +0200 Subject: [PATCH] + Image_cadre_std2 --- Lib/cadres.c | 56 ++++++++++++++++++++++++++++++++++++++++++++-------- tthimage.h | 12 ++++++----- 2 files changed, 55 insertions(+), 13 deletions(-) diff --git a/Lib/cadres.c b/Lib/cadres.c index 65eda16..d87e93b 100644 --- a/Lib/cadres.c +++ b/Lib/cadres.c @@ -135,8 +135,7 @@ return foo; * 3 octobre 2009 : il faudra la renommer pour etre XXX * en accord avec 'tga_cadre' qui la nomme "sweep". XXX */ -int -Image_cadre_C(Image_Desc *im, int r, int g, int b, int n) +int Image_cadre_C(Image_Desc *im, int r, int g, int b, int n) { int x, y, x2, y2, ir, ig, ib; float fx, fy; @@ -150,8 +149,7 @@ fn = (float)(n*n); x2 = im->width / 2; y2 = im->height / 2; -for (y=0; yheight; y++) - { +for (y=0; yheight; y++) { /* * distance au bord HAUT BAS le plus proche */ @@ -159,8 +157,7 @@ for (y=0; yheight; y++) else fy = (float)((im->height - y)-1); fy = fy*fy; - for (x=0; xwidth; x++) - { + for (x=0; xwidth; x++) { /* * distance au bord DROITE GAUCHE le plus proche */ @@ -172,8 +169,7 @@ for (y=0; yheight; y++) if (fx < fy) d = fx; else d = fy; - if (d < fn) - { + if (d < fn) { coef = d / fn; ir = (im->Rpix[y])[x]; ig = (im->Gpix[y])[x]; @@ -470,5 +466,49 @@ for (y=0; yheight; y++) return OLL_KORRECT; } /*::------------------------------------------------------------------::*/ +/* nouveau : Mon 12 Sep 2022 10:47:18 PM CEST + */ +int Image_cadre_std2(Image_Desc *im, int r, int g, int b, int nh, int nv) +{ +int x, y; + +#if DEBUG_LEVEL +fprintf(stderr, ">>> %s ( %p %d %d %d %d %d )\n", __func__, + im, r, g, b, nh, nv); +#endif + +for (y=0; yheight; y++) + { + for (x=0; xRpix[y])[x] = r; + (im->Gpix[y])[x] = g; + (im->Bpix[y])[x] = b; + } + for (x=0; xwidth - nv, y, r, g, b); + } + } + +for (x=0; xwidth; x++) + { + for (y=0; yRpix[y])[x] = r; + (im->Gpix[y])[x] = g; + (im->Bpix[y])[x] = b; + } + for (y=0; yRpix[y+im->height-nh])[x] = r; + (im->Gpix[y+im->height-nh])[x] = g; + (im->Bpix[y+im->height-nh])[x] = b; + } + } + +return FUNC_IS_BETA; +} +/*::------------------------------------------------------------------::*/ /* et maintenant ? on peut aller voir 'cadres2.c' ? */ /*::------------------------------------------------------------------::*/ diff --git a/tthimage.h b/tthimage.h index 717ac93..606654e 100644 --- a/tthimage.h +++ b/tthimage.h @@ -4,7 +4,7 @@ http:///la.buvette.org/devel/libimage/ */ #ifndef IMAGE_VERSION_STRING - #define IMAGE_VERSION_STRING "0.4.51 pl 18" + #define IMAGE_VERSION_STRING "0.4.51 pl 21" /*::------------------------------------------------------------------::*/ /* @@ -481,10 +481,10 @@ typedef struct * que Gcc grinke feroce dessus... */ -int Image_mosaic_0(Image_Desc *src, Image_Desc *dst, int sx, int sy, int flg); -int Image_mosaic_simple(Image_Desc *src, Image_Desc *dst); +int Image_mosaic_0(Image_Desc *src, Image_Desc *dst, int sx, int sy, int flg); +int Image_mosaic_simple(Image_Desc *src, Image_Desc *dst); void Image_mosaic_prctrl(IMAGE_MOSAIC_CTRL *ctrl, char *txt); -int Image_mosaic_iterateur(IMAGE_MOSAIC_CTRL *ctrl, int yo); +int Image_mosaic_iterateur(IMAGE_MOSAIC_CTRL *ctrl, int yo); /*::------------------------------------------------------------------::*/ /* module des vignettes (nex 15 mai 2007) */ @@ -1113,10 +1113,12 @@ int Image_pix2ptl(Image_Desc *img, int seuil, Image_PtList *ptl); int Image_cadre_A(Image_Desc *im); int Image_cadre_B(Image_Desc *im, int larg); int Image_cadre_cracra(Image_Desc *im, int larg, int k); -int Image_cadre_C(Image_Desc *, int, int, int, int); +int Image_cadre_C(Image_Desc *, int r, int g, int b, int sz); int Image_cadre_bruit(Image_Desc *, int, int, int, int); int Image_cadre_E(Image_Desc *, int, int, int, int); +int Image_cadre_std2(Image_Desc *im, int r, int g, int b, int nh, int nv); + int Image_cadre_pattern_0(Image_Desc *, Image_Desc *, int); int Image_cadre_pattern_1(Image_Desc *im, Image_Desc *pat, int n); int Image_cadre_pattern_2(Image_Desc *im, Image_Desc *pat, int n);