Bug 198 - Added initial hooks for optional comment in jpeg headers.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1596 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2005-11-19 18:43:46 +00:00
parent b2a7183f12
commit 65532674e6
2 changed files with 21 additions and 7 deletions

View File

@ -205,10 +205,15 @@ bool Image::WriteJpeg( const char *filename, int quality_override ) const
{
cinfo.in_color_space = JCS_RGB; /* colorspace of input image */
}
jpeg_set_defaults(&cinfo);
jpeg_set_defaults( &cinfo );
cinfo.dct_method = JDCT_FASTEST;
jpeg_set_quality(&cinfo, quality_override?quality_override:config.jpeg_file_quality, false);
jpeg_start_compress(&cinfo, TRUE);
jpeg_set_quality( &cinfo, quality_override?quality_override:config.jpeg_file_quality, false );
jpeg_start_compress( &cinfo, TRUE );
if ( true && text[0] )
{
jpeg_write_marker( &cinfo, JPEG_COM, (const JOCTET *)text, strlen(text) );
}
JSAMPROW row_pointer; /* pointer to a single row */
int row_stride = cinfo.image_width * cinfo.input_components; /* physical row width in buffer */
@ -594,8 +599,10 @@ Image *Image::Delta( const Image &image ) const
return( result );
}
void Image::Annotate( const char *text, const Coord &coord, const Rgb colour )
void Image::Annotate( const char *p_text, const Coord &coord, const Rgb colour )
{
strncpy( text, p_text, sizeof(text) );
int text_len = strlen( text );
int text_width = text_len * CHAR_WIDTH;
int text_height = CHAR_HEIGHT;
@ -647,8 +654,10 @@ void Image::Annotate( const char *text, const Coord &coord, const Rgb colour )
}
}
void Image::Annotate( const char *text, const Coord &coord )
void Image::Annotate( const char *p_text, const Coord &coord )
{
strncpy( text, p_text, sizeof(text) );
int text_len = strlen( text );
int text_width = text_len * CHAR_WIDTH;
int text_height = CHAR_HEIGHT;

View File

@ -63,6 +63,7 @@ protected:
int size;
JSAMPLE *buffer;
bool our_buffer;
char text[256];
protected:
mutable unsigned int *blend_buffer;
@ -83,6 +84,7 @@ public:
our_buffer = true;
buffer = 0;
blend_buffer = 0;
text[0] = '\0';
}
Image( const char *filename )
{
@ -92,6 +94,7 @@ public:
ReadJpeg( filename );
our_buffer = true;
blend_buffer = 0;
text[0] = '\0';
}
Image( int p_width, int p_height, int p_colours, JSAMPLE *p_buffer=0 )
{
@ -113,6 +116,7 @@ public:
memset( buffer, 0, size );
}
blend_buffer = 0;
text[0] = '\0';
}
Image( const Image &p_image )
{
@ -126,6 +130,7 @@ public:
memcpy( buffer, p_image.buffer, size );
our_buffer = true;
blend_buffer = 0;
strncpy( text, p_image.text, sizeof(text) );
}
~Image()
{
@ -203,8 +208,8 @@ public:
static Image *Highlight( int n_images, Image *images[], const Rgb threshold=RGB_BLACK, const Rgb ref_colour=RGB_RED );
Image *Delta( const Image &image ) const;
void Annotate( const char *text, const Coord &coord, const Rgb colour );
void Annotate( const char *text, const Coord &coord );
void Annotate( const char *p_text, const Coord &coord, const Rgb colour );
void Annotate( const char *p_text, const Coord &coord );
Image *HighlightEdges( Rgb colour, const Box *limits=0 );
void Timestamp( const char *label, const time_t when, const Coord &coord );
void Colourise();