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
*/
int
Image_rgbmask_H(Image_Desc *src, Image_Desc *dst, int gris)
int Image_rgbmask_H(Image_Desc *src, Image_Desc *dst, int gris)
{
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);
return foo;
}
Image_copy(src, dst); /* XXX pourquoi cette copie ? */
for (y=0; y<src->height; y++)
{
for (x=0; x<src->width; x++)
{
switch (y%3)
{
for (y=0; y<src->height; y++) {
for (x=0; x<src->width; x++) {
switch (y%3) {
case 0:
Image_plot_channel(dst, 'r', x, y, gris);
Image_plot_channel(dst, 'g', x, y, gris);
@ -57,25 +52,19 @@ return FUNC_IS_BETA;
/*
* vertical lines
*/
int
Image_rgbmask_V(Image_Desc *src, Image_Desc *dst, int gris)
int Image_rgbmask_V(Image_Desc *src, Image_Desc *dst, int gris)
{
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);
return foo;
}
Image_copy(src, dst);
for (y=0; y<src->height; y++)
{
for (x=0; x<src->width; x++)
{
switch (x%3)
{
for (y=0; y<src->height; y++) {
for (x=0; x<src->width; x++) {
switch (x%3) {
case 0:
Image_plot_channel(dst, 'r', 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.
*/
int
Image_rgbmask_2(Image_Desc *src, Image_Desc *dst, int gris)
int Image_rgbmask_2(Image_Desc *src, Image_Desc *dst, int gris)
{
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);
return foo;
}
Image_copy(src, dst);
foo = 0;
for (y=0; y<src->height; y++)
{
for (x=0; x<src->width; x++)
{
for (y=0; y<src->height; y++) {
for (x=0; x<src->width; x++) {
foo++;
switch (foo%3)
{
switch (foo%3) {
case 0:
Image_plot_channel(dst, 'r', x, y, gris);
Image_plot_channel(dst, 'g', x, y, gris);
@ -140,8 +124,7 @@ return FUNC_IS_BETA;
/*
* random dots - VERY BAD RESULTS :(
*/
int
Image_rgbmask_R(Image_Desc *src, Image_Desc *dst, int gris)
int Image_rgbmask_R(Image_Desc *src, Image_Desc *dst, int gris)
{
int foo, x, y;
@ -149,20 +132,16 @@ int foo, x, y;
fprintf(stderr, "this function, %s(%d), is very buggy...\n", __func__, gris);
#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);
return foo;
}
Image_copy(src, dst);
for (y=0; y<src->height; y++)
{
for (x=0; x<src->width; x++)
{
for (y=0; y<src->height; y++) {
for (x=0; x<src->width; x++) {
foo = rand() % 3; /* mmmm pas tres bon :( */
switch (foo)
{
switch (foo) {
case 0:
Image_plot_channel(dst, 'r', x, y, gris);
Image_plot_channel(dst, 'g', x, y, gris);