diff --git a/src/Clip.cpp b/src/Clip.cpp index c375937e..fc1e8f3f 100644 --- a/src/Clip.cpp +++ b/src/Clip.cpp @@ -588,6 +588,12 @@ string Clip::PropertiesJSON(long int requested_frame) { root["volume"] = add_property_json("Volume", volume.GetValue(requested_frame), "float", "", volume.Contains(requested_point), volume.GetCount(), 0.0, 1.0, volume.GetClosestPoint(requested_point).interpolation, volume.GetClosestPoint(requested_point).co.X, false); root["time"] = add_property_json("Time", time.GetValue(requested_frame), "float", "", time.Contains(requested_point), time.GetCount(), 0.0, 1000 * 60 * 30, time.GetClosestPoint(requested_point).interpolation, time.GetClosestPoint(requested_point).co.X, false); + root["wave_color"] = add_property_json("Wave Color", 0.0, "color", "", wave_color.red.Contains(requested_point), wave_color.red.GetCount(), -10000, 10000, wave_color.red.GetClosestPoint(requested_point).interpolation, wave_color.red.GetClosestPoint(requested_point).co.X, false); + root["wave_color"]["red"] = add_property_json("Red", wave_color.red.GetValue(requested_frame), "float", "", wave_color.red.Contains(requested_point), wave_color.red.GetCount(), -10000, 10000, wave_color.red.GetClosestPoint(requested_point).interpolation, wave_color.red.GetClosestPoint(requested_point).co.X, false); + root["wave_color"]["blue"] = add_property_json("Blue", wave_color.blue.GetValue(requested_frame), "float", "", wave_color.blue.Contains(requested_point), wave_color.blue.GetCount(), -10000, 10000, wave_color.blue.GetClosestPoint(requested_point).interpolation, wave_color.blue.GetClosestPoint(requested_point).co.X, false); + root["wave_color"]["green"] = add_property_json("Green", wave_color.green.GetValue(requested_frame), "float", "", wave_color.green.Contains(requested_point), wave_color.green.GetCount(), -10000, 10000, wave_color.green.GetClosestPoint(requested_point).interpolation, wave_color.green.GetClosestPoint(requested_point).co.X, false); + + // Return formatted string return root.toStyledString(); } diff --git a/src/Frame.cpp b/src/Frame.cpp index 3003d334..fb1b15f3 100644 --- a/src/Frame.cpp +++ b/src/Frame.cpp @@ -185,7 +185,7 @@ tr1::shared_ptr Frame::GetWaveform(int width, int height, int Red, int G // Create blank image wave_image = tr1::shared_ptr(new QImage(total_width, total_height, QImage::Format_RGBA8888)); - wave_image->fill(QColor(QString::fromStdString("#000000"))); + wave_image->fill(QColor(0,0,0,0)); // Load QPainter with wave_image device QPainter painter(wave_image.get()); diff --git a/src/Timeline.cpp b/src/Timeline.cpp index aa2fa118..69e90b00 100644 --- a/src/Timeline.cpp +++ b/src/Timeline.cpp @@ -198,8 +198,6 @@ void Timeline::add_layer(tr1::shared_ptr new_frame, Clip* source_clip, lo // Get the clip's frame & image tr1::shared_ptr source_frame; - - #pragma omp ordered source_frame = tr1::shared_ptr(source_clip->GetFrame(clip_frame_number)); @@ -210,6 +208,23 @@ void Timeline::add_layer(tr1::shared_ptr new_frame, Clip* source_clip, lo // Debug output AppendDebugMethod("Timeline::add_layer", "new_frame->number", new_frame->number, "clip_frame_number", clip_frame_number, "timeline_frame_number", timeline_frame_number, "", -1, "", -1, "", -1); + /* REPLACE IMAGE WITH WAVEFORM IMAGE (IF NEEDED) */ + if (source_clip->Waveform()) + { + // Debug output + AppendDebugMethod("Timeline::add_layer (Generate Waveform Image)", "source_frame->number", source_frame->number, "source_clip->Waveform()", source_clip->Waveform(), "clip_frame_number", clip_frame_number, "", -1, "", -1, "", -1); + + // Get the color of the waveform + int red = source_clip->wave_color.red.GetInt(clip_frame_number); + int green = source_clip->wave_color.green.GetInt(clip_frame_number); + int blue = source_clip->wave_color.blue.GetInt(clip_frame_number); + int alpha = source_clip->wave_color.alpha.GetInt(clip_frame_number); + + // Generate Waveform Dynamically (the size of the timeline) + tr1::shared_ptr source_image = source_frame->GetWaveform(info.width, info.height, red, green, blue, alpha); + source_frame->AddImage(tr1::shared_ptr(source_image)); + } + /* Apply effects to the source frame (if any). If multiple clips are overlapping, only process the * effects on the top clip. */ if (is_top_clip) @@ -259,29 +274,11 @@ void Timeline::add_layer(tr1::shared_ptr new_frame, Clip* source_clip, lo } - /* GET IMAGE DATA - OR GENERATE IT */ - if (!source_clip->Waveform()) - { - // Debug output - AppendDebugMethod("Timeline::add_layer (Get Source Image)", "source_frame->number", source_frame->number, "source_clip->Waveform()", source_clip->Waveform(), "clip_frame_number", clip_frame_number, "", -1, "", -1, "", -1); + // Debug output + AppendDebugMethod("Timeline::add_layer (Get Source Image)", "source_frame->number", source_frame->number, "source_clip->Waveform()", source_clip->Waveform(), "clip_frame_number", clip_frame_number, "", -1, "", -1, "", -1); - // Get actual frame image data - source_image = source_frame->GetImage(); - } - else - { - // Debug output - AppendDebugMethod("Timeline::add_layer (Generate Waveform Image)", "source_frame->number", source_frame->number, "source_clip->Waveform()", source_clip->Waveform(), "clip_frame_number", clip_frame_number, "", -1, "", -1, "", -1); - - // Get the color of the waveform - int red = source_clip->wave_color.red.GetInt(clip_frame_number); - int green = source_clip->wave_color.green.GetInt(clip_frame_number); - int blue = source_clip->wave_color.blue.GetInt(clip_frame_number); - int alpha = source_clip->wave_color.alpha.GetInt(clip_frame_number); - - // Generate Waveform Dynamically (the size of the timeline) - source_image = source_frame->GetWaveform(info.width, info.height, red, green, blue, alpha); - } + // Get actual frame image data + source_image = source_frame->GetImage(); // Get some basic image properties int source_width = source_image->width(); @@ -1076,7 +1073,13 @@ void Timeline::apply_json_to_effects(Json::Value change, EffectBase* existing_ef EffectBase *e = NULL; // Init the matching effect object - if (effect_type == "ChromaKey") + if (effect_type == "Blur") + e = new Blur(); + + else if (effect_type == "Brightness") + e = new Brightness(); + + else if (effect_type == "ChromaKey") e = new ChromaKey(); else if (effect_type == "Deinterlace") @@ -1088,6 +1091,9 @@ void Timeline::apply_json_to_effects(Json::Value change, EffectBase* existing_ef else if (effect_type == "Negate") e = new Negate(); + else if (effect_type == "Saturation") + e = new Saturation(); + // Load Json into Effect e->SetJsonValue(change["value"]);