This commit is contained in:
tTh 2024-08-12 12:32:58 +02:00
parent 38173616ba
commit d6632ade7e

View File

@ -16,25 +16,20 @@
/* /*
* horizontal lines * horizontal lines
*/ */
int int Image_rgbmask_H(Image_Desc *src, Image_Desc *dst, int gris)
Image_rgbmask_H(Image_Desc *src, Image_Desc *dst, int gris)
{ {
int foo, x, y; int foo, x, y;
if ( (foo=Image_compare_desc(src, dst)) ) if ( (foo=Image_compare_desc(src, dst)) ) {
{
fprintf(stderr, "%s : images are differents %d\n", __func__, foo); fprintf(stderr, "%s : images are differents %d\n", __func__, foo);
return foo; return foo;
} }
Image_copy(src, dst); /* XXX pourquoi cette copie ? */ Image_copy(src, dst); /* XXX pourquoi cette copie ? */
for (y=0; y<src->height; y++) for (y=0; y<src->height; y++) {
{ for (x=0; x<src->width; x++) {
for (x=0; x<src->width; x++) switch (y%3) {
{
switch (y%3)
{
case 0: case 0:
Image_plot_channel(dst, 'r', x, y, gris); Image_plot_channel(dst, 'r', x, y, gris);
Image_plot_channel(dst, 'g', x, y, gris); Image_plot_channel(dst, 'g', x, y, gris);
@ -57,25 +52,19 @@ return FUNC_IS_BETA;
/* /*
* vertical lines * vertical lines
*/ */
int int Image_rgbmask_V(Image_Desc *src, Image_Desc *dst, int gris)
Image_rgbmask_V(Image_Desc *src, Image_Desc *dst, int gris)
{ {
int foo, x, y; int foo, x, y;
if ( (foo=Image_compare_desc(src, dst)) ) if ( (foo=Image_compare_desc(src, dst)) ) {
{
fprintf(stderr, "Image rgbmask V: images are differents %d\n", foo); fprintf(stderr, "Image rgbmask V: images are differents %d\n", foo);
return foo; return foo;
} }
Image_copy(src, dst); Image_copy(src, dst);
for (y=0; y<src->height; y++) for (y=0; y<src->height; y++) {
{ for (x=0; x<src->width; x++) {
for (x=0; x<src->width; x++) switch (x%3) {
{
switch (x%3)
{
case 0: case 0:
Image_plot_channel(dst, 'r', x, y, gris); Image_plot_channel(dst, 'r', x, y, gris);
Image_plot_channel(dst, 'g', x, y, gris); Image_plot_channel(dst, 'g', x, y, gris);
@ -98,26 +87,21 @@ return FUNC_IS_BETA;
/* /*
* sequential dots - _very_ dependant on image dimensions. * sequential dots - _very_ dependant on image dimensions.
*/ */
int int Image_rgbmask_2(Image_Desc *src, Image_Desc *dst, int gris)
Image_rgbmask_2(Image_Desc *src, Image_Desc *dst, int gris)
{ {
int foo, x, y; int foo, x, y;
if ( (foo=Image_compare_desc(src, dst)) ) if ( (foo=Image_compare_desc(src, dst)) ) {
{
fprintf(stderr, "Image rgbmask 2: images are differents %d\n", foo); fprintf(stderr, "Image rgbmask 2: images are differents %d\n", foo);
return foo; return foo;
} }
Image_copy(src, dst); Image_copy(src, dst);
foo = 0; foo = 0;
for (y=0; y<src->height; y++) for (y=0; y<src->height; y++) {
{ for (x=0; x<src->width; x++) {
for (x=0; x<src->width; x++)
{
foo++; foo++;
switch (foo%3) switch (foo%3) {
{
case 0: case 0:
Image_plot_channel(dst, 'r', x, y, gris); Image_plot_channel(dst, 'r', x, y, gris);
Image_plot_channel(dst, 'g', x, y, gris); Image_plot_channel(dst, 'g', x, y, gris);
@ -140,8 +124,7 @@ return FUNC_IS_BETA;
/* /*
* random dots - VERY BAD RESULTS :( * random dots - VERY BAD RESULTS :(
*/ */
int int Image_rgbmask_R(Image_Desc *src, Image_Desc *dst, int gris)
Image_rgbmask_R(Image_Desc *src, Image_Desc *dst, int gris)
{ {
int foo, x, y; int foo, x, y;
@ -149,20 +132,16 @@ int foo, x, y;
fprintf(stderr, "this function, %s(%d), is very buggy...\n", __func__, gris); fprintf(stderr, "this function, %s(%d), is very buggy...\n", __func__, gris);
#endif #endif
if ( (foo=Image_compare_desc(src, dst)) ) if ( (foo=Image_compare_desc(src, dst)) ) {
{
fprintf(stderr, "Image rgbmask R: images are differents %d\n", foo); fprintf(stderr, "Image rgbmask R: images are differents %d\n", foo);
return foo; return foo;
} }
Image_copy(src, dst); Image_copy(src, dst);
for (y=0; y<src->height; y++) for (y=0; y<src->height; y++) {
{ for (x=0; x<src->width; x++) {
for (x=0; x<src->width; x++)
{
foo = rand() % 3; /* mmmm pas tres bon :( */ foo = rand() % 3; /* mmmm pas tres bon :( */
switch (foo) switch (foo) {
{
case 0: case 0:
Image_plot_channel(dst, 'r', x, y, gris); Image_plot_channel(dst, 'r', x, y, gris);
Image_plot_channel(dst, 'g', x, y, gris); Image_plot_channel(dst, 'g', x, y, gris);