Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added notification/messages to make Effect Strength slider work "live" #658

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions addons/AddOns/Sharpness/Sharpness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,15 @@ SharpnessManipulator::ChangeSettings(ManipulatorSettings* s)
new_settings = dynamic_cast<SharpnessManipulatorSettings*>(s);
if (new_settings != NULL) {
if (new_settings->blur_size != settings.blur_size) {
BBitmap* tmp_bitmap = DuplicateBitmap(copy_of_the_preview_bitmap, 0);
ipLibrary->gaussian_blur(tmp_bitmap, new_settings->blur_size, processor_count);

int32* d_bits = (int32*)blurred_image->Bits();
int32* s_bits = (int32*)copy_of_the_preview_bitmap->Bits();
int32 bits_length = blurred_image->BitsLength();
int32* s_bits = (int32*)tmp_bitmap->Bits();
int32 bits_length = tmp_bitmap->BitsLength();

memcpy(d_bits, s_bits, bits_length);
ipLibrary->gaussian_blur(blurred_image, new_settings->blur_size, processor_count);
delete tmp_bitmap;
}

settings = *new_settings;
Expand Down Expand Up @@ -442,6 +445,7 @@ SharpnessManipulatorView::SharpnessManipulatorView(SharpnessManipulator* manip,

blur_size_slider = new BSlider("blur_size_slider", B_TRANSLATE("Effect strength:"),
new BMessage(BLUR_ADJUSTING_FINISHED), 1, 50, B_HORIZONTAL, B_TRIANGLE_THUMB);
blur_size_slider->SetModificationMessage(new BMessage(BLUR_ADJUSTED));
blur_size_slider->SetLimitLabels(B_TRANSLATE("Low"), B_TRANSLATE("High"));
blur_size_slider->SetHashMarks(B_HASH_MARKS_BOTTOM);
blur_size_slider->SetHashMarkCount(11);
Expand Down Expand Up @@ -491,8 +495,18 @@ SharpnessManipulatorView::MessageReceived(BMessage* message)
manipulator->ChangeSettings(&settings);
target.SendMessage(HS_MANIPULATOR_ADJUSTING_FINISHED);
} break;
case BLUR_ADJUSTED:
{
settings.blur_size = blur_size_slider->Value();
manipulator->ChangeSettings(&settings);
if (!started_adjusting) {
target.SendMessage(HS_MANIPULATOR_ADJUSTING_STARTED);
started_adjusting = TRUE;
}
}
case BLUR_ADJUSTING_FINISHED:
{
started_adjusting = FALSE;
settings.blur_size = blur_size_slider->Value();
manipulator->ChangeSettings(&settings);
target.SendMessage(HS_MANIPULATOR_ADJUSTING_FINISHED);
Expand Down
1 change: 1 addition & 0 deletions addons/AddOns/Sharpness/Sharpness.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class SharpnessManipulator : public WindowGUIManipulator {
#define SHARPNESS_ADJUSTED 'Shad'
#define SHARPNESS_ADJUSTING_FINISHED 'Shaf'

#define BLUR_ADJUSTED 'Blad'
#define BLUR_ADJUSTING_FINISHED 'Blaf'


Expand Down
Loading