kopia lustrzana https://gitlab.com/sane-project/frontends
For Gray mode added time stamp option, remove compiler warning
rodzic
98b025d3de
commit
7336b06465
41
src/xcam.c
41
src/xcam.c
|
@ -6,6 +6,8 @@
|
|||
The add_text routine and font_6x11.h file are taken from the (GPLed)
|
||||
webcam.c file, part of xawtv, (c) 1998-2002 Gerd Knorr.
|
||||
add_text was modified for this program (xcam_add_text).
|
||||
Update 2008 Gerard Klaver
|
||||
Added add_text routine to gray images.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
|
@ -339,6 +341,8 @@ xcam_add_text (SANE_Byte * image, int width, int height, char *txt)
|
|||
int i, x, y, f, len;
|
||||
char fmtstring[25] = " %Y-%m-%d %H:%M:%S";
|
||||
char fmttxt[46];
|
||||
char buf[100];
|
||||
|
||||
|
||||
DBG (DBG_debug, "xcam_add_text: enter\n");
|
||||
time (&t);
|
||||
|
@ -351,6 +355,10 @@ xcam_add_text (SANE_Byte * image, int width, int height, char *txt)
|
|||
|
||||
len = strftime (line, MSG_MAXLEN, fmttxt, tm);
|
||||
|
||||
switch (win.params.format)
|
||||
{
|
||||
case SANE_FRAME_RGB:
|
||||
|
||||
for (y = 0; y < CHAR_HEIGHT; y++)
|
||||
{
|
||||
ptr = image + 3 * width * (height - CHAR_HEIGHT - 2 + y) + 12;
|
||||
|
@ -370,7 +378,33 @@ xcam_add_text (SANE_Byte * image, int width, int height, char *txt)
|
|||
} /* for i */
|
||||
} /* for x */
|
||||
} /* for y */
|
||||
break;
|
||||
case SANE_FRAME_GRAY:
|
||||
|
||||
for (y = 0; y < CHAR_HEIGHT; y++)
|
||||
{
|
||||
ptr = image + width * (height - CHAR_HEIGHT - 2 + y) + 12;
|
||||
|
||||
for (x = 0; x < len; x++)
|
||||
{
|
||||
f = fontdata[line[x] * CHAR_HEIGHT + y];
|
||||
for (i = CHAR_WIDTH - 1; i >= 0; i--)
|
||||
{
|
||||
if (f & (CHAR_START << i))
|
||||
{
|
||||
ptr[0] = 255;
|
||||
}
|
||||
ptr += 1;
|
||||
} /* for i */
|
||||
} /* for x */
|
||||
} /* for y */
|
||||
case SANE_FRAME_RED:
|
||||
case SANE_FRAME_GREEN:
|
||||
case SANE_FRAME_BLUE:
|
||||
snprintf (buf, sizeof (buf),
|
||||
"Time stamp for separate channel transfers are not supported");
|
||||
break;
|
||||
}
|
||||
DBG (DBG_debug, "xcam_add_text: exit vw=%d, vh=%d\n", width, height);
|
||||
status = (SANE_STATUS_GOOD);
|
||||
return status;
|
||||
|
@ -1107,7 +1141,7 @@ input_available (gpointer ignore, gint source, GdkInputCondition cond)
|
|||
(win.fps_old3 + win.fps_old2 + win.fps_old1 + win.fps) / 4;
|
||||
|
||||
DBG (DBG_debug,
|
||||
"xcam: input_available fps count=%d, frame_time * 30 = %2.3f, fps=%2.3f, fps_av=%2.3f\n",
|
||||
"xcam: input_available fps count=%ld, frame_time * 30 = %2.3f, fps=%2.3f, fps_av=%2.3f\n",
|
||||
win.f_count, frame_time, win.fps, win.fps_av);
|
||||
win.i_time = 0;
|
||||
|
||||
|
@ -1287,7 +1321,7 @@ save_frame_button (GtkWidget * widget, gpointer client_data,
|
|||
|
||||
/* test for pnm formats */
|
||||
strncpy (testfilename, preferences.filename, sizeof (testfilename));
|
||||
testfilename[sizeof (testfilename)] = 0;
|
||||
testfilename[sizeof (testfilename) - 1] = 0;
|
||||
g_strreverse (testfilename);
|
||||
if (!((!strncmp (testfilename, "mnp.", 4)) ||
|
||||
(!strncmp (testfilename, "mgp.", 4)) ||
|
||||
|
@ -1597,7 +1631,8 @@ main (int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
DBG (DBG_debug, "xcam.main: buf_backend_size 0x%x\n", win.buf_backend_size);
|
||||
DBG (DBG_debug, "xcam.main: buf_backend_size 0x%x\n",
|
||||
(unsigned) win.buf_backend_size);
|
||||
|
||||
win.buf = malloc (win.buf_backend_size);
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue