mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-02-01 18:11:14 -05:00
Tweaked zone image dumping.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@3066 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
@@ -597,7 +597,7 @@ int Monitor::GetImage( int index, int scale ) const
|
||||
}
|
||||
|
||||
static char filename[PATH_MAX];
|
||||
snprintf( filename, sizeof(filename), "%s.jpg", name );
|
||||
snprintf( filename, sizeof(filename), "Monitor%d.jpg", id );
|
||||
if ( !config.timestamp_on_capture )
|
||||
{
|
||||
TimestampImage( &snap_image, snap->timestamp );
|
||||
@@ -933,29 +933,36 @@ void Monitor::DumpZoneImage( const char *zone_string )
|
||||
zone_image.Colourise();
|
||||
for( int i = 0; i < n_zones; i++ )
|
||||
{
|
||||
if ( exclude_id && zones[i]->Id() == exclude_id )
|
||||
if ( exclude_id && (!extra_colour || extra_zone.getNumCoords()) && zones[i]->Id() == exclude_id )
|
||||
continue;
|
||||
|
||||
Rgb colour;
|
||||
if ( zones[i]->IsActive() )
|
||||
if ( exclude_id && !extra_zone.getNumCoords() && zones[i]->Id() == exclude_id )
|
||||
{
|
||||
colour = RGB_RED;
|
||||
}
|
||||
else if ( zones[i]->IsInclusive() )
|
||||
{
|
||||
colour = RGB_ORANGE;
|
||||
}
|
||||
else if ( zones[i]->IsExclusive() )
|
||||
{
|
||||
colour = RGB_PURPLE;
|
||||
}
|
||||
else if ( zones[i]->IsPreclusive() )
|
||||
{
|
||||
colour = RGB_BLUE;
|
||||
colour = extra_colour;
|
||||
}
|
||||
else
|
||||
{
|
||||
colour = RGB_WHITE;
|
||||
if ( zones[i]->IsActive() )
|
||||
{
|
||||
colour = RGB_RED;
|
||||
}
|
||||
else if ( zones[i]->IsInclusive() )
|
||||
{
|
||||
colour = RGB_ORANGE;
|
||||
}
|
||||
else if ( zones[i]->IsExclusive() )
|
||||
{
|
||||
colour = RGB_PURPLE;
|
||||
}
|
||||
else if ( zones[i]->IsPreclusive() )
|
||||
{
|
||||
colour = RGB_BLUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
colour = RGB_WHITE;
|
||||
}
|
||||
}
|
||||
zone_image.Fill( colour, 2, zones[i]->GetPolygon() );
|
||||
zone_image.Outline( colour, zones[i]->GetPolygon() );
|
||||
@@ -978,8 +985,8 @@ void Monitor::DumpImage( Image *dump_image ) const
|
||||
{
|
||||
static char filename[PATH_MAX];
|
||||
static char new_filename[PATH_MAX];
|
||||
snprintf( filename, sizeof(filename), "%s.jpg", name );
|
||||
snprintf( new_filename, sizeof(new_filename), "%s-new.jpg", name );
|
||||
snprintf( filename, sizeof(filename), "Monitor%d.jpg", id );
|
||||
snprintf( new_filename, sizeof(new_filename), "Monitor%d-new.jpg", id );
|
||||
dump_image->WriteJpeg( new_filename );
|
||||
rename( new_filename, filename );
|
||||
}
|
||||
|
||||
@@ -834,7 +834,7 @@ bool Zone::ParseZoneString( const char *zone_string, int &zone_id, int &colour,
|
||||
char *ws = strchr( str, ' ' );
|
||||
if ( !ws )
|
||||
{
|
||||
Debug( 3, "No whitespace found in zone string '%s', finishing", zone_string );
|
||||
Debug( 3, "No initial whitespace found in zone string '%s', finishing", str );
|
||||
}
|
||||
zone_id = strtol( str, 0, 10 );
|
||||
Debug( 3, "Got zone %d from zone string", zone_id );
|
||||
@@ -850,13 +850,16 @@ bool Zone::ParseZoneString( const char *zone_string, int &zone_id, int &colour,
|
||||
ws = strchr( str, ' ' );
|
||||
if ( !ws )
|
||||
{
|
||||
Error( "No whitespace found in zone string '%s'", zone_string );
|
||||
delete[] str_ptr;
|
||||
return( false );
|
||||
Debug( 3, "No secondary whitespace found in zone string '%s', finishing", zone_string );
|
||||
}
|
||||
*ws = '\0';
|
||||
colour = strtol( str, 0, 16 );
|
||||
Debug( 3, "Got colour %06x from zone string", colour );
|
||||
if ( !ws )
|
||||
{
|
||||
delete str_ptr;
|
||||
return( true );
|
||||
}
|
||||
*ws = '\0';
|
||||
str = ws+1;
|
||||
|
||||
bool result = ParsePolygonString( str, polygon );
|
||||
|
||||
@@ -493,9 +493,9 @@ int main( int argc, char *argv[] )
|
||||
if ( verbose )
|
||||
{
|
||||
if ( image_idx == -1 )
|
||||
printf( "Dumping last image captured to %s.jpg", monitor->Name() );
|
||||
printf( "Dumping last image captured to Monitor%d.jpg", monitor->Id() );
|
||||
else
|
||||
printf( "Dumping buffer image %d to %s.jpg", image_idx, monitor->Name() );
|
||||
printf( "Dumping buffer image %d to Monitor%d.jpg", image_idx, monitor->Id() );
|
||||
if ( scale != -1 )
|
||||
printf( ", scaling by %d%%", scale );
|
||||
printf( "\n" );
|
||||
@@ -505,7 +505,7 @@ int main( int argc, char *argv[] )
|
||||
if ( function & ZMU_ZONES )
|
||||
{
|
||||
if ( verbose )
|
||||
printf( "Dumping zone image to %s-Zones.jpg\n", monitor->Name() );
|
||||
printf( "Dumping zone image to Zones%d.jpg\n", monitor->Id() );
|
||||
monitor->DumpZoneImage( zoneString );
|
||||
}
|
||||
if ( function & ZMU_ALARM )
|
||||
|
||||
Reference in New Issue
Block a user