Blacken Zones are now correctly displayed

pull/1026/head
Robin Daermann 2015-08-20 15:01:07 +02:00
parent 8f9ed96585
commit 6fc4525784
3 changed files with 19 additions and 39 deletions

View File

@ -1737,45 +1737,25 @@ const Coord Image::centreCoord( const char *text ) const
void Image::Blacken( const unsigned char *p_bitmask, const Rgb pixel_colour )
{
unsigned int s_width = 200;
unsigned int s_height = 100;
const uint8_t pixel_r_col = RED_VAL_RGBA(pixel_colour);
const uint8_t pixel_g_col = GREEN_VAL_RGBA(pixel_colour);
const uint8_t pixel_b_col = BLUE_VAL_RGBA(pixel_colour);
//const uint8_t pixel_r_col = RED_VAL_RGBA(pixel_colour);
//const uint8_t pixel_g_col = GREEN_VAL_RGBA(pixel_colour);
//const uint8_t pixel_b_col = BLUE_VAL_RGBA(pixel_colour);
const uint8_t pixel_bw_col = pixel_colour & 0xff;
const Rgb pixel_rgb_col = rgb_convert(pixel_colour,subpixelorder);
//const Rgb pixel_rgb_col = rgb_convert(pixel_colour,subpixelorder);
for ( unsigned int y = 0; y < s_height; y++ )
unsigned char *ptr = &buffer[0];
unsigned int i = 0;
for ( unsigned int y = 0; y < height; y++ )
{
if ( colours == ZM_COLOUR_GRAY8 )
{
//unsigned char *ptr = &buffer[(lo_line_y*width)+lo_line_x];
unsigned char *ptr = &buffer[(y*width)+0];
for ( unsigned int x = 0; x < s_width; x++, ptr++ )
for ( unsigned int x = 0; x < width; x++, ptr++ )
{
unsigned char *temp_ptr = ptr;
*temp_ptr = pixel_bw_col;
// for ( unsigned int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ )
//
// int f;
// if (size == 2)
// f = bigfontdata[(line[c] * CHAR_HEIGHT * size) + r];
// else
// f = fontdata[(line[c] * CHAR_HEIGHT) + r];
// for ( unsigned int i = 0; i < (CHAR_WIDTH * size) && x < hi_line_x; i++, x++, temp_ptr++ )
// {
// if ( f & (zm_text_bitmask >> i) )
// {
// if ( !fg_trans )
// *temp_ptr = fg_bw_col;
// }
// else if ( !bg_trans )
// {
// *temp_ptr = bg_bw_col;
// }
// }
// }
if ( *ptr & p_bitmask[i] )
*temp_ptr = pixel_bw_col;
i++;
}
}
// else if ( colours == ZM_COLOUR_RGB24 )

View File

@ -691,7 +691,7 @@ void Monitor::AddZones( int p_n_zones, Zone *p_zones[] )
zones = p_zones;
}
void Monitor::AddBlackenBitmap( Zone *p_zones[] )
void Monitor::AddBlackenBitmask( Zone *p_zones[] )
{
delete[] blacken_bitmask;
blacken_bitmask = NULL;
@ -2205,7 +2205,7 @@ Debug( 1, "Got %d for v4l_captures_per_frame", v4l_captures_per_frame );
Zone **zones = 0;
int n_zones = Zone::Load( monitors[i], zones );
monitors[i]->AddZones( n_zones, zones );
monitors[i]->AddBlackenBitmap( zones );
monitors[i]->AddBlackenBitmask( zones );
Debug( 1, "Loaded monitor %d(%s), %d zones", id, name, n_zones );
}
if ( mysql_errno( &dbconn ) )
@ -2387,7 +2387,7 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c
Zone **zones = 0;
int n_zones = Zone::Load( monitors[i], zones );
monitors[i]->AddZones( n_zones, zones );
monitors[i]->AddBlackenBitmap( zones );
monitors[i]->AddBlackenBitmask( zones );
Debug( 1, "Loaded monitor %d(%s), %d zones", id, name.c_str(), n_zones );
}
if ( mysql_errno( &dbconn ) )
@ -2532,7 +2532,7 @@ int Monitor::LoadFileMonitors( const char *file, Monitor **&monitors, Purpose pu
Zone **zones = 0;
int n_zones = Zone::Load( monitors[i], zones );
monitors[i]->AddZones( n_zones, zones );
monitors[i]->AddBlackenBitmap( zones );
monitors[i]->AddBlackenBitmask( zones );
Debug( 1, "Loaded monitor %d(%s), %d zones", id, name, n_zones );
}
if ( mysql_errno( &dbconn ) )
@ -2682,7 +2682,7 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose
Zone **zones = 0;
int n_zones = Zone::Load( monitors[i], zones );
monitors[i]->AddZones( n_zones, zones );
monitors[i]->AddBlackenBitmap( zones );
monitors[i]->AddBlackenBitmask( zones );
Debug( 1, "Loaded monitor %d(%s), %d zones", id, name, n_zones );
}
if ( mysql_errno( &dbconn ) )
@ -3010,7 +3010,7 @@ Debug( 1, "Got %d for v4l_captures_per_frame", v4l_captures_per_frame );
Zone **zones = 0;
n_zones = Zone::Load( monitor, zones );
monitor->AddZones( n_zones, zones );
monitor->AddBlackenBitmap( zones );
monitor->AddBlackenBitmask( zones );
}
Debug( 1, "Loaded monitor %d(%s), %d zones", id, name.c_str(), n_zones );
}

View File

@ -311,7 +311,7 @@ public:
~Monitor();
void AddZones( int p_n_zones, Zone *p_zones[] );
void AddBlackenBitmap( Zone *p_zones[] );
void AddBlackenBitmask( Zone *p_zones[] );
bool connect();
inline int ShmValid() const