From e2573e81445262c7bd3ef0405dadf72aa85e6b9b Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Sat, 16 Jan 2016 21:53:07 -0600 Subject: [PATCH] Flipping alpha channel values. It was brought to my attention that the meaning of alpha was opposite of what was being used. So, sorry if this breaks some things, but better to get it fixed quickly, and for the value to make sense. --- include/Clip.h | 2 +- src/Clip.cpp | 2 +- src/Timeline.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/Clip.h b/include/Clip.h index f924691d..8092f895 100644 --- a/include/Clip.h +++ b/include/Clip.h @@ -218,7 +218,7 @@ namespace openshot { Keyframe location_y; ///< Curve representing the relative Y position in percent based on the gravity (-100 to 100) // Alpha and Rotation curves - Keyframe alpha; ///< Curve representing the alpha or transparency (0 to 1) + Keyframe alpha; ///< Curve representing the alpha (1 to 0) Keyframe rotation; ///< Curve representing the rotation (0 to 360) // Time and Volume curves diff --git a/src/Clip.cpp b/src/Clip.cpp index c32a6794..8b085bff 100644 --- a/src/Clip.cpp +++ b/src/Clip.cpp @@ -52,7 +52,7 @@ void Clip::init_settings() location_y = Keyframe(0.0); // Init alpha & rotation - alpha = Keyframe(0.0); + alpha = Keyframe(1.0); rotation = Keyframe(0.0); // Init time & volume diff --git a/src/Timeline.cpp b/src/Timeline.cpp index 3faefd83..9973a665 100644 --- a/src/Timeline.cpp +++ b/src/Timeline.cpp @@ -289,7 +289,7 @@ void Timeline::add_layer(tr1::shared_ptr new_frame, Clip* source_clip, lo int source_height = source_image->height(); /* ALPHA & OPACITY */ - if (source_clip->alpha.GetValue(clip_frame_number) != 0) + if (source_clip->alpha.GetValue(clip_frame_number) != 1.0) { float alpha = source_clip->alpha.GetValue(clip_frame_number); @@ -303,7 +303,7 @@ void Timeline::add_layer(tr1::shared_ptr new_frame, Clip* source_clip, lo int A = pixels[byte_index + 3]; // Apply alpha to pixel - pixels[byte_index + 3] *= (1.0 - alpha); + pixels[byte_index + 3] *= alpha; } // Debug output