kopia lustrzana https://gitlab.com/sane-project/frontends
Fixed 1 bit color three-pass mode. Added 16 bit modes. Added 1 bit color
mode. Henning Meier-Geinitz <henning@meier-geinitz.de>DEVEL_2_0_BRANCH-1
rodzic
1621c05f59
commit
ec89da2212
|
@ -1,3 +1,8 @@
|
||||||
|
2002-04-01 Henning Meier-Geinitz <henning@meier-geinitz.de>
|
||||||
|
|
||||||
|
* src/preview.c: Fixed 1 bit color three-pass mode. Added 16 bit modes.
|
||||||
|
Added 1 bit color mode.
|
||||||
|
|
||||||
2002-03-28 Henning Meier-Geinitz <henning@meier-geinitz.de>
|
2002-03-28 Henning Meier-Geinitz <henning@meier-geinitz.de>
|
||||||
|
|
||||||
* Makefile.in: Remove *.tar.gz when making distclean.
|
* Makefile.in: Remove *.tar.gz when making distclean.
|
||||||
|
|
107
src/preview.c
107
src/preview.c
|
@ -563,18 +563,66 @@ input_available (gpointer data, gint source, GdkInputCondition cond)
|
||||||
switch (p->params.format)
|
switch (p->params.format)
|
||||||
{
|
{
|
||||||
case SANE_FRAME_RGB:
|
case SANE_FRAME_RGB:
|
||||||
if (p->params.depth != 8)
|
switch (p->params.depth)
|
||||||
goto bad_depth;
|
|
||||||
|
|
||||||
for (i = 0; i < len; ++i)
|
|
||||||
{
|
{
|
||||||
p->image_data[p->image_offset++] = buf[i];
|
case 1:
|
||||||
if (p->image_offset%3 == 0)
|
for (i = 0; i < len; ++i)
|
||||||
{
|
{
|
||||||
if (++p->image_x >= p->image_width
|
u_char mask = buf[i];
|
||||||
&& increment_image_y (p) < 0)
|
|
||||||
return;
|
for (j = 7; j >= 0; --j)
|
||||||
|
{
|
||||||
|
u_char gl = (mask & (1 << j)) ? 0xff : 0x00;
|
||||||
|
p->image_data[p->image_offset] = gl;
|
||||||
|
if (j > 0)
|
||||||
|
p->image_offset += 3;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((p->image_offset % 3) != 2)
|
||||||
|
p->image_offset -= 20;
|
||||||
|
else
|
||||||
|
p->image_offset++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((i % 3) == 0 && ++p->image_x >= p->image_width)
|
||||||
|
{
|
||||||
|
if (increment_image_y (p) < 0)
|
||||||
|
return;
|
||||||
|
break; /* skip padding bits */
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
for (i = 0; i < len; ++i)
|
||||||
|
{
|
||||||
|
p->image_data[p->image_offset++] = buf[i];
|
||||||
|
if (p->image_offset%3 == 0)
|
||||||
|
{
|
||||||
|
if (++p->image_x >= p->image_width
|
||||||
|
&& increment_image_y (p) < 0)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
for (i = 0; i < len; ++i)
|
||||||
|
{
|
||||||
|
u_int16_t value = buf [i];
|
||||||
|
if ((i % 2) == 1)
|
||||||
|
p->image_data[p->image_offset++] = *(u_int8_t *) (&value);
|
||||||
|
if (p->image_offset%6 == 0)
|
||||||
|
{
|
||||||
|
if (++p->image_x >= p->image_width
|
||||||
|
&& increment_image_y (p) < 0)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
goto bad_depth;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -614,6 +662,27 @@ input_available (gpointer data, gint source, GdkInputCondition cond)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 16:
|
||||||
|
for (i = 0; i < len; ++i)
|
||||||
|
{
|
||||||
|
u_int16_t value = buf [i];
|
||||||
|
if ((i % 2) == 1)
|
||||||
|
{
|
||||||
|
p->image_data[p->image_offset++] =
|
||||||
|
*(u_int8_t *) (&value);
|
||||||
|
p->image_data[p->image_offset++] =
|
||||||
|
*(u_int8_t *) (&value);
|
||||||
|
p->image_data[p->image_offset++] =
|
||||||
|
*(u_int8_t *) (&value);
|
||||||
|
}
|
||||||
|
if (p->image_offset%2 == 0)
|
||||||
|
{
|
||||||
|
if (++p->image_x >= p->image_width
|
||||||
|
&& increment_image_y (p) < 0)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
goto bad_depth;
|
goto bad_depth;
|
||||||
|
@ -634,7 +703,7 @@ input_available (gpointer data, gint source, GdkInputCondition cond)
|
||||||
{
|
{
|
||||||
u_char gl = (mask & 1) ? 0xff : 0x00;
|
u_char gl = (mask & 1) ? 0xff : 0x00;
|
||||||
mask >>= 1;
|
mask >>= 1;
|
||||||
p->image_data[p->image_offset++] = gl;
|
p->image_data[p->image_offset] = gl;
|
||||||
p->image_offset += 3;
|
p->image_offset += 3;
|
||||||
if (++p->image_x >= p->image_width
|
if (++p->image_x >= p->image_width
|
||||||
&& increment_image_y (p) < 0)
|
&& increment_image_y (p) < 0)
|
||||||
|
@ -653,6 +722,24 @@ input_available (gpointer data, gint source, GdkInputCondition cond)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 16:
|
||||||
|
for (i = 0; i < len; ++i)
|
||||||
|
{
|
||||||
|
u_int16_t value = buf [i];
|
||||||
|
if ((i % 2) == 1)
|
||||||
|
{
|
||||||
|
p->image_data[p->image_offset] = *(u_int8_t *) (&value);
|
||||||
|
p->image_offset += 3;
|
||||||
|
}
|
||||||
|
if (p->image_offset % 2 == 0)
|
||||||
|
{
|
||||||
|
if (++p->image_x >= p->image_width
|
||||||
|
&& increment_image_y (p) < 0)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
goto bad_depth;
|
goto bad_depth;
|
||||||
|
|
Ładowanie…
Reference in New Issue