}
SubMask *mask = gui->mask_keyframe->get_submask(mwindow->edl->session->cwindow_mask);
-
+ if( get_buttonpress() == WHEEL_UP || get_buttonpress() == WHEEL_DOWN ) {
+ if( !gui->shift_down() ) {
+ mwindow->undo->update_undo_before(_("mask rotate"), this);
+ gui->current_operation = CWINDOW_MASK_ROTATE;
+ }
+ else {
+ mwindow->undo->update_undo_before(_("mask scale"), this);
+ gui->current_operation = CWINDOW_MASK_SCALE;
+ }
+ gui->affected_point = 0;
+ }
+ else
// Translate entire keyframe
if(gui->alt_down() && mask->points.size()) {
mwindow->undo->update_undo_before(_("mask translate"), 0);
if(button_press && result) {
#ifdef USE_KEYFRAME_SPANNING
- MaskPoint *point = points.values[gui->affected_point];
- gui->center_x = point->x;
- gui->center_y = point->y;
- gui->control_in_x = point->control_x1;
- gui->control_in_y = point->control_y1;
- gui->control_out_x = point->control_x2;
- gui->control_out_y = point->control_y2;
- gui->tool_panel->raise_window();
+ ArrayList<MaskPoint*> &mask_points = points;
#else
SubMask *mask = gui->mask_keyframe->get_submask(mwindow->edl->session->cwindow_mask);
- MaskPoint *point = mask->points.values[gui->affected_point];
+ ArrayList<MaskPoint*> &mask_points = mask->points;
+#endif
+ MaskPoint *point = mask_points.values[gui->affected_point];
gui->center_x = point->x;
gui->center_y = point->y;
gui->control_in_x = point->control_x1;
gui->control_out_x = point->control_x2;
gui->control_out_y = point->control_y2;
gui->tool_panel->raise_window();
-#endif
}
//printf("CWindowCanvas::do_mask 8\n");
- if(cursor_motion) {
+ if( cursor_motion ) {
#ifdef USE_KEYFRAME_SPANNING
// Must update the reference keyframes for every cursor motion
- gui->mask_keyframe =
- (MaskAuto*)gui->cwindow->calculate_affected_auto(
- mask_autos,
- 0);
+ gui->mask_keyframe = (MaskAuto*)gui->cwindow->
+ calculate_affected_auto(mask_autos, 0);
gui->orig_mask_keyframe->copy_data(gui->mask_keyframe);
#endif
gui->current_operation != CWINDOW_NONE) {
// mwindow->undo->update_undo_before(_("mask point"), this);
#ifdef USE_KEYFRAME_SPANNING
- MaskPoint *point = points.get(gui->affected_point);
+ ArrayList<MaskPoint*> &mask_points = points;
#else
- MaskPoint *point = mask->points.get(gui->affected_point);
+ ArrayList<MaskPoint*> &mask_points = mask->points;
#endif
+ MaskPoint *point = mask_points.get(gui->affected_point);
// canvas_to_output(mwindow->edl, 0, cursor_x, cursor_y);
-//printf("CWindowCanvas::do_mask 9 %d %d\n", mask->points.size(), gui->affected_point);
+//printf("CWindowCanvas::do_mask 9 %d %d\n", mask_points.size(), gui->affected_point);
float last_x = point->x;
float last_y = point->y;
float last_control_y1 = point->control_y1;
float last_control_x2 = point->control_x2;
float last_control_y2 = point->control_y2;
+ int rotate = 0;
switch(gui->current_operation) {
- case CWINDOW_MASK:
+ case CWINDOW_MASK:
//printf("CWindowCanvas::do_mask %d %d\n", __LINE__, gui->affected_point);
- point->x = mask_cursor_x - gui->x_origin + gui->center_x;
- point->y = mask_cursor_y - gui->y_origin + gui->center_y;
- break;
+ point->x = mask_cursor_x - gui->x_origin + gui->center_x;
+ point->y = mask_cursor_y - gui->y_origin + gui->center_y;
+ break;
- case CWINDOW_MASK_CONTROL_IN:
- point->control_x1 = mask_cursor_x - gui->x_origin + gui->control_in_x;
- point->control_y1 = mask_cursor_y - gui->y_origin + gui->control_in_y;
- break;
+ case CWINDOW_MASK_CONTROL_IN:
+ point->control_x1 = mask_cursor_x - gui->x_origin + gui->control_in_x;
+ point->control_y1 = mask_cursor_y - gui->y_origin + gui->control_in_y;
+ break;
- case CWINDOW_MASK_CONTROL_OUT:
- point->control_x2 = mask_cursor_x - gui->x_origin + gui->control_out_x;
- point->control_y2 = mask_cursor_y - gui->y_origin + gui->control_out_y;
- break;
+ case CWINDOW_MASK_CONTROL_OUT:
+ point->control_x2 = mask_cursor_x - gui->x_origin + gui->control_out_x;
+ point->control_y2 = mask_cursor_y - gui->y_origin + gui->control_out_y;
+ break;
- case CWINDOW_MASK_TRANSLATE:
-#ifdef USE_KEYFRAME_SPANNING
- for(int i = 0; i < points.size(); i++) {
- points.values[i]->x += mask_cursor_x - gui->x_origin;
- points.values[i]->y += mask_cursor_y - gui->y_origin;
- }
-#else
- for(int i = 0; i < mask->points.size(); i++) {
- mask->points.values[i]->x += mask_cursor_x - gui->x_origin;
- mask->points.values[i]->y += mask_cursor_y - gui->y_origin;
- }
-#endif
- gui->x_origin = mask_cursor_x;
- gui->y_origin = mask_cursor_y;
- break;
+ case CWINDOW_MASK_TRANSLATE:
+ for(int i = 0; i < mask_points.size(); i++) {
+ mask_points.values[i]->x += mask_cursor_x - gui->x_origin;
+ mask_points.values[i]->y += mask_cursor_y - gui->y_origin;
+ }
+ gui->x_origin = mask_cursor_x;
+ gui->y_origin = mask_cursor_y;
+ break;
+ case CWINDOW_MASK_ROTATE:
+ rotate = 1;
+ case CWINDOW_MASK_SCALE: {
+ int button_no = get_buttonpress();
+ double scale = button_no == WHEEL_UP ? 1.02 : 0.98;
+ double theta = button_no == WHEEL_UP ? M_PI/360. : -M_PI/360.;
+ float st = sin(theta), ct = cos(theta);
+ gui->x_origin = mask_cursor_x;
+ gui->y_origin = mask_cursor_y;
+ for( int i=0; i<mask_points.size(); ++i ) {
+ MaskPoint *point = mask_points.values[i];
+ float px = point->x - mask_cursor_x;
+ float py = point->y - mask_cursor_y;
+ float nx = !rotate ? px*scale : px*ct + py*st;
+ float ny = !rotate ? py*scale : py*ct - px*st;
+ point->x = nx + mask_cursor_x;
+ point->y = ny + mask_cursor_y;
+ }
+ break; }
}
if( !EQUIV(last_x, point->x) ||
break;
case CWINDOW_MASK:
- if(get_buttonpress() == 1)
+ switch( get_buttonpress() ) {
+ case LEFT_BUTTON:
result = do_mask(redraw, rerender, 1, 0, 0);
+ break;
+ case WHEEL_UP:
+ case WHEEL_DOWN:
+ result = do_mask(redraw, rerender, 1, 1, 0);
+ break;
+ }
+ if( result ) redraw_canvas = 1;
break;
case CWINDOW_EYEDROP:
int CWindowCanvas::button_release_event()
{
int result = 0;
+ const char *undo_label = 0;
switch(gui->current_operation)
{
break;
case CWINDOW_CAMERA:
- mwindow->undo->update_undo_after(_("camera"), LOAD_AUTOMATION);
+ undo_label = _("camera");
break;
case CWINDOW_PROJECTOR:
- mwindow->undo->update_undo_after(_("projector"), LOAD_AUTOMATION);
+ undo_label = _("projector");
break;
case CWINDOW_MASK:
case CWINDOW_MASK_TRANSLATE:
// Finish mask operation
gui->mask_keyframe = 0;
- mwindow->undo->update_undo_after(_("mask"), LOAD_AUTOMATION);
+ undo_label = _("mask");
+ break;
+ case CWINDOW_MASK_ROTATE:
+ gui->mask_keyframe = 0;
+ undo_label = _("mask rotate");
+ break;
+ case CWINDOW_MASK_SCALE:
+ gui->mask_keyframe = 0;
+ undo_label = _("mask scale");
break;
case CWINDOW_NONE:
result = Canvas::button_release_event();
break;
}
+ if( undo_label )
+ mwindow->undo->update_undo_after(undo_label, LOAD_AUTOMATION);
gui->current_operation = CWINDOW_NONE;
return result;
}
CWindowCoord::CWindowCoord(CWindowToolGUI *gui, int x, int y, float value, int log_increment = 0)
- : BC_TumbleTextBox(gui, (float)value, (float)-65536, (float)65536, x, y, 100)
+ : BC_TumbleTextBox(gui, (float)value, (float)-65536, (float)65536, x, y, 100, 3)
{
this->gui = gui;
set_log_floatincrement(log_increment);
}
CWindowCoord::CWindowCoord(CWindowToolGUI *gui, int x, int y, int value)
- : BC_TumbleTextBox(gui, (int64_t)value, (int64_t)-65536, (int64_t)65536, x, y, 100)
+ : BC_TumbleTextBox(gui, (int64_t)value, (int64_t)-65536, (int64_t)65536, x, y, 100, 3)
{
this->gui = gui;
}
}
-CWindowMaskMode::CWindowMaskMode(MWindow *mwindow,
+CWindowMaskName::CWindowMaskName(MWindow *mwindow,
CWindowToolGUI *gui, int x, int y, const char *text)
- : BC_PopupMenu(x, y, 220, text, 1)
+ : BC_PopupTextBox(gui, 0, text, x, y, 100, 160)
{
this->mwindow = mwindow;
this->gui = gui;
}
-void CWindowMaskMode::create_objects()
+CWindowMaskName::~CWindowMaskName()
{
- add_item(new BC_MenuItem(mode_to_text(MASK_MULTIPLY_ALPHA)));
- add_item(new BC_MenuItem(mode_to_text(MASK_SUBTRACT_ALPHA)));
}
-char* CWindowMaskMode::mode_to_text(int mode)
+int CWindowMaskName::handle_event()
{
- switch(mode)
- {
- case MASK_MULTIPLY_ALPHA:
- return _("Multiply alpha");
- break;
-
- case MASK_SUBTRACT_ALPHA:
- return _("Subtract alpha");
- break;
+ Track *track;
+ MaskAutos *autos;
+ MaskAuto *keyframe;
+ SubMask *mask;
+ MaskPoint *point;
+//printf("CWindowMaskGUI::update 1\n");
+ ((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 0);
+ if( track ) {
+ int k = get_number();
+ if( k < 0 ) k = mwindow->edl->session->cwindow_mask;
+ else mwindow->edl->session->cwindow_mask = k;
+ if( k >= 0 && k < mask_items.size() ) {
+ mask_items[k]->set_text(get_text());
+ update_list(&mask_items);
+ }
+#ifdef USE_KEYFRAME_SPANNING
+ MaskAuto temp_keyframe(mwindow->edl, autos);
+ temp_keyframe.copy_data(keyframe);
+ SubMask *submask = temp_keyframe.get_submask(mwindow->edl->session->cwindow_mask);
+ memset(submask->name, 0, sizeof(submask->name));
+ strncpy(submask->name, get_text(), sizeof(submask->name)-1);
+ ((MaskAutos*)track->automation->autos[AUTOMATION_MASK])->update_parameter(&temp_keyframe);
+#else
+ for(MaskAuto *current = (MaskAuto*)autos->default_auto; current; ) {
+ SubMask *submask = current->get_submask(mwindow->edl->session->cwindow_mask);
+ memset(submask->name, 0, sizeof(submask->name));
+ strncpy(submask->name, get_text(), sizeof(submask->name));
+ current = current == (MaskAuto*)autos->default_auto ?
+ (MaskAuto*)autos->first : (MaskAuto*)NEXT;
+ }
+#endif
+ gui->update();
+ gui->update_preview();
}
-
- return _("Subtract alpha");
+ return 1;
}
-int CWindowMaskMode::text_to_mode(char *text)
+void CWindowMaskName::update_items(MaskAuto *keyframe)
{
- if(!strcasecmp(text, _("Multiply alpha")))
- return MASK_MULTIPLY_ALPHA;
- else
- if(!strcasecmp(text, _("Subtract alpha")))
- return MASK_SUBTRACT_ALPHA;
+ mask_items.remove_all_objects();
+ int sz = keyframe->masks.size();
+ for( int i=0; i<sz; ++i ) {
+ SubMask *sub_mask = keyframe->masks.get(i);
+ char *text = sub_mask->name;
+ mask_items.append(new BC_ListBoxItem(text));
+ }
+ update_list(&mask_items);
+}
- return MASK_SUBTRACT_ALPHA;
+
+CWindowMaskDelMask::CWindowMaskDelMask(MWindow *mwindow,
+ CWindowToolGUI *gui, int x, int y)
+ : BC_GenericButton(x, y, _("Delete"))
+{
+ this->mwindow = mwindow;
+ this->gui = gui;
+ set_tooltip(_("Delete mask"));
}
-int CWindowMaskMode::handle_event()
+int CWindowMaskDelMask::handle_event()
{
MaskAutos *autos;
MaskAuto *keyframe;
Track *track;
MaskPoint *point;
SubMask *mask;
+
// Get existing keyframe
((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 0);
- if(track)
- {
- mwindow->undo->update_undo_before(_("mask mode"), 0);
+
+ if( track ) {
+ mwindow->undo->update_undo_before(_("mask delete"), 0);
+
#ifdef USE_KEYFRAME_SPANNING
// Create temp keyframe
MaskAuto temp_keyframe(mwindow->edl, autos);
temp_keyframe.copy_data(keyframe);
// Update parameter
- temp_keyframe.mode = text_to_mode(get_text());
+ SubMask *submask = temp_keyframe.get_submask(mwindow->edl->session->cwindow_mask);
+ submask->points.remove_all_objects();
// Commit change to span of keyframes
- autos->update_parameter(&temp_keyframe);
+ ((MaskAutos*)track->automation->autos[AUTOMATION_MASK])->update_parameter(&temp_keyframe);
#else
- ((MaskAuto*)autos->default_auto)->mode =
- text_to_mode(get_text());
+ for(MaskAuto *current = (MaskAuto*)autos->default_auto; current; ) {
+ SubMask *submask = current->get_submask(mwindow->edl->session->cwindow_mask);
+ submask->points.remove_all_objects();
+ current = current == (MaskAuto*)autos->default_auto ?
+ (MaskAuto*)autos->first : (MaskAuto*)NEXT;
+ }
#endif
- mwindow->undo->update_undo_after(_("mask mode"), LOAD_AUTOMATION);
+ gui->update();
+ gui->update_preview();
+ mwindow->undo->update_undo_after(_("mask delete"), LOAD_AUTOMATION);
}
-//printf("CWindowMaskMode::handle_event 1\n");
- gui->update_preview();
return 1;
}
-
-
-
-
-
-
-
-CWindowMaskDelete::CWindowMaskDelete(MWindow *mwindow,
- CWindowToolGUI *gui,
- int x,
- int y)
+CWindowMaskDelPoint::CWindowMaskDelPoint(MWindow *mwindow,
+ CWindowToolGUI *gui, int x, int y)
: BC_GenericButton(x, y, _("Delete"))
{
this->mwindow = mwindow;
this->gui = gui;
+ set_tooltip(_("Delete point"));
}
-int CWindowMaskDelete::handle_event()
+int CWindowMaskDelPoint::handle_event()
{
MaskAutos *autos;
MaskAuto *keyframe;
Track *track;
MaskPoint *point;
SubMask *mask;
- int total_points = 0;
+ int total_points;
// Get existing keyframe
((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 0);
-
- if(track)
- {
- mwindow->undo->update_undo_before(_("mask delete"), 0);
+ if( track ) {
+ mwindow->undo->update_undo_before(_("point delete"), 0);
#ifdef USE_KEYFRAME_SPANNING
// Create temp keyframe
temp_keyframe.copy_data(keyframe);
// Update parameter
SubMask *submask = temp_keyframe.get_submask(mwindow->edl->session->cwindow_mask);
- if( shift_down() )
- submask->points.remove_all_objects();
-
- for(int i = mwindow->cwindow->gui->affected_point;
- i < submask->points.total - 1;
- i++)
- {
- *submask->points.values[i] = *submask->points.values[i + 1];
- }
-
- if(submask->points.total)
- {
- submask->points.remove_object(
- submask->points.values[submask->points.total - 1]);
+ int i = mwindow->cwindow->gui->affected_point;
+ for( ; i<submask->points.total-1; ++i )
+ *submask->points.values[i] = *submask->points.values[i+1];
+ if( submask->points.total > 0 ) {
+ point = submask->points.values[submask->points.total-1];
+ submask->points.remove_object(point);
}
total_points = submask->points.total;
// Commit change to span of keyframes
((MaskAutos*)track->automation->autos[AUTOMATION_MASK])->update_parameter(&temp_keyframe);
#else
- for(MaskAuto *current = (MaskAuto*)autos->default_auto;
- current; )
- {
+ MaskAuto *current = (MaskAuto*)autos->default_auto;
+ while( current ) {
SubMask *submask = current->get_submask(mwindow->edl->session->cwindow_mask);
- if( shift_down() )
- submask->points.remove_all_objects();
-
- for(int i = mwindow->cwindow->gui->affected_point;
- i < submask->points.total - 1;
- i++)
- {
- *submask->points.values[i] = *submask->points.values[i + 1];
- }
-
- if(submask->points.total)
- {
- submask->points.remove_object(
- submask->points.values[submask->points.total - 1]);
+ int i = mwindow->cwindow->gui->affected_point;
+ for( ; i<submask->points.total-1; ++i ) {
+ *submask->points.values[i] = *submask->points.values[i+1];
+ if( submask->points.total > 0 ) {
+ point = submask->points.values[submask->points.total-1];
+ submask->points.remove_object(point);
}
total_points = submask->points.total;
-
- if(current == (MaskAuto*)autos->default_auto)
- current = (MaskAuto*)autos->first;
- else
- current = (MaskAuto*)NEXT;
+ current = current == (MaskAuto*)autos->default_auto ?
+ (MaskAuto*)autos->first : (MaskAuto*)NEXT;
}
#endif
if( mwindow->cwindow->gui->affected_point >= total_points )
mwindow->undo->update_undo_after(_("mask delete"), LOAD_AUTOMATION);
}
-
return 1;
}
-int CWindowMaskDelete::keypress_event()
+int CWindowMaskDelPoint::keypress_event()
{
- if(get_keypress() == BACKSPACE ||
- get_keypress() == DELETE)
+ if( get_keypress() == BACKSPACE ||
+ get_keypress() == DELETE )
return handle_event();
return 0;
}
-// CWindowMaskCycleNext::CWindowMaskCycleNext(MWindow *mwindow, CWindowToolGUI *gui, int x, int y)
-// : BC_GenericButton(x, y, _("Cycle next"))
-// {
-// this->mwindow = mwindow;
-// this->gui = gui;
-// }
-// int CWindowMaskCycleNext::handle_event()
-// {
-// MaskAuto *keyframe;
-// MaskAutos *autos;
-// Track *track;
-// MaskPoint *point;
-// SubMask *mask;
-// ((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 0);
-//
-// MaskPoint *temp;
-//
-// // Should apply to all keyframes
-// if(keyframe && mask->points.total)
-// {
-// temp = mask->points.values[0];
-//
-// for(int i = 0; i < mask->points.total - 1; i++)
-// {
-// mask->points.values[i] = mask->points.values[i + 1];
-// }
-// mask->points.values[mask->points.total - 1] = temp;
-//
-// mwindow->cwindow->gui->affected_point--;
-// if(mwindow->cwindow->gui->affected_point < 0)
-// mwindow->cwindow->gui->affected_point = mask->points.total - 1;
-//
-// gui->update();
-// gui->update_preview();
-// }
-//
-// return 1;
-// }
-//
-// CWindowMaskCyclePrev::CWindowMaskCyclePrev(MWindow *mwindow, CWindowToolGUI *gui, int x, int y)
-// : BC_GenericButton(x, y, _("Cycle prev"))
-// {
-// this->mwindow = mwindow;
-// this->gui = gui;
-// }
-// int CWindowMaskCyclePrev::handle_event()
-// {
-// MaskAuto *keyframe;
-// MaskAutos *autos;
-// Track *track;
-// MaskPoint *point;
-// SubMask *mask;
-// ((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 0);
-//
-// // Should apply to all keyframes
-// MaskPoint *temp;
-// if(keyframe && mask->points.total)
-// {
-// temp = mask->points.values[mask->points.total - 1];
-//
-// for(int i = mask->points.total - 1; i > 0; i--)
-// {
-// mask->points.values[i] = mask->points.values[i - 1];
-// }
-// mask->points.values[0] = temp;
-//
-// mwindow->cwindow->gui->affected_point++;
-// if(mwindow->cwindow->gui->affected_point >= mask->points.total)
-// mwindow->cwindow->gui->affected_point = 0;
-//
-// gui->update();
-// gui->update_preview();
-// }
-// return 1;
-// }
-
-
-CWindowMaskNumber::CWindowMaskNumber(MWindow *mwindow,
- CWindowToolGUI *gui,
- int x,
- int y)
- : BC_TumbleTextBox(gui,
- (int64_t)mwindow->edl->session->cwindow_mask,
- (int64_t)0,
- (int64_t)SUBMASKS - 1,
- x,
- y,
- 100)
-{
- this->mwindow = mwindow;
- this->gui = gui;
-}
-
-CWindowMaskNumber::~CWindowMaskNumber()
-{
-}
-
-int CWindowMaskNumber::handle_event()
-{
- mwindow->edl->session->cwindow_mask = atol(get_text());
- gui->update();
- gui->update_preview();
- return 1;
-}
CWindowMaskAffectedPoint::CWindowMaskAffectedPoint(MWindow *mwindow,
}
-
-
-
CWindowMaskFeather::CWindowMaskFeather(MWindow *mwindow, CWindowToolGUI *gui, int x, int y)
- : BC_TumbleTextBox(gui,
- (int64_t)0,
- (int64_t)0,
- (int64_t)0xff,
- x,
- y,
- 100)
+ : BC_TumbleTextBox(gui, 0, 0, 0xff, x, y, 64, 2)
{
this->mwindow = mwindow;
this->gui = gui;
CWindowMaskFeather::~CWindowMaskFeather()
{
}
-int CWindowMaskFeather::handle_event()
+
+int CWindowMaskFeather::update(float v)
+{
+ CWindowMaskGUI *mask_gui = (CWindowMaskGUI*)gui;
+ mask_gui->feather_slider->update(v);
+ return BC_TumbleTextBox::update(v);
+}
+
+int CWindowMaskFeather::update_value(float v)
{
MaskAutos *autos;
MaskAuto *keyframe;
// Get existing keyframe
((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe,
mask, point, create_it);
-
- if(track)
- {
+ if( track ) {
#ifdef USE_KEYFRAME_SPANNING
// Create temp keyframe
MaskAuto temp_keyframe(mwindow->edl, autos);
temp_keyframe.copy_data(keyframe);
// Update parameter
- temp_keyframe.feather = atof(get_text());
+ temp_keyframe.feather = v;
// Commit change to span of keyframes
autos->update_parameter(&temp_keyframe);
#else
- keyframe->feather = atof(get_text());
+ keyframe->feather = v;
#endif
gui->update_preview();
return 1;
}
+int CWindowMaskFeather::handle_event()
+{
+ float v = atof(get_text());
+ CWindowMaskGUI * mask_gui = (CWindowMaskGUI*)gui;
+ mask_gui->feather_slider->update(v);
+ return mask_gui->feather->update_value(v);
+}
-CWindowMaskValue::CWindowMaskValue(MWindow *mwindow, CWindowToolGUI *gui, int x, int y)
- : BC_ISlider(x,
- y,
- 0,
- 200,
- 200,
- 0,
- 100,
- 0)
+CWindowMaskFeatherSlider::CWindowMaskFeatherSlider(MWindow *mwindow,
+ CWindowToolGUI *gui, int x, int y, int w, float v)
+ : BC_FSlider(x, y, 0, w, w, 0.f, 255.f, v)
{
this->mwindow = mwindow;
this->gui = gui;
+ set_precision(0.01);
+}
+
+CWindowMaskFeatherSlider::~CWindowMaskFeatherSlider()
+{
+}
+
+int CWindowMaskFeatherSlider::handle_event()
+{
+ float v = get_value();
+ CWindowMaskGUI * mask_gui = (CWindowMaskGUI*)gui;
+ mask_gui->feather->update(v);
+ return mask_gui->feather->update_value(v);
+}
+
+int CWindowMaskFeatherSlider::update(float v)
+{
+ return BC_FSlider::update(v);
+}
+
+CWindowMaskFade::CWindowMaskFade(MWindow *mwindow, CWindowToolGUI *gui, int x, int y)
+ : BC_TumbleTextBox(gui, 0, -100.f, 100.f, x, y, 64, 2)
+{
+ this->mwindow = mwindow;
+ this->gui = gui;
+}
+CWindowMaskFade::~CWindowMaskFade()
+{
}
-CWindowMaskValue::~CWindowMaskValue()
+int CWindowMaskFade::update(float v)
{
+ CWindowMaskGUI *mask_gui = (CWindowMaskGUI*)gui;
+ mask_gui->fade_slider->update(v);
+ return BC_TumbleTextBox::update(v);
}
-int CWindowMaskValue::handle_event()
+int CWindowMaskFade::update_value(float v)
{
MaskAutos *autos;
MaskAuto *keyframe;
int create_it = 1;
#endif
- mwindow->undo->update_undo_before(_("mask value"), this);
+ mwindow->undo->update_undo_before(_("mask fade"), this);
+
+// Get existing keyframe
((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe,
- mask, point, create_it);
+ mask, point, create_it);
+ if( track ) {
+#ifdef USE_KEYFRAME_SPANNING
+// Create temp keyframe
+ MaskAuto temp_keyframe(mwindow->edl, autos);
+ temp_keyframe.copy_data(keyframe);
+// Update parameter
+ temp_keyframe.value = v;
+// Commit change to span of keyframes
+ autos->update_parameter(&temp_keyframe);
+#else
+ keyframe->value = v;
+#endif
- if(track)
- {
+ gui->update_preview();
+ }
+
+ mwindow->undo->update_undo_after(_("mask fade"), LOAD_AUTOMATION);
+ return 1;
+}
+
+int CWindowMaskFade::handle_event()
+{
+ float v = atof(get_text());
+ CWindowMaskGUI * mask_gui = (CWindowMaskGUI*)gui;
+ mask_gui->fade_slider->update(v);
+ return mask_gui->fade->update_value(v);
+}
+
+CWindowMaskFadeSlider::CWindowMaskFadeSlider(MWindow *mwindow, CWindowToolGUI *gui,
+ int x, int y, int w)
+ : BC_ISlider(x, y, 0, w, w, -200, 200, 0)
+{
+ this->mwindow = mwindow;
+ this->gui = gui;
+}
+
+CWindowMaskFadeSlider::~CWindowMaskFadeSlider()
+{
+}
+
+int CWindowMaskFadeSlider::handle_event()
+{
+ float v = 100*get_value()/200;
+ CWindowMaskGUI *mask_gui = (CWindowMaskGUI*)gui;
+ mask_gui->fade->BC_TumbleTextBox::update(v);
+ return mask_gui->fade->update_value(v);
+}
+
+int CWindowMaskFadeSlider::update(int64_t v)
+{
+ return BC_ISlider::update(200*v/100);
+}
+
+CWindowMaskMode::CWindowMaskMode(MWindow *mwindow,
+ CWindowToolGUI *gui, int x, int y)
+ : BC_Toggle(x, y, mwindow->theme->mask_mode_toggle, 0)
+{
+ this->mwindow = mwindow;
+ this->gui = gui;
+ set_tooltip(_("Mode"));
+}
+
+CWindowMaskMode::~CWindowMaskMode()
+{
+}
+
+int CWindowMaskMode::handle_event()
+{
+ MaskAutos *autos;
+ MaskAuto *keyframe;
+ Track *track;
+ MaskPoint *point;
+ SubMask *mask;
+// Get existing keyframe
+ ((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 0);
+ if( track ) {
+ mwindow->undo->update_undo_before(_("mask mode"), 0);
#ifdef USE_KEYFRAME_SPANNING
// Create temp keyframe
MaskAuto temp_keyframe(mwindow->edl, autos);
temp_keyframe.copy_data(keyframe);
// Update parameter
- temp_keyframe.value = get_value();
+ temp_keyframe.mode = get_value();
// Commit change to span of keyframes
autos->update_parameter(&temp_keyframe);
#else
- keyframe->value = get_value();
+ ((MaskAuto*)autos->default_auto)->mode = get_value();
#endif
+ mwindow->undo->update_undo_after(_("mask mode"), LOAD_AUTOMATION);
}
+//printf("CWindowMaskMode::handle_event 1\n");
gui->update_preview();
- mwindow->undo->update_undo_after(_("mask value"), LOAD_AUTOMATION);
return 1;
}
}
+CWindowMaskClrMask::CWindowMaskClrMask(MWindow *mwindow,
+ CWindowMaskGUI *gui, int x, int y)
+ : BC_Button(x, y, mwindow->theme->get_image_set("reset_button"))
+{
+ this->mwindow = mwindow;
+ this->gui = gui;
+ set_tooltip(_("Delete all masks"));
+}
+
+CWindowMaskClrMask::~CWindowMaskClrMask()
+{
+}
+
+int CWindowMaskClrMask::calculate_w(MWindow *mwindow)
+{
+ VFrame *vfrm = *mwindow->theme->get_image_set("reset_button");
+ return vfrm->get_w();
+}
+
+int CWindowMaskClrMask::handle_event()
+{
+ MaskAutos *autos;
+ MaskAuto *keyframe;
+ Track *track;
+ MaskPoint *point;
+ SubMask *mask;
+// Get existing keyframe
+ ((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 0);
+ if( track ) {
+ mwindow->undo->update_undo_before(_("del masks"), 0);
+ ((MaskAutos*)track->automation->autos[AUTOMATION_MASK])->clear_all();
+ gui->update();
+ gui->update_preview();
+ mwindow->undo->update_undo_after(_("del masks"), LOAD_AUTOMATION);
+ }
+ return 1;
+}
+CWindowMaskClrPoint::CWindowMaskClrPoint(MWindow *mwindow,
+ CWindowMaskGUI *gui, int x, int y)
+ : BC_Button(x, y, mwindow->theme->get_image_set("reset_button"))
+{
+ this->mwindow = mwindow;
+ this->gui = gui;
+ set_tooltip(_("Delete all points"));
+}
+CWindowMaskClrPoint::~CWindowMaskClrPoint()
+{
+}
+
+int CWindowMaskClrPoint::handle_event()
+{
+ MaskAutos *autos;
+ MaskAuto *keyframe;
+ Track *track;
+ MaskPoint *point;
+ SubMask *mask;
+ int total_points;
+
+// Get existing keyframe
+ ((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 0);
+ if( track ) {
+ mwindow->undo->update_undo_before(_("clr points"), 0);
+#ifdef USE_KEYFRAME_SPANNING
+// Create temp keyframe
+ MaskAuto temp_keyframe(mwindow->edl, autos);
+ temp_keyframe.copy_data(keyframe);
+ SubMask *submask = temp_keyframe.get_submask(mwindow->edl->session->cwindow_mask);
+ submask->points.remove_all_objects();
+ total_points = 0;
+// Commit change to span of keyframes
+ ((MaskAutos*)track->automation->autos[AUTOMATION_MASK])->update_parameter(&temp_keyframe);
+#else
+ MaskAuto *current = (MaskAuto*)autos->default_auto;
+ while( current ) {
+ SubMask *submask = current->get_submask(mwindow->edl->session->cwindow_mask);
+ submask->points.clear();
+ current = current == (MaskAuto*)autos->default_auto ?
+ (MaskAuto*)autos->first : (MaskAuto*)NEXT;
+ }
+ total_points = 0;
+#endif
+ if( mwindow->cwindow->gui->affected_point >= total_points )
+ mwindow->cwindow->gui->affected_point =
+ total_points > 0 ? total_points-1 : 0;
+
+ gui->update();
+ gui->update_preview();
+ mwindow->undo->update_undo_after(_("clr points"), LOAD_AUTOMATION);
+ }
+
+ return 1;
+}
CWindowMaskGUI::CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread)
: CWindowToolGUI(mwindow, thread,
- _(PROGRAM_NAME ": Mask"), 330, 320)
+ _(PROGRAM_NAME ": Mask"), 340, 350)
{
this->mwindow = mwindow;
this->thread = thread;
- number = 0;
active_point = 0;
+ fade = 0;
feather = 0;
}
CWindowMaskGUI::~CWindowMaskGUI()
{
lock_window("CWindowMaskGUI::~CWindowMaskGUI");
- delete number;
delete active_point;
+ delete fade;
delete feather;
unlock_window();
}
void CWindowMaskGUI::create_objects()
{
int x = 10, y = 10, margin = mwindow->theme->widget_border;
+ int clr_x = get_w()-x - CWindowMaskClrMask::calculate_w(mwindow);
+ int del_x = clr_x-margin - CWindowMaskDelMask::calculate_w(this,_("Delete"));
//MaskAuto *keyframe = 0;
//Track *track = mwindow->cwindow->calculate_affected_track();
//if(track)
lock_window("CWindowMaskGUI::create_objects");
BC_Title *title;
- add_subwindow(title = new BC_Title(x, y, _("Mode:")));
- add_subwindow(mode = new CWindowMaskMode(mwindow,
- this, x + title->get_w() + margin, y, ""));
- mode->create_objects();
- y += mode->get_h() + margin;
- add_subwindow(title = new BC_Title(x, y, _("Value:")));
- add_subwindow(value = new CWindowMaskValue(mwindow, this, x + title->get_w() + margin, y));
- y += value->get_h() + margin;
- add_subwindow(delete_point = new CWindowMaskDelete(mwindow, this, x, y));
- int x1 = x + delete_point->get_w() + 2*margin;
- add_subwindow(title = new BC_Title(x1, y, _("Point:")));
- x1 += title->get_w() + margin;
+ add_subwindow(title = new BC_Title(x, y, _("Mask:")));
+ int x1 = x + title->get_w() + margin;
+ name = new CWindowMaskName(mwindow, this, x + title->get_w() + margin, y, "");
+ name->create_objects();
+ x1 = x + name->get_w() + 2*margin;
+ add_subwindow(clr_mask = new CWindowMaskClrMask(mwindow, this, clr_x, y));
+ add_subwindow(del_mask = new CWindowMaskDelMask(mwindow, this, del_x, y));
+ y += name->get_h() + margin;
+ add_subwindow(title = new BC_Title(x, y, _("Fade:")));
+ x1 = x + title->get_w() + margin;
+ fade = new CWindowMaskFade(mwindow, this, x1, y);
+ fade->create_objects();
+ x1 += fade->get_w() + 2*margin;
+ int w1 = clr_x-2*margin - x1;
+ add_subwindow(fade_slider = new CWindowMaskFadeSlider(mwindow, this, x1, y, w1));
+ x1 += fade_slider->get_w() + 2*margin;
+ add_subwindow(mode = new CWindowMaskMode(mwindow, this, clr_x, y));
+ y += fade->get_h() + 3*margin;
+ add_subwindow(title = new BC_Title(x, y, _("Point:")));
+ x1 = x + title->get_w() + margin;
active_point = new CWindowMaskAffectedPoint(mwindow, this, x1, y);
active_point->create_objects();
- y += delete_point->get_h() + margin;
- add_subwindow(title = new BC_Title(x, y, _("Mask number:")));
- number = new CWindowMaskNumber(mwindow,
- this, x + title->get_w() + margin, y);
- number->create_objects();
- y += number->get_h() + margin;
- add_subwindow(title = new BC_Title(x, y, _("Feather:")));
- feather = new CWindowMaskFeather(mwindow,
- this, x + title->get_w() + margin, y);
- feather->create_objects();
- y += feather->get_h() + margin;
+ x1 += active_point->get_w() + margin;
+ add_subwindow(clr_point = new CWindowMaskClrPoint(mwindow, this, clr_x, y));
+ add_subwindow(del_point = new CWindowMaskDelPoint(mwindow, this, del_x, y));
+ y += active_point->get_h() + margin;
add_subwindow(title = new BC_Title(x, y, "X:"));
- x += title->get_w() + margin;
- this->x = new CWindowCoord(this, x, y, (float)0.0);
+ x1 = x + title->get_w() + margin;
+ this->x = new CWindowCoord(this, x1, y, (float)0.0);
this->x->create_objects();
- x += this->x->get_w() + margin;
- add_subwindow(title = new BC_Title(x, y, "Y:"));
- x += title->get_w() + margin;
- this->y = new CWindowCoord(this, x, y, (float)0.0);
+ x1 += this->x->get_w() + 3*margin;
+ add_subwindow(title = new BC_Title(x1, y, "Y:"));
+ x1 += title->get_w() + margin;
+ this->y = new CWindowCoord(this, x1, y, (float)0.0);
this->y->create_objects();
-
- x = 10;
- y += this->y->get_h() + margin;
- add_subwindow(title = new BC_Title(x, y, _("Press Shift to move an end point")));
- y += title->get_h() + margin;
- add_subwindow(title = new BC_Title(x, y, _("Press Ctrl to move a control point")));
- y += title->get_h() + margin;
- add_subwindow(title = new BC_Title(x, y, _("Shift+click Delete to delete the mask")));
- y += title->get_h() + margin;
- add_subwindow(title = new BC_Title(x, y, _("Press Alt to translate the mask")));
- y += 30;
-
+ y += this->x->get_h() + 3*margin;
+ add_subwindow(title = new BC_Title(x, y, _("Feather:")));
+ x1 = x + title->get_w() + margin;
+ feather = new CWindowMaskFeather(mwindow, this, x1, y);
+ feather->create_objects();
+ x1 += feather->get_w() + margin;
+ feather_slider = new CWindowMaskFeatherSlider(mwindow, this, x1, y, 140, 0);
+ add_subwindow(feather_slider);
+ y += feather->get_h() + margin;
add_subwindow(this->apply_before_plugins = new CWindowMaskBeforePlugins(this, 10, y));
y += this->apply_before_plugins->get_h() + margin;
add_subwindow(this->disable_opengl_masking = new CWindowDisableOpenGLMasking(this, 10, y));
-
+ y += this->disable_opengl_masking->get_h() + 3*margin;
+ add_subwindow(new BC_Bar(x, y, get_w()-2*x));
+ y += 2*margin;
+ add_subwindow(title = new BC_Title(x, y, _(
+ "Shift+LMB: move an end point\n"
+ "Ctrl+LMB: move a control point\n"
+ "Wheel Up/Dn: rotate around pointer\n"
+ "Shift+Wheel Up/Dn: scale around pointer\n"
+ "Alt+LMB: to drag translate the mask\n"
+ "Shift+Key Delete to delete the mask")));
update();
unlock_window();
}
if(mask)
{
- feather->update((int64_t)autos->get_feather(position_i, PLAY_FORWARD));
- value->update((int64_t)autos->get_value(position_i, PLAY_FORWARD));
- apply_before_plugins->update((int64_t)keyframe->apply_before_plugins);
- disable_opengl_masking->update((int64_t)keyframe->disable_opengl_masking);
+ feather->update(autos->get_feather(position_i, PLAY_FORWARD));
+ fade->update(autos->get_value(position_i, PLAY_FORWARD));
+ apply_before_plugins->update(keyframe->apply_before_plugins);
+ disable_opengl_masking->update(keyframe->disable_opengl_masking);
}
}
//printf("CWindowMaskGUI::update 1\n");
active_point->update((int64_t)mwindow->cwindow->gui->affected_point);
- number->update((int64_t)mwindow->edl->session->cwindow_mask);
+ name->update_items(keyframe);
+ int k = mwindow->edl->session->cwindow_mask;
+ const char *text = k >= 0 && k < keyframe->masks.size() ?
+ keyframe->masks[k]->name : "";
+ name->update(text);
//printf("CWindowMaskGUI::update 1\n");
- if(track)
- {
+ if( track ) {
#ifdef USE_KEYFRAME_SPANNING
- mode->set_text(
- CWindowMaskMode::mode_to_text(keyframe->mode));
+ mode->update(keyframe->mode);
#else
- mode->set_text(
- CWindowMaskMode::mode_to_text(((MaskAuto*)autos->default_auto)->mode));
+ mode->set_text(((MaskAuto*)autos->default_auto)->mode);
#endif
}
//printf("CWindowMaskGUI::update 2\n");
#include "condition.inc"
#include "cwindowgui.inc"
+#include "cwindowtool.inc"
#include "guicast.h"
+#include "keyframe.inc"
#include "maskauto.inc"
#include "maskautos.inc"
#include "mwindow.inc"
-class CWindowToolGUI;
-class CWindowCoord;
-class CWindowCurveToggle;
-
-
// This common thread supports all the tool GUI's.
class CWindowTool : public Thread
{
CWindowCoord *x1, *y1, *width, *height;
};
-class CWindowMaskMode : public BC_PopupMenu
+class CWindowMaskItems : public ArrayList<BC_ListBoxItem*>
{
public:
- CWindowMaskMode(MWindow *mwindow, CWindowToolGUI *gui, int x, int y, const char *text);
- void create_objects();
- int handle_event();
- static char* mode_to_text(int mode);
- int text_to_mode(char *text);
+ CWindowMaskItems() {}
+ ~CWindowMaskItems() { remove_all_objects(); }
+};
+
+class CWindowMaskName : public BC_PopupTextBox
+{
+public:
+ CWindowMaskName(MWindow *mwindow, CWindowToolGUI *gui, int x, int y, const char *text);
+ ~CWindowMaskName();
MWindow *mwindow;
CWindowToolGUI *gui;
+ CWindowMaskItems mask_items;
+
+ int handle_event();
+ void update_items(MaskAuto *keyframe);
};
-class CWindowMaskDelete : public BC_GenericButton
+class CWindowMaskFade : public BC_TumbleTextBox
{
public:
- CWindowMaskDelete(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
+ CWindowMaskFade(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
+ ~CWindowMaskFade();
+ int update(float v);
+ int update_value(float v);
int handle_event();
- int keypress_event();
MWindow *mwindow;
CWindowToolGUI *gui;
};
-class CWindowMaskCycleNext : public BC_GenericButton
+class CWindowMaskFadeSlider : public BC_ISlider
{
public:
- CWindowMaskCycleNext(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
+ CWindowMaskFadeSlider(MWindow *mwindow, CWindowToolGUI *gui,
+ int x, int y, int w);
+ ~CWindowMaskFadeSlider();
int handle_event();
+ int update(int64_t v);
+ char *get_caption() { return 0; }
MWindow *mwindow;
CWindowToolGUI *gui;
};
-class CWindowMaskCyclePrev : public BC_GenericButton
+class CWindowMaskMode : public BC_Toggle
{
public:
- CWindowMaskCyclePrev(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
+ CWindowMaskMode(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
+ ~CWindowMaskMode();
int handle_event();
MWindow *mwindow;
CWindowToolGUI *gui;
};
-class CWindowMaskNumber : public BC_TumbleTextBox
+class CWindowMaskDelMask : public BC_GenericButton
{
public:
- CWindowMaskNumber(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
- ~CWindowMaskNumber();
+ CWindowMaskDelMask(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
int handle_event();
MWindow *mwindow;
CWindowToolGUI *gui;
};
-
class CWindowMaskAffectedPoint : public BC_TumbleTextBox
{
public:
CWindowToolGUI *gui;
};
+class CWindowMaskDelPoint : public BC_GenericButton
+{
+public:
+ CWindowMaskDelPoint(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
+ int handle_event();
+ int keypress_event();
+ MWindow *mwindow;
+ CWindowToolGUI *gui;
+};
class CWindowMaskFeather : public BC_TumbleTextBox
{
public:
CWindowMaskFeather(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
~CWindowMaskFeather();
+ int update(float v);
+ int update_value(float v);
int handle_event();
MWindow *mwindow;
CWindowToolGUI *gui;
};
-class CWindowMaskValue : public BC_ISlider
+class CWindowMaskFeatherSlider : public BC_FSlider
{
public:
- CWindowMaskValue(MWindow *mwindow, CWindowToolGUI *gui, int x, int y);
- ~CWindowMaskValue();
+ CWindowMaskFeatherSlider(MWindow *mwindow, CWindowToolGUI *gui,
+ int x, int y, int w, float v);
+ ~CWindowMaskFeatherSlider();
int handle_event();
+ int update(float v);
+ char *get_caption() { return 0; }
MWindow *mwindow;
CWindowToolGUI *gui;
};
+class CWindowMaskClrMask : public BC_Button
+{
+public:
+ CWindowMaskClrMask(MWindow *mwindow, CWindowMaskGUI *gui, int x, int y);
+ ~CWindowMaskClrMask();
+ static int calculate_w(MWindow *mwindow);
+ int handle_event();
+ MWindow *mwindow;
+ CWindowMaskGUI *gui;
+};
+
+class CWindowMaskClrPoint : public BC_Button
+{
+public:
+ CWindowMaskClrPoint(MWindow *mwindow, CWindowMaskGUI *gui, int x, int y);
+ ~CWindowMaskClrPoint();
+
+ int handle_event();
+ MWindow *mwindow;
+ CWindowMaskGUI *gui;
+};
+
class CWindowMaskBeforePlugins : public BC_CheckBox
{
public:
SubMask* &mask, MaskPoint* &point, int create_it);
void update_preview();
- CWindowCoord *x, *y;
+ CWindowMaskName *name;
+ CWindowMaskClrMask *clr_mask;
+ CWindowMaskDelMask *del_mask;
+ CWindowMaskFade *fade;
+ CWindowMaskFadeSlider *fade_slider;
CWindowMaskMode *mode;
- CWindowMaskFeather *feather;
- CWindowMaskDelete *delete_point;
CWindowMaskAffectedPoint *active_point;
-// Not necessary if all keyframes have same points
-// CWindowMaskCycleNext *next_point;
-// CWindowMaskCyclePrev *prev_point;
- CWindowMaskNumber *number;
- CWindowMaskValue *value;
+ CWindowMaskClrPoint *clr_point;
+ CWindowMaskDelPoint *del_point;
+ CWindowCoord *x, *y;
+ CWindowMaskFeather *feather;
+ CWindowMaskFeatherSlider *feather_slider;
CWindowMaskBeforePlugins *apply_before_plugins;
CWindowDisableOpenGLMasking *disable_opengl_masking;
};
-class CWindowEyedropCheckBox;
class CWindowEyedropGUI : public CWindowToolGUI
{
public:
class CWindowTool;
+class CWindowToolGUI;
+class CWindowCoord;
+class CWindowCurveToggle;
+class CWindowCropOK;
+class CWindowCropGUI;
+class CWindowMaskList;
+class CWindowMaskName;
+class CWindowMaskFade;
+class CWindowMaskMode;
+class CWindowMaskDelMask;
+class CWindowMaskAffectedPoint;
+class CWindowMaskDelPoint;
+class CWindowMaskFeather;
+class CWindowMaskFeatherSlider;
+class CWindowMaskBeforePlugins;
+class CWindowDisableOpenGLMasking;
+class CWindowMaskGUI;
+class CWindowEyedropGUI;
+class CWindowEyedropCheckBox;
+class CWindowCameraGUI;
+class CWindowCameraLeft;
+class CWindowCameraCenter;
+class CWindowCameraRight;
+class CWindowCameraTop;
+class CWindowCameraMiddle;
+class CWindowCameraBottom;
+class CWindowProjectorGUI;
+class CWindowProjectorLeft;
+class CWindowProjectorCenter;
+class CWindowProjectorRight;
+class CWindowProjectorTop;
+class CWindowProjectorMiddle;
+class CWindowProjectorBottom;
+class CWindowRulerGUI;
#endif
#define CWINDOW_MASK_CONTROL_IN 0x15
#define CWINDOW_MASK_CONTROL_OUT 0x16
#define CWINDOW_MASK_TRANSLATE 0x17
+#define CWINDOW_MASK_ROTATE 0x18
+#define CWINDOW_MASK_SCALE 0x19
// Inclusive limits for zoom panel
#define MIN_ZOOM_TIME 1
EQUIV(control_y2, ptr.control_y2);
}
-SubMask::SubMask(MaskAuto *keyframe)
+SubMask::SubMask(MaskAuto *keyframe, int no)
{
this->keyframe = keyframe;
+ memset(name, 0, sizeof(name));
+ sprintf(name, "%d", no);
}
SubMask::~SubMask()
void SubMask::copy_from(SubMask& ptr)
{
+ memset(name, 0, sizeof(name));
+ strncpy(name, ptr.name, sizeof(name-1));
points.remove_all_objects();
//printf("SubMask::copy_from 1 %p %d\n", this, ptr.points.total);
for(int i = 0; i < ptr.points.total; i++)
{
file->tag.set_title("MASK");
file->tag.set_property("NUMBER", keyframe->masks.number_of(this));
+ file->tag.set_property("NAME", name);
file->append_tag();
file->append_newline();
// submask matches.
for(int i = 0; i < SUBMASKS; i++)
- masks.append(new SubMask(this));
+ masks.append(new SubMask(this, i));
}
MaskAuto::~MaskAuto()
masks.remove_all_objects();
for(int i = 0; i < src->masks.size(); i++)
{
- masks.append(new SubMask(this));
+ masks.append(new SubMask(this, i));
masks.values[i]->copy_from(*src->masks.values[i]);
}
}
i < mask_auto1->masks.total;
i++)
{
- SubMask *new_submask = new SubMask(this);
+ SubMask *new_submask = new SubMask(this, i);
masks.append(new_submask);
SubMask *mask1 = mask_auto1->masks.values[i];
SubMask *mask2 = mask_auto2->masks.values[i];
for(int i = 0; i < masks.size(); i++)
{
delete masks.values[i];
- masks.values[i] = new SubMask(this);
+ masks.values[i] = new SubMask(this, i);
}
int result = 0;
- while(!result)
- {
- result = file->read_tag();
-
- if(!result)
- {
- if(file->tag.title_is("/AUTO"))
- result = 1;
- else
- if(file->tag.title_is("MASK"))
- {
- SubMask *mask = masks.values[file->tag.get_property("NUMBER", 0)];
- mask->load(file);
- }
+ while( !(result = file->read_tag()) ) {
+ if( file->tag.title_is("/AUTO") ) break;
+ if( file->tag.title_is("MASK") ) {
+ int no = file->tag.get_property("NUMBER", 0);
+ char name[BCTEXTLEN]; name[0] = 0;
+ file->tag.get_property("NAME", name);
+ if( !name[0] ) sprintf(name, "%d", no);
+ SubMask *mask = masks.values[no];
+ memset(mask->name, 0, sizeof(mask->name));
+ strncpy(mask->name, name, sizeof(mask->name));
+ mask->load(file);
}
}
// dump();
//printf("MaskAuto::copy 10\n");
}
- file->append_newline();
file->tag.set_title("/AUTO");
file->append_tag();
file->append_newline();
class SubMask
{
public:
- SubMask(MaskAuto *keyframe);
+ SubMask(MaskAuto *keyframe, int no);
~SubMask();
// Don't use ==
void copy(FileXML *file);
void dump();
+ char name[BCSTRLEN];
ArrayList<MaskPoint*> points;
MaskAuto *keyframe;
};
class MaskPoint;
class SubMask;
-enum
-{
+enum {
MASK_MULTIPLY_ALPHA,
- MASK_SUBTRACT_ALPHA
+ MASK_SUBTRACT_ALPHA,
};
#define SUBMASKS 8
int result = (int)((double)((MaskAuto*)begin)->value * (1.0 - weight) +
(double)((MaskAuto*)end)->value * weight + 0.5);
-// printf("MaskAutos::get_value %d %d %f %d %f %d\n",
-// __LINE__,
-// ((MaskAuto*)begin)->value,
-// 1.0 - weight,
-// ((MaskAuto*)end)->value,
-// weight,
-// result);
+// printf("MaskAutos::get_value %d %d %f %d %f %d\n", __LINE__,
+// ((MaskAuto*)begin)->value, 1.0 - weight, ((MaskAuto*)end)->value, weight, result);
return result;
}
-void MaskAutos::avg_points(MaskPoint *output,
- MaskPoint *input1,
- MaskPoint *input2,
- int64_t output_position,
- int64_t position1,
- int64_t position2)
+void MaskAutos::avg_points(MaskPoint *output, MaskPoint *input1, MaskPoint *input2,
+ int64_t output_position, int64_t position1, int64_t position2)
{
- if(position2 == position1)
- {
+ if(position2 == position1) {
*output = *input1;
}
- else
- {
+ else {
float fraction2 = (float)(output_position - position1) / (position2 - position1);
float fraction1 = 1 - fraction2;
output->x = input1->x * fraction1 + input2->x * fraction2;
{
}
-
-
-
-
-
-
MaskUnit::MaskUnit(MaskEngine *engine)
: LoadClient(engine)
{
this->temp = 0;
}
-
MaskUnit::~MaskUnit()
{
- if(temp) delete temp;
+ if( temp ) delete temp;
}
int draw_x1, draw_y1;
int draw_x2, draw_y2;
- if(y2 < y1) {
+ if( y2 < y1 ) {
draw_x1 = x2; draw_y1 = y2;
draw_x2 = x1; draw_y2 = y1;
}
unsigned char **rows = (unsigned char**)frame->get_rows();
- if(draw_y2 != draw_y1) {
+ if( draw_y2 != draw_y1 ) {
float slope = ((float)draw_x2 - draw_x1) / ((float)draw_y2 - draw_y1);
int w = frame->get_w() - 1;
int h = frame->get_h();
- for(float y = draw_y1; y < draw_y2; y++) {
- if(y >= 0 && y < h) {
+ for( float y = draw_y1; y < draw_y2; y++ ) {
+ if( y >= 0 && y < h ) {
int x = (int)((y - draw_y1) * slope + draw_x1);
int y_i = (int)y;
int x_i = CLIP(x, 0, w);
- if(rows[y_i][x_i] == k)
+ if( rows[y_i][x_i] == k )
rows[y_i][x_i] = 0;
else
rows[y_i][x_i] = k;
}
}
-void MaskUnit::blur_strip(double *val_p,
- double *val_m,
- double *dst,
- double *src,
- int size,
- int max)
+void MaskUnit::blur_strip(double *val_p, double *val_m,
+ double *dst, double *src, int size, int max)
{
double *sp_p = src;
double *sp_m = src + size - 1;
double initial_m = sp_m[0];
//printf("MaskUnit::blur_strip %d\n", size);
- for(int k = 0; k < size; k++)
- {
+ for( int k = 0; k < size; k++ ) {
int terms = (k < 4) ? k : 4;
int l;
- for(l = 0; l <= terms; l++)
- {
+ for( l = 0; l <= terms; l++ ) {
*vp += n_p[l] * sp_p[-l] - d_p[l] * vp[-l];
*vm += n_m[l] * sp_m[l] - d_m[l] * vm[l];
}
- for( ; l <= 4; l++)
- {
+ for( ; l <= 4; l++) {
*vp += (n_p[l] - bd_p[l]) * initial_p;
*vm += (n_m[l] - bd_m[l]) * initial_m;
}
- sp_p++;
- sp_m--;
- vp++;
- vm--;
+ sp_p++; sp_m--;
+ vp++; vm--;
}
- for(int i = 0; i < size; i++)
- {
+ for( int i = 0; i < size; i++ ) {
double sum = val_p[i] + val_m[i];
CLAMP(sum, 0, max);
dst[i] = sum;
}
}
-void MaskUnit::do_feather(VFrame *output,
- VFrame *input,
- double feather,
- int start_y,
- int end_y,
- int start_x,
- int end_x)
+void MaskUnit::do_feather(VFrame *output, VFrame *input, double feather,
+ int start_y, int end_y, int start_x, int end_x)
{
//printf("MaskUnit::do_feather %f\n", feather);
// Get constants
d_p[4] = exp(2 * constants[0] + 2 * constants[1]);
- for(int i = 0; i < 5; i++) d_m[i] = d_p[i];
+ for( int i = 0; i < 5; i++ ) d_m[i] = d_p[i];
n_m[0] = 0.0;
- for(int i = 1; i <= 4; i++)
+ for( int i = 1; i <= 4; i++ )
n_m[i] = n_p[i] - d_p[i] * n_p[0];
double sum_n_p, sum_n_m, sum_d;
sum_n_p = 0.0;
sum_n_m = 0.0;
sum_d = 0.0;
- for(int i = 0; i < 5; i++)
- {
+ for( int i = 0; i < 5; i++ ) {
sum_n_p += n_p[i];
sum_n_m += n_m[i];
sum_d += d_p[i];
a = sum_n_p / (1 + sum_d);
b = sum_n_m / (1 + sum_d);
- for(int i = 0; i < 5; i++)
- {
+ for( int i = 0; i < 5; i++ ) {
bd_p[i] = d_p[i] * a;
bd_m[i] = d_m[i] * b;
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#define DO_FEATHER(type, max) \
-{ \
+#define DO_FEATHER(type, max) { \
int frame_w = input->get_w(); \
int frame_h = input->get_h(); \
int size = MAX(frame_w, frame_h); \
int j; \
\
/* printf("DO_FEATHER 1\n"); */ \
- if(end_x > start_x) \
- { \
- for(j = start_x; j < end_x; j++) \
- { \
+ if( end_x > start_x ) { \
+ for( j = start_x; j < end_x; j++ ) { \
/* printf("DO_FEATHER 1.1 %d\n", j); */ \
bzero(val_p, sizeof(double) * frame_h); \
bzero(val_m, sizeof(double) * frame_h); \
- for(int k = 0; k < frame_h; k++) \
- { \
+ for( int k = 0; k < frame_h; k++ ) { \
src[k] = (double)in_rows[k][j]; \
} \
- \
blur_strip(val_p, val_m, dst, src, frame_h, max); \
- \
- for(int k = 0; k < frame_h; k++) \
- { \
+ for( int k = 0; k < frame_h; k++ ) { \
out_rows[k][j] = (type)dst[k]; \
} \
} \
} \
- \
- if(end_y > start_y) \
- { \
- for(j = start_y; j < end_y; j++) \
- { \
+ if( end_y > start_y ) { \
+ for( j = start_y; j < end_y; j++ ) { \
/* printf("DO_FEATHER 2 %d\n", j); */ \
bzero(val_p, sizeof(double) * frame_w); \
bzero(val_m, sizeof(double) * frame_w); \
- for(int k = 0; k < frame_w; k++) \
- { \
+ for( int k = 0; k < frame_w; k++ ) { \
src[k] = (double)out_rows[j][k]; \
} \
- \
blur_strip(val_p, val_m, dst, src, frame_w, max); \
- \
- for(int k = 0; k < frame_w; k++) \
- { \
+ for( int k = 0; k < frame_w; k++ ) { \
out_rows[j][k] = (type)dst[k]; \
} \
} \
} \
- \
/* printf("DO_FEATHER 3\n"); */ \
- \
delete [] src; \
delete [] dst; \
delete [] val_p; \
/* printf("DO_FEATHER 4\n"); */ \
}
-
-
-
-
-
-
-
//printf("do_feather %d\n", frame->get_color_model());
- switch(input->get_color_model())
- {
- case BC_A8:
- DO_FEATHER(unsigned char, 0xff);
- break;
-
- case BC_A16:
- DO_FEATHER(uint16_t, 0xffff);
- break;
-
- case BC_A_FLOAT:
- DO_FEATHER(float, 1);
- break;
+ switch( input->get_color_model() ) {
+ case BC_A8:
+ DO_FEATHER(unsigned char, 0xff);
+ break;
+ case BC_A16:
+ DO_FEATHER(uint16_t, 0xffff);
+ break;
+ case BC_A_FLOAT:
+ DO_FEATHER(float, 1);
+ break;
}
-
-
-
-
}
void MaskUnit::process_package(LoadPackage *package)
{
MaskPackage *ptr = (MaskPackage*)package;
+ float engine_value = engine->value;
+ int engine_mode = engine->mode;
- if(engine->recalculate &&
- engine->step == DO_MASK)
- {
- VFrame *mask;
- if(engine->feather > 0)
- mask = engine->temp_mask;
- else
- mask = engine->mask;
-
-SET_TRACE
+ if( engine->recalculate && engine->step == DO_MASK ) {
+ VFrame *mask = engine->feather > 0 ? engine->temp_mask : engine->mask;
// Generated oversampling frame
int mask_w = mask->get_w();
//int mask_h = mask->get_h();
int oversampled_package_w = mask_w * OVERSAMPLE;
int oversampled_package_h = (ptr->end_y - ptr->start_y) * OVERSAMPLE;
-//printf("MaskUnit::process_package 1\n");
-
-SET_TRACE
- if(temp &&
- (temp->get_w() != oversampled_package_w ||
- temp->get_h() != oversampled_package_h)) {
+ if( temp &&
+ (temp->get_w() != oversampled_package_w ||
+ temp->get_h() != oversampled_package_h) ) {
delete temp; temp = 0;
}
-//printf("MaskUnit::process_package 1\n");
-
-SET_TRACE
- if(!temp) {
+ if( !temp ) {
temp = new VFrame(oversampled_package_w, oversampled_package_h, BC_A8, 0);
}
-
-SET_TRACE
temp->clear_frame();
-//printf("MaskUnit::process_package 1 %d\n", engine->point_sets.total);
-
-SET_TRACE
-
// Draw oversampled region of polygons on temp
- for(int k = 0; k < engine->point_sets.total; k++)
- {
+ for( int k=0; k<engine->point_sets.total; ++k ) {
int old_x, old_y;
unsigned char max = k + 1;
ArrayList<MaskPoint*> *points = engine->point_sets.values[k];
- if(points->total < 3) continue;
+ if( points->total < 3 ) continue;
//printf("MaskUnit::process_package 2 %d %d\n", k, points->total);
- for(int i = 0; i < points->total; i++)
- {
+ for( int i=0; i<points->total; ++i ) {
MaskPoint *point1 = points->values[i];
MaskPoint *point2 = (i >= points->total - 1) ?
points->values[0] :
float x, y;
int segments = (int)(sqrt(SQR(point1->x - point2->x) + SQR(point1->y - point2->y)));
- if(point1->control_x2 == 0 &&
+ if( point1->control_x2 == 0 &&
point1->control_y2 == 0 &&
point2->control_x1 == 0 &&
- point2->control_y1 == 0)
+ point2->control_y1 == 0 )
segments = 1;
float x0 = point1->x;
float y0 = point1->y;
float x3 = point2->x;
float y3 = point2->y;
- for(int j = 0; j <= segments; j++)
- {
+ for( int j = 0; j <= segments; j++ ) {
float t = (float)j / segments;
float tpow2 = t * t;
float tpow3 = t * t * t;
x *= OVERSAMPLE;
y *= OVERSAMPLE;
- if(j > 0)
- {
+ if( j > 0 ) {
draw_line_clamped(temp, old_x, old_y, (int)x, (int)y, max);
}
old_y = (int)y;
}
}
-
-SET_TRACE
-//printf("MaskUnit::process_package 1\n");
-
-
-
-
-
// Fill in the polygon in the horizontal direction
- for(int i = 0; i < oversampled_package_h; i++)
- {
+ for( int i=0; i<oversampled_package_h; ++i ) {
unsigned char *row = (unsigned char*)temp->get_rows()[i];
- int value = 0x0;
- int total = 0;
-
- for(int j = 0; j < oversampled_package_w; j++)
- if(row[j] == max) total++;
-
- if(total > 1)
- {
- if(total & 0x1) total--;
- for(int j = 0; j < oversampled_package_w; j++)
- {
- if(row[j] == max && total > 0)
- {
- if(value)
- value = 0x0;
- else
- value = max;
- total--;
- }
- else
- {
- if(value) row[j] = value;
+ int value = 0, total = 0;
+
+ for( int j=0; j<oversampled_package_w; ++j )
+ if( row[j] == max ) ++total;
+
+ if( total > 1 ) {
+ if( total & 0x1 ) --total;
+ for( int j=0; j<oversampled_package_w; ++j ) {
+ if( row[j]==max && total>0 ) {
+ --total;
+ value = value ? 0 : max;
}
+ else if( value )
+ row[j] = value;
}
}
}
}
-
-
-SET_TRACE
-
-
-
-
-
-#define DOWNSAMPLE(type, temp_type, value) \
-for(int i = 0; i < ptr->end_y - ptr->start_y; i++) \
-{ \
- type *output_row = (type*)mask->get_rows()[i + ptr->start_y]; \
- unsigned char **input_rows = (unsigned char**)temp->get_rows() + i * OVERSAMPLE; \
- \
- \
- for(int j = 0; j < mask_w; j++) \
- { \
+#define DOWNSAMPLE(type, temp_type, value, v) do { \
+for( int y=0; y<ptr->end_y-ptr->start_y; ++y ) { \
+ type *output_row = (type*)mask->get_rows()[y + ptr->start_y]; \
+ unsigned char **input_rows = (unsigned char**)temp->get_rows() + y * OVERSAMPLE; \
+ for( int x=0; x<mask_w; ++x ) { \
temp_type total = 0; \
- \
/* Accumulate pixel */ \
- for(int k = 0; k < OVERSAMPLE; k++) \
- { \
- unsigned char *input_vector = input_rows[k] + j * OVERSAMPLE; \
- for(int l = 0; l < OVERSAMPLE; l++) \
- { \
+ for( int k=0; k<OVERSAMPLE; ++k ) { \
+ unsigned char *input_vector = input_rows[k] + x * OVERSAMPLE; \
+ for( int l=0; l<OVERSAMPLE; ++l ) { \
total += (input_vector[l] ? value : 0); \
} \
} \
- \
/* Divide pixel */ \
total /= OVERSAMPLE * OVERSAMPLE; \
- \
- output_row[j] = total; \
+ output_row[x] = v; \
} \
-}
-
-SET_TRACE
+} } while(0)
+ if( engine_value < 0 ) {
+ engine_value = -engine_value;
+ engine_mode = 1-engine_mode;
+ }
// Downsample polygon
- switch(mask->get_color_model())
- {
- case BC_A8:
- {
- unsigned char value;
- value = (int)((float)engine->value / 100 * 0xff);
- DOWNSAMPLE(unsigned char, int64_t, value);
- break;
- }
-
- case BC_A16:
- {
- uint16_t value;
- value = (int)((float)engine->value / 100 * 0xffff);
- DOWNSAMPLE(uint16_t, int64_t, value);
- break;
- }
-
- case BC_A_FLOAT:
- {
- float value;
- value = (float)engine->value / 100;
- DOWNSAMPLE(float, double, value);
- break;
- }
+ switch( mask->get_color_model() ) {
+ case BC_A8: {
+ unsigned char value;
+ value = (int)(engine_value / 100 * 0xff);
+ if( engine->value >= 0 )
+ DOWNSAMPLE(unsigned char, int64_t, value, total);
+ else
+ DOWNSAMPLE(unsigned char, int64_t, value, value-total);
+ break; }
+
+ case BC_A16: {
+ uint16_t value;
+ value = (int)(engine_value / 100 * 0xffff);
+ if( engine->value >= 0 )
+ DOWNSAMPLE(uint16_t, int64_t, value, total);
+ else
+ DOWNSAMPLE(uint16_t, int64_t, value, value-total);
+ break; }
+
+ case BC_A_FLOAT: {
+ float value;
+ value = engine_value / 100;
+ if( engine->value >= 0 )
+ DOWNSAMPLE(float, double, value, total);
+ else
+ DOWNSAMPLE(float, double, value, value-total);
+ break; }
}
}
-SET_TRACE
-
-SET_TRACE
-
- if(engine->step == DO_X_FEATHER)
- {
-
- if(engine->recalculate)
- {
-// Feather polygon
- if(engine->feather > 0) do_feather(engine->mask,
- engine->temp_mask,
- engine->feather,
- ptr->start_y,
- ptr->end_y,
- 0,
- 0);
- }
+ if( engine->step == DO_X_FEATHER && engine->recalculate && // Feather polygon
+ engine->feather > 0 ) {
+ do_feather(engine->mask,
+ engine->temp_mask, engine->feather,
+ ptr->start_y, ptr->end_y, 0, 0);
//printf("MaskUnit::process_package 3 %f\n", engine->feather);
}
- if(engine->step == DO_Y_FEATHER)
- {
- if(engine->recalculate)
- {
-// Feather polygon
- if(engine->feather > 0) do_feather(engine->mask,
- engine->temp_mask,
- engine->feather,
- 0,
- 0,
- ptr->start_x,
- ptr->end_x);
- }
+ if( engine->step == DO_Y_FEATHER && engine->recalculate && // Feather polygon
+ engine->feather > 0 ) {
+ do_feather(engine->mask,
+ engine->temp_mask, engine->feather,
+ 0, 0, ptr->start_x, ptr->end_x);
}
- if(engine->step == DO_APPLY)
- {
-// Apply mask
- int mask_w = engine->mask->get_w();
-
-
-#define APPLY_MASK_SUBTRACT_ALPHA(type, max, components, do_yuv) \
-{ \
- type *output_row = (type*)engine->output->get_rows()[i]; \
- type *mask_row = (type*)engine->mask->get_rows()[i]; \
- int chroma_offset = (int)(max + 1) / 2; \
- \
- for(int j = 0; j < mask_w; j++) \
- { \
- if(components == 4) \
- { \
- output_row[j * 4 + 3] = output_row[j * 4 + 3] * (max - mask_row[j]) / max; \
- } \
- else \
- { \
- output_row[j * 3] = output_row[j * 3] * (max - mask_row[j]) / max; \
- \
- output_row[j * 3 + 1] = output_row[j * 3 + 1] * (max - mask_row[j]) / max; \
- output_row[j * 3 + 2] = output_row[j * 3 + 2] * (max - mask_row[j]) / max; \
- \
- if(do_yuv) \
- { \
- output_row[j * 3 + 1] += chroma_offset * mask_row[j] / max; \
- output_row[j * 3 + 2] += chroma_offset * mask_row[j] / max; \
- } \
- } \
- } \
-}
-
-#define APPLY_MASK_MULTIPLY_ALPHA(type, max, components, do_yuv) \
-{ \
- type *output_row = (type*)engine->output->get_rows()[i]; \
- type *mask_row = (type*)engine->mask->get_rows()[i]; \
+ if( engine->step == DO_APPLY ) { // Apply mask
+#define APPLY_MASK_ALPHA(cmodel, type, max, components, do_yuv, a, b) \
+case cmodel: \
+for( int y=ptr->start_y; y<ptr->end_y; ++y ) { \
+ type *output_row = (type*)engine->output->get_rows()[y]; \
+ type *mask_row = (type*)engine->mask->get_rows()[y]; \
int chroma_offset = (int)(max + 1) / 2; \
- \
- for(int j = 0; j < mask_w; j++) \
- { \
- if(components == 4) \
- { \
- output_row[j * 4 + 3] = output_row[j * 4 + 3] * mask_row[j] / max; \
+ for( int x=0; x<mask_w; ++x ) { \
+ int m = mask_row[x], n = max-m; \
+ if( components == 4 ) { \
+ output_row[x*4 + 3] = output_row[x*4 + 3]*a / max; \
} \
- else \
- { \
- output_row[j * 3] = output_row[j * 3] * mask_row[j] / max; \
- \
- output_row[j * 3 + 1] = output_row[j * 3 + 1] * mask_row[j] / max; \
- output_row[j * 3 + 2] = output_row[j * 3 + 2] * mask_row[j] / max; \
- \
- if(do_yuv) \
- { \
- output_row[j * 3 + 1] += chroma_offset * (max - mask_row[j]) / max; \
- output_row[j * 3 + 2] += chroma_offset * (max - mask_row[j]) / max; \
+ else { \
+ output_row[x*3 + 0] = output_row[x*3 + 0]*a / max; \
+ output_row[x*3 + 1] = output_row[x*3 + 1]*a / max; \
+ output_row[x*3 + 2] = output_row[x*3 + 2]*a / max; \
+ if( do_yuv ) { \
+ output_row[x*3 + 1] += chroma_offset*b / max; \
+ output_row[x*3 + 2] += chroma_offset*b / max; \
} \
} \
} \
-}
-
-
-
+} break
+
+#define MASK_ALPHA(mode, a, b) \
+case mode: \
+ switch( engine->output->get_color_model() ) { \
+ APPLY_MASK_ALPHA(BC_RGB888, unsigned char, 0xff, 3, 0, a, b); \
+ APPLY_MASK_ALPHA(BC_RGB_FLOAT, float, 1.0, 3, 0, a, b); \
+ APPLY_MASK_ALPHA(BC_YUV888, unsigned char, 0xff, 3, 1, a, b); \
+ APPLY_MASK_ALPHA(BC_RGBA_FLOAT, float, 1.0, 4, 0, a, b); \
+ APPLY_MASK_ALPHA(BC_YUVA8888, unsigned char, 0xff, 4, 1, a, b); \
+ APPLY_MASK_ALPHA(BC_RGBA8888, unsigned char, 0xff, 4, 0, a, b); \
+ APPLY_MASK_ALPHA(BC_RGB161616, uint16_t, 0xffff, 3, 0, a, b); \
+ APPLY_MASK_ALPHA(BC_YUV161616, uint16_t, 0xffff, 3, 1, a, b); \
+ APPLY_MASK_ALPHA(BC_YUVA16161616, uint16_t, 0xffff, 4, 1, a, b); \
+ APPLY_MASK_ALPHA(BC_RGBA16161616, uint16_t, 0xffff, 4, 0, a, b); \
+} break
//printf("MaskUnit::process_package 1 %d\n", engine->mode);
- for(int i = ptr->start_y; i < ptr->end_y; i++)
- {
- switch(engine->mode)
- {
- case MASK_MULTIPLY_ALPHA:
- switch(engine->output->get_color_model())
- {
- case BC_RGB888:
- APPLY_MASK_MULTIPLY_ALPHA(unsigned char, 0xff, 3, 0);
- break;
- case BC_RGB_FLOAT:
- APPLY_MASK_MULTIPLY_ALPHA(float, 1.0, 3, 0);
- break;
- case BC_YUV888:
- APPLY_MASK_MULTIPLY_ALPHA(unsigned char, 0xff, 3, 1);
- break;
- case BC_RGBA_FLOAT:
- APPLY_MASK_MULTIPLY_ALPHA(float, 1.0, 4, 0);
- break;
- case BC_YUVA8888:
- APPLY_MASK_MULTIPLY_ALPHA(unsigned char, 0xff, 4, 1);
- break;
- case BC_RGBA8888:
- APPLY_MASK_MULTIPLY_ALPHA(unsigned char, 0xff, 4, 0);
- break;
- case BC_RGB161616:
- APPLY_MASK_MULTIPLY_ALPHA(uint16_t, 0xffff, 3, 0);
- break;
- case BC_YUV161616:
- APPLY_MASK_MULTIPLY_ALPHA(uint16_t, 0xffff, 3, 1);
- break;
- case BC_YUVA16161616:
- APPLY_MASK_MULTIPLY_ALPHA(uint16_t, 0xffff, 4, 1);
- break;
- case BC_RGBA16161616:
- APPLY_MASK_MULTIPLY_ALPHA(uint16_t, 0xffff, 4, 0);
- break;
- }
- break;
-
- case MASK_SUBTRACT_ALPHA:
- switch(engine->output->get_color_model())
- {
- case BC_RGB888:
- APPLY_MASK_SUBTRACT_ALPHA(unsigned char, 0xff, 3, 0);
- break;
- case BC_RGB_FLOAT:
- APPLY_MASK_SUBTRACT_ALPHA(float, 1.0, 3, 0);
- break;
- case BC_RGBA_FLOAT:
- APPLY_MASK_SUBTRACT_ALPHA(float, 1.0, 4, 0);
- break;
- case BC_RGBA8888:
- APPLY_MASK_SUBTRACT_ALPHA(unsigned char, 0xff, 4, 0);
- break;
- case BC_YUV888:
- APPLY_MASK_SUBTRACT_ALPHA(unsigned char, 0xff, 3, 1);
- break;
- case BC_YUVA8888:
- APPLY_MASK_SUBTRACT_ALPHA(unsigned char, 0xff, 4, 1);
- break;
- case BC_RGB161616:
- APPLY_MASK_SUBTRACT_ALPHA(uint16_t, 0xffff, 3, 0);
- break;
- case BC_RGBA16161616:
- APPLY_MASK_SUBTRACT_ALPHA(uint16_t, 0xffff, 4, 0);
- break;
- case BC_YUV161616:
- APPLY_MASK_SUBTRACT_ALPHA(uint16_t, 0xffff, 3, 1);
- break;
- case BC_YUVA16161616:
- APPLY_MASK_SUBTRACT_ALPHA(uint16_t, 0xffff, 4, 1);
- break;
- }
- break;
- }
+ int mask_w = engine->mask->get_w();
+ switch( engine_mode ) {
+ MASK_ALPHA(MASK_MULTIPLY_ALPHA, m, n);
+ MASK_ALPHA(MASK_SUBTRACT_ALPHA, n, m);
}
}
}
-
-
-
MaskEngine::MaskEngine(int cpus)
: LoadServer(cpus, cpus * OVERSAMPLE * 2)
// : LoadServer(1, OVERSAMPLE * 2)
MaskEngine::~MaskEngine()
{
- if(mask)
- {
+ if( mask ) {
delete mask;
delete temp_mask;
}
- for(int i = 0; i < point_sets.total; i++)
- {
+ for( int i = 0; i < point_sets.total; i++ ) {
ArrayList<MaskPoint*> *points = point_sets.values[i];
points->remove_all_objects();
}
ArrayList<MaskPoint*> *points)
{
//printf("MaskEngine::points_equivalent %d %d\n", new_points->total, points->total);
- if(new_points->total != points->total) return 0;
+ if( new_points->total != points->total ) return 0;
- for(int i = 0; i < new_points->total; i++)
- {
- if(!(*new_points->values[i] == *points->values[i])) return 0;
+ for( int i = 0; i < new_points->total; i++ ) {
+ if( !(*new_points->values[i] == *points->values[i]) ) return 0;
}
return 1;
int new_color_model = 0;
recalculate = 0;
- switch(output->get_color_model())
- {
- case BC_RGB_FLOAT:
- case BC_RGBA_FLOAT:
- new_color_model = BC_A_FLOAT;
- break;
-
- case BC_RGB888:
- case BC_RGBA8888:
- case BC_YUV888:
- case BC_YUVA8888:
- new_color_model = BC_A8;
- break;
-
- case BC_RGB161616:
- case BC_RGBA16161616:
- case BC_YUV161616:
- case BC_YUVA16161616:
- new_color_model = BC_A16;
- break;
+ switch( output->get_color_model() ) {
+ case BC_RGB_FLOAT:
+ case BC_RGBA_FLOAT:
+ new_color_model = BC_A_FLOAT;
+ break;
+
+ case BC_RGB888:
+ case BC_RGBA8888:
+ case BC_YUV888:
+ case BC_YUVA8888:
+ new_color_model = BC_A8;
+ break;
+
+ case BC_RGB161616:
+ case BC_RGBA16161616:
+ case BC_YUV161616:
+ case BC_YUVA16161616:
+ new_color_model = BC_A16;
+ break;
}
// Determine if recalculation is needed
SET_TRACE
- if(mask &&
- (mask->get_w() != output->get_w() ||
- mask->get_h() != output->get_h() ||
- mask->get_color_model() != new_color_model))
- {
+ if( mask &&
+ (mask->get_w() != output->get_w() ||
+ mask->get_h() != output->get_h() ||
+ mask->get_color_model() != new_color_model) ) {
delete mask;
delete temp_mask;
mask = 0;
recalculate = 1;
}
- if(!recalculate)
- {
- if(point_sets.total != keyframe_set->total_submasks(start_position_project,
- PLAY_FORWARD))
+ if( !recalculate ) {
+ if( point_sets.total != keyframe_set->total_submasks(start_position_project,
+ PLAY_FORWARD) )
recalculate = 1;
}
- if(!recalculate)
- {
- for(int i = 0;
- i < keyframe_set->total_submasks(start_position_project,
- PLAY_FORWARD) && !recalculate;
- i++)
- {
- ArrayList<MaskPoint*> *new_points = new ArrayList<MaskPoint*>;
- keyframe_set->get_points(new_points,
- i,
- start_position_project,
- PLAY_FORWARD);
- if(!points_equivalent(new_points, point_sets.values[i])) recalculate = 1;
- new_points->remove_all_objects();
- delete new_points;
+ if( !recalculate ) {
+ for( int i=0,n=keyframe_set->total_submasks(start_position_project, PLAY_FORWARD);
+ i<n && !recalculate; ++i ) {
+ ArrayList<MaskPoint*> new_points;
+ keyframe_set->get_points(&new_points, i,
+ start_position_project, PLAY_FORWARD);
+ if( !points_equivalent(&new_points, point_sets.values[i]) )
+ recalculate = 1;
+ new_points.remove_all_objects();
}
}
float new_feather = keyframe_set->get_feather(start_position_project,
PLAY_FORWARD);
- if(recalculate ||
+ if( recalculate ||
!EQUIV(new_feather, feather) ||
- !EQUIV(new_value, value))
- {
+ !EQUIV(new_value, value) ) {
recalculate = 1;
- if(!mask)
- {
+ if( !mask ) {
mask = new VFrame(output->get_w(), output->get_h(),
new_color_model, 0);
temp_mask = new VFrame(output->get_w(), output->get_h(),
new_color_model, 0);
}
- if(new_feather > 0)
+ if( new_feather > 0 )
temp_mask->clear_frame();
else
mask->clear_frame();
- for(int i = 0; i < point_sets.total; i++)
- {
+ for( int i = 0; i < point_sets.total; i++ ) {
ArrayList<MaskPoint*> *points = point_sets.values[i];
points->remove_all_objects();
}
point_sets.remove_all_objects();
- for(int i = 0;
+ for( int i = 0;
i < keyframe_set->total_submasks(start_position_project,
PLAY_FORWARD);
- i++)
- {
+ i++ ) {
ArrayList<MaskPoint*> *new_points = new ArrayList<MaskPoint*>;
keyframe_set->get_points(new_points,
i,
// Clear screen
glDisable(GL_TEXTURE_2D);
- if( command->default_auto->mode == MASK_MULTIPLY_ALPHA ) {
- glClearColor(0.0, 0.0, 0.0, 0.0);
- glColor4f((float)command->keyframe->value / 100,
- (float)command->keyframe->value / 100,
- (float)command->keyframe->value / 100,
- 1.0);
+ float value = command->keyframe->value / 100.f;
+ if( value >= 0 ) {
+ if( command->default_auto->mode == MASK_MULTIPLY_ALPHA ) {
+ glClearColor(0.f, 0.f, 0.f, 0.f);
+ glColor4f(value, value, value, 1.f);
+ }
+ else {
+ glClearColor(1.f, 1.f, 1.f, 1.f);
+ value = 1.f - value;
+ glColor4f(value, value, value, 1.f);
+ }
}
else {
- glClearColor(1.0, 1.0, 1.0, 1.0);
- glColor4f((float)1.0 - (float)command->keyframe->value / 100,
- (float)1.0 - (float)command->keyframe->value / 100,
- (float)1.0 - (float)command->keyframe->value / 100,
- 1.0);
+ if( command->default_auto->mode == MASK_MULTIPLY_ALPHA ) {
+ value = -value;
+ glClearColor(value, value, value, 1.f);
+ glColor4f(0.f, 0.f, 0.f, 0.f);
+ }
+ else {
+ value = 1.f + value;
+ glClearColor(value, value, value, 1.f);
+ glColor4f(1.f, 1.f, 1.f, 1.f);
+ }
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
ffmpeg_toggle = 0;
proxy_s_toggle = 0;
proxy_p_toggle = 0;
+ mask_mode_toggle = 0;
infoasset_data = 0;
in_point = 0;
insert_data = 0;
VFrame **ffmpeg_toggle;
VFrame **proxy_p_toggle;
VFrame **proxy_s_toggle;
+ VFrame **mask_mode_toggle;
VFrame **infoasset_data;
VFrame **in_point;
VFrame **insert_data;
#if __i386__
#define IP eip
#define sigregs_t sigcontext
+
+static void reg_dump(FILE *fp,sigregs_t *rp)
+{
+ fprintf(fp,"REGS:\n");
+ fprintf(fp," gs: %04x:%04x\n", rp->gs,rp->__gsh);
+ fprintf(fp," fs: %04x:%04x\n", rp->fs,rp->__fsh);
+ fprintf(fp," es: %04x:%04x\n", rp->es,rp->__esh);
+ fprintf(fp," ds: %04x:%04x\n", rp->ds,rp->__dsh);
+ fprintf(fp," edi: %14p %d\n", (void*)rp->edi,rp->edi);
+ fprintf(fp," esi: %14p %d\n", (void*)rp->esi,rp->esi);
+ fprintf(fp," ebp: %14p %d\n", (void*)rp->ebp,rp->ebp);
+ fprintf(fp," esp: %14p %d\n", (void*)rp->esp,rp->esp);
+ fprintf(fp," ebx: %14p %d\n", (void*)rp->ebx,rp->ebx);
+ fprintf(fp," edx: %14p %d\n", (void*)rp->edx,rp->edx);
+ fprintf(fp," ecx: %14p %d\n", (void*)rp->ecx,rp->ecx);
+ fprintf(fp," eax: %14p %d\n", (void*)rp->eax,rp->eax);
+ fprintf(fp," trapno: %14p %d\n", (void*)rp->trapno,rp->trapno);
+ fprintf(fp," err: %14p %d\n", (void*)rp->err,rp->err);
+ fprintf(fp," eip: %14p %d\n", (void*)rp->eip,rp->eip);
+ fprintf(fp," cs: %04xd : %04x\n", rp->cs,rp->__csh);
+ fprintf(fp," eflags: %14p %d\n", (void*)rp->eflags,rp->eflags);
+ fprintf(fp," esp_at_signal: %p %d\n", (void*)rp->esp_at_signal,rp->esp_at_signal);
+ fprintf(fp," ss: %04xd : %04x\n", rp->ss,rp->__ssh);
+ fprintf(fp," oldmask: %14p %d\n", (void*)rp->oldmask,rp->oldmask);
+ fprintf(fp," cr2: %14p %d\n", (void*)rp->cr2,rp->cr2);
+ fprintf(fp,"\n");
+}
#endif
#if __x86_64__
#define IP rip
#define sigregs_t sigcontext
+
+static void reg_dump(FILE *fp,sigregs_t *rp)
+{
+ fprintf(fp,"REGS:\n");
+ fprintf(fp," r8: %20p %jd\n", (void*)rp->r8,rp->r8);
+ fprintf(fp," r9: %20p %jd\n", (void*)rp->r9,rp->r9);
+ fprintf(fp," r10: %20p %jd\n", (void*)rp->r10,rp->r10);
+ fprintf(fp," r11: %20p %jd\n", (void*)rp->r11,rp->r11);
+ fprintf(fp," r12: %20p %jd\n", (void*)rp->r12,rp->r12);
+ fprintf(fp," r13: %20p %jd\n", (void*)rp->r13,rp->r13);
+ fprintf(fp," r14: %20p %jd\n", (void*)rp->r14,rp->r14);
+ fprintf(fp," r15: %20p %jd\n", (void*)rp->r15,rp->r15);
+ fprintf(fp," rdi: %20p %jd\n", (void*)rp->rdi,rp->rdi);
+ fprintf(fp," rsi: %20p %jd\n", (void*)rp->rsi,rp->rsi);
+ fprintf(fp," rbp: %20p %jd\n", (void*)rp->rbp,rp->rbp);
+ fprintf(fp," rbx: %20p %jd\n", (void*)rp->rbx,rp->rbx);
+ fprintf(fp," rdx: %20p %jd\n", (void*)rp->rdx,rp->rdx);
+ fprintf(fp," rax: %20p %jd\n", (void*)rp->rax,rp->rax);
+ fprintf(fp," rcx: %20p %jd\n", (void*)rp->rcx,rp->rcx);
+ fprintf(fp," rsp: %20p %jd\n", (void*)rp->rsp,rp->rsp);
+ fprintf(fp," rip: %20p %jd\n", (void*)rp->rip,rp->rip);
+ fprintf(fp," eflags: %14p %jd\n", (void*)rp->eflags,rp->eflags);
+ fprintf(fp," cs: %04x\n", rp->cs);
+ fprintf(fp," gs: %04x\n", rp->gs);
+ fprintf(fp," fs: %04x\n", rp->fs);
+ fprintf(fp," err: %20p %jd\n", (void*)rp->err,rp->err);
+ fprintf(fp," trapno: %20p %jd\n", (void*)rp->trapno,rp->trapno);
+ fprintf(fp," oldmask: %20p %jd\n", (void*)rp->oldmask,rp->oldmask);
+ fprintf(fp," cr2: %20p %jd\n", (void*)rp->cr2,rp->cr2);
+ fprintf(fp,"\n");
+}
+
#endif
#if __powerpc__ || __powerpc64__ || __powerpc64le__
#include <asm/ptrace.h>
#define IP nip
#define sigregs_t pt_regs
+static void reg_dump(FILE *fp,sigregs_t *rp) {}
#endif
#ifndef IP
else
fprintf(fp,"err opening: %s, %m\n", proc_mem);
+ reg_dump(fp, c);
fprintf(fp,"\n\n");
if( fp != stdout ) fclose(fp);
char cmd[1024], *cp = cmd;
class BC_Slider : public BC_SubWindow
{
public:
- BC_Slider(int x,
- int y,
- int pixels,
- int pointer_motion_range,
- VFrame **images,
- int show_number,
- int vertical,
+ BC_Slider(int x, int y, int pixels, int pointer_motion_range,
+ VFrame **images, int show_number, int vertical,
int use_caption);
virtual ~BC_Slider();
class BC_ISlider : public BC_Slider
{
public:
- BC_ISlider(int x,
- int y,
- int vertical,
- int pixels,
- int pointer_motion_range,
- int64_t minvalue,
- int64_t maxvalue,
- int64_t value,
- int use_caption = 0,
- VFrame **data = 0,
- int *output = 0);
-
+ BC_ISlider(int x, int y, int vertical, int pixels, int pointer_motion_range,
+ int64_t minvalue, int64_t maxvalue, int64_t value,
+ int use_caption = 0, VFrame **data = 0, int *output = 0);
int update(int64_t value);
int update(int pointer_motion_range, int64_t value, int64_t minvalue, int64_t maxvalue);
int64_t get_value();
class BC_FSlider : public BC_Slider
{
public:
- BC_FSlider(int x,
- int y,
- int vertical,
- int pixels,
- int pointer_motion_range,
- float minvalue,
- float maxvalue,
- float value,
- int use_caption = 0,
- VFrame **data = 0);
+ BC_FSlider(int x, int y, int vertical, int pixels, int pointer_motion_range,
+ float minvalue, float maxvalue, float value,
+ int use_caption = 0, VFrame **data = 0);
friend class BC_PercentageSlider;
class BC_PercentageSlider : public BC_FSlider
{
public:
- BC_PercentageSlider(int x,
- int y,
- int vertical,
- int pixels,
- int pointer_motion_range,
- float minvalue,
- float maxvalue,
- float value,
- int use_caption = 0,
- VFrame **data = 0);
-
+ BC_PercentageSlider(int x, int y, int vertical, int pixels, int pointer_motion_range,
+ float minvalue, float maxvalue, float value,
+ int use_caption = 0, VFrame **data = 0);
char* get_caption();
private:
};
-
#endif
#include "bcdisplayinfo.h"
#include "brightnesswindow.h"
#include "language.h"
+#include "theme.h"
}
BrightnessSliderClr::BrightnessSliderClr(BrightnessMain *client, BrightnessWindow *window, int x, int y, int w, int is_brightness)
- : BC_GenericButton(x, y, w, _("⌂"))
+ : BC_Button(x, y, w, client->get_theme()->get_image_set("reset_button"))
{
this->client = client;
this->window = window;
BrightnessWindow *window;
};
-class BrightnessSliderClr : public BC_GenericButton
+class BrightnessSliderClr : public BC_Button
{
public:
BrightnessSliderClr(BrightnessMain *client, BrightnessWindow *window, int x, int y, int w, int is_brightness);
int w,
int clear,
int section)
- : BC_GenericButton(x, y, w, _("⌂"))
+ : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button"))
{
this->plugin = plugin;
this->gui = gui;
};
-class Color3WaySliderClrSection : public BC_GenericButton
+class Color3WaySliderClrSection : public BC_Button
{
public:
Color3WaySliderClrSection(Color3WayMain *plugin,
#include "bcdisplayinfo.h"
#include "colorbalancewindow.h"
#include "language.h"
+#include "theme.h"
ColorBalanceSliderClr::ColorBalanceSliderClr(ColorBalanceMain *plugin,
ColorBalanceWindow *gui, int x, int y, int w, int clear)
- : BC_GenericButton(x, y, w, _("⌂"))
+ : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button"))
{
this->plugin = plugin;
this->gui = gui;
ColorBalanceWindow *gui;
};
-class ColorBalanceSliderClr : public BC_GenericButton
+class ColorBalanceSliderClr : public BC_Button
{
public:
ColorBalanceSliderClr(ColorBalanceMain *plugin, ColorBalanceWindow *gui, int x, int y, int w, int clear);
#include "bccolors.h"
#include "playback3d.h"
#include "pluginvclient.h"
+#include "theme.h"
#include "vframe.h"
#include <stdint.h>
HueSliderClr::HueSliderClr(HueEffect *plugin, HueWindow *gui, int x, int y, int w, int clear)
- : BC_GenericButton(x, y, w, _("⌂"))
+ : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button"))
{
this->plugin = plugin;
this->gui = gui;
HueWindow *gui;
};
-class HueSliderClr : public BC_GenericButton
+class HueSliderClr : public BC_Button
{
public:
HueSliderClr(HueEffect *plugin, HueWindow *gui, int x, int y, int w, int clear);
#include "language.h"
#include "loadbalance.h"
#include "pluginvclient.h"
+#include "theme.h"
#include "vframe.h"
LinearBlurSliderClr::LinearBlurSliderClr(LinearBlurMain *plugin, LinearBlurWindow *gui, int x, int y, int w, int clear)
- : BC_GenericButton(x, y, w, _("⌂"))
+ : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button"))
{
this->plugin = plugin;
this->gui = gui;
LinearBlurWindow *gui;
};
-class LinearBlurSliderClr : public BC_GenericButton
+class LinearBlurSliderClr : public BC_Button
{
public:
LinearBlurSliderClr(LinearBlurMain *plugin, LinearBlurWindow *gui, int x, int y, int w, int clear);
#include "language.h"
#include "loadbalance.h"
#include "pluginvclient.h"
+#include "theme.h"
#include "vframe.h"
PolarWindow *window;
};
-class PolarSliderClr : public BC_GenericButton
+class PolarSliderClr : public BC_Button
{
public:
PolarSliderClr(PolarEffect *plugin, PolarWindow *window, int x, int y, int w, int clear);
PolarSliderClr::PolarSliderClr(PolarEffect *plugin, PolarWindow *window, int x, int y, int w, int clear)
- : BC_GenericButton(x, y, w, _("⌂"))
+ : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button"))
{
this->plugin = plugin;
this->window = window;
RadialBlurSliderClr::RadialBlurSliderClr(RadialBlurMain *plugin, RadialBlurWindow *gui, int x, int y, int w, int clear)
- : BC_GenericButton(x, y, w, _("⌂"))
+ : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button"))
{
this->plugin = plugin;
this->gui = gui;
#include "language.h"
#include "loadbalance.h"
#include "pluginvclient.h"
+#include "theme.h"
#include "vframe.h"
#define RESET_DEFAULT_SETTINGS 10
RadialBlurWindow *gui;
};
-class RadialBlurSliderClr : public BC_GenericButton
+class RadialBlurSliderClr : public BC_Button
{
public:
RadialBlurSliderClr(RadialBlurMain *plugin, RadialBlurWindow *gui, int x, int y, int w, int clear);
RGBShiftSliderClr::RGBShiftSliderClr(RGBShiftEffect *plugin, RGBShiftWindow *window, int x, int y, int w, int clear)
- : BC_GenericButton(x, y, w, _("⌂"))
+ : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button"))
{
this->plugin = plugin;
this->window = window;
#include "language.h"
#include "bccolors.h"
#include "pluginvclient.h"
+#include "theme.h"
#include "vframe.h"
#include <stdint.h>
RGBShiftWindow *window;
};
-class RGBShiftSliderClr : public BC_GenericButton
+class RGBShiftSliderClr : public BC_Button
{
public:
RGBShiftSliderClr(RGBShiftEffect *plugin, RGBShiftWindow *window, int x, int y, int w, int clear);
SharpenSliderClr::SharpenSliderClr(SharpenMain *client, SharpenWindow *gui, int x, int y, int w)
- : BC_GenericButton(x, y, w, _("⌂"))
+ : BC_Button(x, y, w, client->get_theme()->get_image_set("reset_button"))
{
this->client = client;
this->gui = gui;
#include "filexml.h"
#include "mutex.h"
#include "sharpen.h"
+#include "theme.h"
#define RESET_DEFAULT_SETTINGS 10
#define RESET_ALL 0
SharpenWindow *gui;
};
-class SharpenSliderClr : public BC_GenericButton
+class SharpenSliderClr : public BC_Button
{
public:
SharpenSliderClr(SharpenMain *client, SharpenWindow *gui, int x, int y, int w);
ShiftInterlaceSliderClr::ShiftInterlaceSliderClr(ShiftInterlaceMain *plugin, ShiftInterlaceWindow *gui, int x, int y, int w, int clear)
- : BC_GenericButton(x, y, w, _("⌂"))
+ : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button"))
{
this->plugin = plugin;
this->gui = gui;
#include "guicast.h"
#include "language.h"
#include "pluginvclient.h"
+#include "theme.h"
#include "vframe.h"
ShiftInterlaceWindow *gui;
};
-class ShiftInterlaceSliderClr : public BC_GenericButton
+class ShiftInterlaceSliderClr : public BC_Button
{
public:
ShiftInterlaceSliderClr(ShiftInterlaceMain *plugin, ShiftInterlaceWindow *gui, int x, int y, int w, int clear);
"new_bigbutton_dn.png",
"new_ok_images");
+ new_button("reset.png",
+ "reset_up.png",
+ "reset_dn.png",
+ "reset_hi.png",
+ "reset_button");
+
resources->cancel_images = new_button("cancel.png",
"filebox_bigbutton_up.png",
"filebox_bigbutton_hi.png",
"proxy_s_down.png",
"proxy_s_chkdhi.png");
+ mask_mode_toggle = new_image_set(5,
+ "mask_mode_up.png",
+ "mask_mode_hi.png",
+ "mask_mode_chkd.png",
+ "mask_mode_down.png",
+ "mask_mode_chkdhi.png");
+
shbtn_data = new_image_set(3,
"shbtn_up.png",
"shbtn_hi.png",
"generic_dn.png",
"new_ok_images");
+ new_button("reset.png",
+ "reset_up.png",
+ "reset_dn.png",
+ "reset_hi.png",
+ "reset_button");
+
resources->cancel_images = new_button("cancel.png",
"generic_up.png",
"generic_hi.png",
"proxy_s_down.png",
"proxy_s_chkdhi.png");
+ mask_mode_toggle = new_image_set(5,
+ "mask_mode_up.png",
+ "mask_mode_hi.png",
+ "mask_mode_chkd.png",
+ "mask_mode_down.png",
+ "mask_mode_chkdhi.png");
+
shbtn_data = new_image_set(3,
"shbtn_up.png",
"shbtn_hi.png",
"new_bigbutton_dn.png",
"new_ok_images");
+ new_button("reset.png",
+ "reset_up.png",
+ "reset_dn.png",
+ "reset_hi.png",
+ "reset_button");
+
resources->cancel_images = new_button("cancel.png",
"filebox_bigbutton_up.png",
"filebox_bigbutton_hi.png",
"proxy_s_down.png",
"proxy_s_chkdhi.png");
+ mask_mode_toggle = new_image_set(5,
+ "mask_mode_up.png",
+ "mask_mode_hi.png",
+ "mask_mode_chkd.png",
+ "mask_mode_down.png",
+ "mask_mode_chkdhi.png");
+
shbtn_data = new_image_set(3,
"shbtn_up.png",
"shbtn_hi.png",
"generic_dn.png",
"new_ok_images");
+ new_button("reset.png",
+ "reset_up.png",
+ "reset_dn.png",
+ "reset_hi.png",
+ "reset_button");
+
resources->cancel_images = new_button("cancel.png",
"generic_up.png",
"generic_hi.png",
"proxy_s_down.png",
"proxy_s_chkdhi.png");
+ mask_mode_toggle = new_image_set(5,
+ "mask_mode_up.png",
+ "mask_mode_hi.png",
+ "mask_mode_chkd.png",
+ "mask_mode_down.png",
+ "mask_mode_chkdhi.png");
+
shbtn_data = new_image_set(3,
"shbtn_up.png",
"shbtn_hi.png",
"bigbutton_dn.png",
"new_ok_images");
+ new_button("reset.png",
+ "reset_up.png",
+ "reset_dn.png",
+ "reset_hi.png",
+ "reset_button");
+
resources->cancel_images = new_button("cancel.png",
"bigbutton_up.png",
"bigbutton_hi.png",
"proxy_s_down.png",
"proxy_s_chkdhi.png");
+ mask_mode_toggle = new_image_set(5,
+ "mask_mode_up.png",
+ "mask_mode_hi.png",
+ "mask_mode_chkd.png",
+ "mask_mode_down.png",
+ "mask_mode_chkdhi.png");
+
shbtn_data = new_image_set(3,
"shbtn_up.png",
"shbtn_hi.png",
"new_bigbutton_dn.png",
"new_ok_images");
+ new_button("reset.png",
+ "reset_up.png",
+ "reset_dn.png",
+ "reset_hi.png",
+ "reset_button");
+
resources->cancel_images = new_button("cancel.png",
"filebox_bigbutton_up.png",
"filebox_bigbutton_hi.png",
"proxy_s_down.png",
"proxy_s_chkdhi.png");
+ mask_mode_toggle = new_image_set(5,
+ "mask_mode_up.png",
+ "mask_mode_hi.png",
+ "mask_mode_chkd.png",
+ "mask_mode_down.png",
+ "mask_mode_chkdhi.png");
+
shbtn_data = new_image_set(3,
"shbtn_up.png",
"shbtn_hi.png",
"new_bigbutton_hi.png",
"new_bigbutton_dn.png",
"new_ok_images");
+ new_button(
+ "reset.png",
+ "reset_up.png",
+ "reset_dn.png",
+ "reset_hi.png",
+ "reset_button");
resources->cancel_images = new_button(
"cancel.png",
"filebox_bigbutton_up.png",
"proxy_s_chkd.png",
"proxy_s_down.png",
"proxy_s_chkdhi.png");
+ mask_mode_toggle = new_image_set(5,
+ "mask_mode_up.png",
+ "mask_mode_hi.png",
+ "mask_mode_chkd.png",
+ "mask_mode_down.png",
+ "mask_mode_chkdhi.png");
shbtn_data = new_image_set(
3,
"shbtn_up.png",
"new_bigbutton_dn.png",
"new_ok_images");
+ new_button("reset.png",
+ "reset_up.png",
+ "reset_dn.png",
+ "reset_hi.png",
+ "reset_button");
+
resources->cancel_images = new_button("cancel.png",
"filebox_bigbutton_up.png",
"filebox_bigbutton_hi.png",
"proxy_s_down.png",
"proxy_s_chkdhi.png");
+ mask_mode_toggle = new_image_set(5,
+ "mask_mode_up.png",
+ "mask_mode_hi.png",
+ "mask_mode_chkd.png",
+ "mask_mode_down.png",
+ "mask_mode_chkdhi.png");
+
shbtn_data = new_image_set(3,
"shbtn_up.png",
"shbtn_hi.png",
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ viewBox="0 0 4.2333333 4.2333335"
+ version="1.1"
+ id="svg884"
+ inkscape:export-filename="/tmp/reset_hi.png"
+ inkscape:export-xdpi="106.54334"
+ inkscape:export-ydpi="106.54334"
+ sodipodi:docname="r.svg"
+ inkscape:version="0.92.4 (unknown)">
+ <defs
+ id="defs878" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32"
+ inkscape:cx="8.2629635"
+ inkscape:cy="8.7057912"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:pagecheckerboard="true"
+ units="px"
+ showguides="true"
+ inkscape:guide-bbox="true"
+ inkscape:snap-global="false"
+ inkscape:snap-midpoints="true"
+ inkscape:object-paths="true"
+ inkscape:snap-intersection-paths="true"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1043"
+ inkscape:window-x="1920"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1">
+ <sodipodi:guide
+ position="0.26458334,2.1166667"
+ orientation="1,0"
+ id="guide1431"
+ inkscape:locked="false"
+ inkscape:label=""
+ inkscape:color="rgb(0,0,255)" />
+ <sodipodi:guide
+ position="3.9687501,2.1166667"
+ orientation="1,0"
+ id="guide1433"
+ inkscape:locked="false"
+ inkscape:label=""
+ inkscape:color="rgb(0,0,255)" />
+ <sodipodi:guide
+ position="2.1166667,3.9687501"
+ orientation="0,1"
+ id="guide1435"
+ inkscape:locked="false"
+ inkscape:label=""
+ inkscape:color="rgb(0,0,255)" />
+ <sodipodi:guide
+ position="2.1166667,0.26458334"
+ orientation="0,1"
+ id="guide1437"
+ inkscape:locked="false"
+ inkscape:label=""
+ inkscape:color="rgb(0,0,255)" />
+ <sodipodi:guide
+ position="2.1166667,2.1166667"
+ orientation="1,0"
+ id="guide817"
+ inkscape:locked="false"
+ inkscape:label=""
+ inkscape:color="rgb(0,0,255)" />
+ <sodipodi:guide
+ position="2.1166667,2.1166667"
+ orientation="0,1"
+ id="guide819"
+ inkscape:locked="false"
+ inkscape:label=""
+ inkscape:color="rgb(0,0,255)" />
+ <sodipodi:guide
+ position="3.4395834,2.1166667"
+ orientation="1,0"
+ id="guide827"
+ inkscape:locked="false"
+ inkscape:label=""
+ inkscape:color="rgb(0,0,255)" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata881">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Reproduction" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Distribution" />
+ <cc:requires
+ rdf:resource="http://creativecommons.org/ns#Notice" />
+ <cc:requires
+ rdf:resource="http://creativecommons.org/ns#Attribution" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://creativecommons.org/ns#ShareAlike" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Ebene 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-292.76665)">
+ <rect
+ style="opacity:0.13999999;fill:#ffffff;fill-opacity:0;stroke-width:0.52467513;stroke-miterlimit:4;stroke-dasharray:none"
+ id="rect821"
+ width="5.8208332"
+ height="4.2333336"
+ x="-6.9388939e-18"
+ y="292.76666"
+ ry="0.0081253769" />
+ <path
+ style="opacity:1;vector-effect:none;fill:#e6e6e6;fill-opacity:1;stroke:none;stroke-width:0.26143712;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="m 3.2983459,293.35434 a 1.4889471,1.5620282 0 0 0 -1.4889588,1.56204 h 0.4362186 a 1.0528507,1.1045272 0 0 1 1.0527402,-1.10441 1.0528507,1.1045272 0 0 1 1.0527403,1.10441 1.0528507,1.1045272 0 0 1 -1.0527403,1.1044 v 0.45763 a 1.4889471,1.5620282 0 0 0 1.4889589,-1.56203 1.4889471,1.5620282 0 0 0 -1.4889589,-1.56204 z"
+ id="path823"
+ inkscape:connector-curvature="0"
+ inkscape:export-xdpi="106.54334"
+ inkscape:export-ydpi="106.54334" />
+ <path
+ style="fill:#f2f2f2;fill-opacity:1;stroke:none;stroke-width:0.41270712px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 1.1138606,294.65462 h 1.9119255 l -0.9559628,1.45953 z"
+ id="path844"
+ inkscape:connector-curvature="0"
+ inkscape:export-xdpi="106.54334"
+ inkscape:export-ydpi="106.54334" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:0.24772261px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 0.12408457,296.85988 0.007379,-3.96898 5.56550943,0.0168 v 3.96805 z"
+ id="path824"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccc" />
+ </g>
+</svg>
"new_bigbutton_dn.png",
"new_ok_images");
+ new_button("reset.png",
+ "reset_up.png",
+ "reset_dn.png",
+ "reset_hi.png",
+ "reset_button");
+
resources->cancel_images = new_button("cancel.png",
"filebox_bigbutton_up.png",
"filebox_bigbutton_hi.png",
"proxy_s_down.png",
"proxy_s_chkdhi.png");
+ mask_mode_toggle = new_image_set(5,
+ "mask_mode_up.png",
+ "mask_mode_hi.png",
+ "mask_mode_chkd.png",
+ "mask_mode_down.png",
+ "mask_mode_chkdhi.png");
+
shbtn_data = new_image_set(3,
"shbtn_up.png",
"shbtn_hi.png",
"new_bigbutton_dn.png",
"new_ok_images");
+ new_button("reset.png",
+ "reset_up.png",
+ "reset_dn.png",
+ "reset_hi.png",
+ "reset_button");
+
resources->cancel_images = new_button("cancel.png",
"filebox_bigbutton_up.png",
"filebox_bigbutton_hi.png",
"proxy_s_down.png",
"proxy_s_chkdhi.png");
+ mask_mode_toggle = new_image_set(5,
+ "mask_mode_up.png",
+ "mask_mode_hi.png",
+ "mask_mode_chkd.png",
+ "mask_mode_down.png",
+ "mask_mode_chkdhi.png");
+
shbtn_data = new_image_set(3,
"shbtn_up.png",
"shbtn_hi.png",
#include "bcdisplayinfo.h"
#include "language.h"
+#include "theme.h"
#include "unsharp.h"
#include "unsharpwindow.h"
-
-
-
-
-
-
-
-
UnsharpWindow::UnsharpWindow(UnsharpMain *plugin)
: PluginClientWindow(plugin, 285, 170, 285, 170, 0)
{
}
UnsharpSliderClr::UnsharpSliderClr(UnsharpMain *plugin, UnsharpWindow *window, int x, int y, int w, int clear)
- : BC_GenericButton(x, y, w, _("⌂"))
+ : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button"))
{
this->plugin = plugin;
this->window = window;
UnsharpWindow *window;
};
-class UnsharpSliderClr : public BC_GenericButton
+class UnsharpSliderClr : public BC_Button
{
public:
UnsharpSliderClr(UnsharpMain *plugin, UnsharpWindow *window, int x, int y, int w, int clear);
}
WaveSliderClr::WaveSliderClr(WaveEffect *plugin, WaveWindow *gui, int x, int y, int w, int clear)
- : BC_GenericButton(x, y, w, _("⌂"))
+ : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button"))
{
this->plugin = plugin;
this->gui = gui;
#include "language.h"
#include "loadbalance.h"
#include "pluginvclient.h"
+#include "theme.h"
#include "vframe.h"
#include <math.h>
WaveWindow *gui;
};
-class WaveSliderClr : public BC_GenericButton
+class WaveSliderClr : public BC_Button
{
public:
WaveSliderClr(WaveEffect *plugin, WaveWindow *gui, int x, int y, int w, int clear);
#include "language.h"
#include "loadbalance.h"
#include "pluginvclient.h"
+#include "theme.h"
#include "vframe.h"
WhirlWindow *window;
};
-class WhirlSliderClr : public BC_GenericButton
+class WhirlSliderClr : public BC_Button
{
public:
WhirlSliderClr(WhirlEffect *plugin, WhirlWindow *window, int x, int y, int w, int clear);
}
WhirlSliderClr::WhirlSliderClr(WhirlEffect *plugin, WhirlWindow *window, int x, int y, int w, int clear)
- : BC_GenericButton(x, y, w, _("⌂"))
+ : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button"))
{
this->plugin = plugin;
this->window = window;
#include "language.h"
#include "bccolors.h"
#include "pluginvclient.h"
+#include "theme.h"
#include "vframe.h"
#include <stdint.h>
YUVWindow *window;
};
-class YUVSliderClr : public BC_GenericButton
+class YUVSliderClr : public BC_Button
{
public:
YUVSliderClr(YUVEffect *plugin, YUVWindow *window, int x, int y, int w, int clear);
YUVSliderClr::YUVSliderClr(YUVEffect *plugin, YUVWindow *window, int x, int y, int w, int clear)
- : BC_GenericButton(x, y, w, _("⌂"))
+ : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button"))
{
this->plugin = plugin;
this->window = window;
YUVShiftSliderClr::YUVShiftSliderClr(YUVShiftEffect *plugin, YUVShiftWindow *window, int x, int y, int w, int clear)
- : BC_GenericButton(x, y, w, _("⌂"))
+ : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button"))
{
this->plugin = plugin;
this->window = window;
#include "language.h"
#include "bccolors.h"
#include "pluginvclient.h"
+#include "theme.h"
#include "vframe.h"
#include <stdint.h>
YUVShiftWindow *window;
};
-class YUVShiftSliderClr : public BC_GenericButton
+class YUVShiftSliderClr : public BC_Button
{
public:
YUVShiftSliderClr(YUVShiftEffect *plugin, YUVShiftWindow *window, int x, int y, int w, int clear);
ZoomBlurSliderClr::ZoomBlurSliderClr(ZoomBlurMain *plugin, ZoomBlurWindow *window, int x, int y, int w, int clear)
- : BC_GenericButton(x, y, w, _("⌂"))
+ : BC_Button(x, y, w, plugin->get_theme()->get_image_set("reset_button"))
{
this->plugin = plugin;
this->window = window;
#include "language.h"
#include "loadbalance.h"
#include "pluginvclient.h"
+#include "theme.h"
#include "vframe.h"
#define RESET_DEFAULT_SETTINGS 10
};
-class ZoomBlurSliderClr : public BC_GenericButton
+class ZoomBlurSliderClr : public BC_Button
{
public:
ZoomBlurSliderClr(ZoomBlurMain *plugin, ZoomBlurWindow *window, int x, int y, int w, int clear);