diff --git a/src/Clip.cpp b/src/Clip.cpp index 67bc1229..b203cb6b 100644 --- a/src/Clip.cpp +++ b/src/Clip.cpp @@ -15,8 +15,8 @@ void Clip::init_settings() anchor = ANCHOR_CANVAS; // Init scale curves - scale_x = Keyframe(100.0); - scale_y = Keyframe(100.0); + scale_x = Keyframe(1.0); + scale_y = Keyframe(1.0); // Init location curves location_x = Keyframe(0.0); diff --git a/src/Main.cpp b/src/Main.cpp index 43889fac..b29d9452 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -31,8 +31,8 @@ int main() Timeline t(640, 360, Framerate(24,1), 44100, 2); // Add some clips - Clip c1(new FFmpegReader("/home/jonathan/Videos/sintel-1024-stereo.mp4")); - Clip c2(new ImageReader("/home/jonathan/Apps/videcho_site/media/logos/watermark.png")); + Clip c1(new FFmpegReader("/home/jonathan/Videos/sintel_trailer-720p.mp4")); + Clip c2(new ImageReader("/home/jonathan/apps/videcho_site/media/logos/watermark.png")); c1.Position(1.0); c2.Position(1.0); c2.Layer(1); @@ -40,8 +40,8 @@ int main() c1.rotation.AddPoint(1, 1); c1.rotation.AddPoint(300, 360); - c1.alpha.AddPoint(1, 0); - c1.alpha.AddPoint(300, 1); + //c1.alpha.AddPoint(1, 0); + //c1.alpha.AddPoint(300, 1); c2.alpha.AddPoint(1, 1); c2.alpha.AddPoint(30, 0); @@ -55,7 +55,7 @@ int main() c2.location_y.AddPoint(1, 0); c2.location_y.AddPoint(300, 300); - c2.rotation.AddPoint(60, 0, LINEAR); + c2.rotation.AddPoint(60, 1, LINEAR); c2.rotation.AddPoint(150, 360); diff --git a/src/Timeline.cpp b/src/Timeline.cpp index 1a3043cf..b7f3a73a 100644 --- a/src/Timeline.cpp +++ b/src/Timeline.cpp @@ -48,8 +48,8 @@ void Timeline::add_layer(tr1::shared_ptr new_frame, Clip* source_clip, in new_frame->AddColor(width, height, "#000000"); // Apply image effects - if (source_clip->rotation.GetValue(clip_frame_number) != 0) - source_image->rotate(source_clip->rotation.GetValue(clip_frame_number)); + //if (source_clip->rotation.GetValue(clip_frame_number) != 0) + // source_image->rotate(source_clip->rotation.GetValue(clip_frame_number)); if (source_clip->alpha.GetValue(clip_frame_number) != 0) { // Calculate opacity of new image @@ -62,9 +62,28 @@ void Timeline::add_layer(tr1::shared_ptr new_frame, Clip* source_clip, in for (int channel = 0; channel < source_frame->GetAudioChannelsCount(); channel++) new_frame->AddAudio(channel, 0, source_frame->GetAudioSamples(channel), source_frame->GetAudioSamplesCount(), 1.0f); + // Location, Rotation, and Scale + float r = source_clip->rotation.GetValue(clip_frame_number); + float x = source_clip->location_x.GetValue(clip_frame_number); + float y = source_clip->location_y.GetValue(clip_frame_number); + float sx = source_clip->scale_x.GetValue(clip_frame_number); + float sy = source_clip->scale_y.GetValue(clip_frame_number); + + cout << "r: " << r << endl; + cout << "x: " << x << endl; + cout << "y: " << y << endl; + + // X,Y Scale Angle NewX,NewY + double distort_args[7] = { source_image->columns()/2,source_image->rows()/2, sx,sy, r, x,y }; + //source_image->size(Magick::Geometry(round(x + source_image->columns()), round(y + source_image->rows()), 0,0,false,false)); + source_image->distort(Magick::ScaleRotateTranslateDistortion, 7, distort_args, true); + + if (clip_frame_number == 100) + source_image->display(); + // Composite images together tr1::shared_ptr new_image = new_frame->GetImage(); - new_image->composite(*source_image.get(), source_clip->location_x.GetInt(clip_frame_number), source_clip->location_y.GetInt(clip_frame_number), Magick::BlendCompositeOp); + new_image->composite(*source_image.get(), 0, 0, Magick::BlendCompositeOp); } // Update the list of 'opened' clips