App-GUI-Juliagraph

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    be added. Just click the checkbox in the upper right corner. If chosen
    the constant or starting value is then the sum of pixel coordinates with
    the displayed value.

    The fifth section holds all values that determine the end of the
    computation on one spot. There are two conditions that can trigger that.
    Either you run out of iterations (exceeded the maximal interation
    *count*). Please note, that the actual number is the displayed number
    squared. This gives you a wider range eof options and a little more
    comfort while changing the value. When the computation runs out of
    iterations, the current pixel will get the background color. The second
    stop criterion is fulfilled when the value exceeds the bailout limit
    (*Value*), which is also the displayed number squared. In the right
    corner you got ten different ways how to compute the amount of z.
    Mathematicians call them merics. They mostly influence the shape around
    the main shape (the crwon - corona).

  Monomials
    The second tab contains 4 identical sections which also work the same
    way. Each of them stand in for a monomial of the iteration equation, but
    only if the checkbox *On* is marked. A second checkbox decides if this

README  view on Meta::CPAN

    monomial. This just mentioned power "n" ca be chosen right beside the
    checkboxes. The higher this power is, the longer it takes to calculate
    the picture, but it adds also a nice rotational symmetry. "Mandelbrot"
    has a (n-1)-times rot symmetry and "Julia" a n-times rotational
    symmetry.

  Color Mapping
    This page is about mapping the iteration number at bailout to a color.
    To be able to do that better you can preview here the color rainbow
    between the first and second section. Below the color rainbow is another
    this monochrome strip. It displayes the currently active background
    color. The rainbow is from left (low iteration number) to right (high).

    The first section starts with a checkbox. When deselected, the fractal
    gets a gray scale. When selected all color choices are in effect. The
    rainbow goes from begin color number to end color number over every
    color in between. So if you for instance selected 2 and 4, the rainbow
    has a gradient from color 2 to color 3 and a second from 3 to 4. The
    exact colors will be changes on the next page. The gradients might vary
    dependant on chosen "dynamic" and color "space" in which they are
    computed.

README  view on Meta::CPAN

    options here parallel what we already described. Subgradients will have
    the amount of steps as dialed in under "Steps". The gradient will be
    computed from 1 (above bailout value) up to the "Size" value. Everything
    above just lands in the last bucket. The subgradient can again be skewed
    by a "Distribution" and "Dynamic" value (as described above). Also the
    resulting color change dependant in which color "Space" it is computed
    in. *RBG* gives usually more smooth results and *HSL* more contrast.

  Colors
    This page helps you to select the color that will be used to paint the
    fractal. You can see them in the middle row. The background color is
    often the one at the most left. That is why it is marked by a vertical
    bar. The colors are numbered from left to right with 1 to 11.

    The first section on the pages is for loading and saving custom sets of
    colors. Please use the delete button carefully. "New" saves the current
    colors under a new name, "Save" under the current name. There are no
    undo buttons yet.

    The section below helps you to compute related colors beweet the second
    and the currently selected. This can be either a gradient (with

lib/App/GUI/Juliagraph.pm  view on Meta::CPAN

can be added. Just click the checkbox in the upper right corner. If
chosen the constant or starting value is then the sum of pixel coordinates
with the displayed value.

The fifth section holds all values that determine the end of the computation
on one spot. There are two conditions that can trigger that. Either you run
out of iterations (exceeded the maximal interation I<count>). Please note,
that the actual number is the displayed number squared. This gives you a
wider range eof options and a little more comfort while changing the value.
When the computation runs out of iterations, the current pixel will get
the background  color. The second stop criterion is fulfilled when
the value exceeds the bailout limit (I<Value>), which is also the displayed
number squared. In the right corner you got ten different ways how to compute
the amount of z. Mathematicians call them merics. They mostly influence
the shape around the main shape (the crwon - corona).

=head2 Monomials

=for HTML <p>
<img src="https://raw.githubusercontent.com/lichtkind/App-GUI-Juliagraph/master/img/POD/Tab_Polynomials.png"    alt=""  width="630" height="410">
</p>

lib/App/GUI/Juliagraph.pm  view on Meta::CPAN


=head2 Color Mapping

=for HTML <p>
<img src="https://raw.githubusercontent.com/lichtkind/App-GUI-Juliagraph/master/img/POD/Tab_Mapping.png"    alt=""  width="630" height="410">
</p>

This page is about mapping the iteration number at bailout to a color.
To be able to do that better you can preview here the color rainbow
between the first and second section. Below the color rainbow is another
this monochrome strip. It displayes the currently active background color.
The rainbow is from left (low iteration number) to right (high).

The first section starts with a checkbox. When deselected, the fractal
gets a gray scale. When selected all color choices are in effect. The
rainbow goes from begin color number to end color number over every color
in between. So if you for instance selected 2 and 4, the rainbow has a
gradient from color 2 to color 3 and a second from 3 to 4. The exact colors
will be changes on the next page. The gradients might vary dependant on
chosen C<dynamic> and color C<space> in which they are computed.

lib/App/GUI/Juliagraph.pm  view on Meta::CPAN



=head2 Colors

=for HTML <p>
<img src="https://raw.githubusercontent.com/lichtkind/App-GUI-Juliagraph/master/img/POD/Tab_Color.png"    alt=""  width="630" height="410">
</p>

This page helps you to select the color that will be used to paint the fractal.
You can see them in the middle row.
The background color is often the one at the most left.  That is why it
is marked by a vertical bar. The colors are numbered from left to right
with 1 to 11.

The first section on the pages is for loading and saving custom sets of
colors. Please use the delete button carefully. C<New> saves the current
colors under a new name, C<Save> under the current name. There are no
undo buttons yet.

The section below helps you to compute related colors beweet the second
and the currently selected. This can be either a gradient (with C<Gradient>

lib/App/GUI/Juliagraph/Compute/Image.pm  view on Meta::CPAN

my %progress_bar;
sub add_progress_bar {
    my( $name, $bar ) = @_;
    $progress_bar{$name} = $bar
        if ref $bar eq 'App::GUI::Juliagraph::Widget::ProgressBar'
        and not exists $progress_bar{$name};
}

sub compute_colors {
    my( $set, $max_iter ) = @_;
    my (@color_object, %gradient_mapping, $gradient_total_length, @color_value, $background_color);

    if ($set->{'mapping'}{'custom_partition'}){
        %gradient_mapping = %{ App::GUI::Juliagraph::Compute::Mapping::scales(
            $set->{'mapping'}{'scale_distro'}, $max_iter, $set->{'mapping'}{'scale_steps'}
        )};
        $gradient_total_length = $set->{'mapping'}{'scale_steps'};
    } else {
        $gradient_total_length = $max_iter;
    }

lib/App/GUI/Juliagraph/Compute/Image.pm  view on Meta::CPAN

            my $start_color = color( $set->{'color'}{$color_nr} );
            $color_nr += $gradient_direction;
            # last partial gradient has to full it up to the end
            $gradient_part_length = $gradient_total_length - @color_object if $color_nr == $end_nr;
            push @color_object, $start_color->gradient( to => $set->{'color'}{ $color_nr },
                                                     steps => $gradient_part_length,
                                                        in => $set->{'mapping'}{'gradient_space'},
                                                      tilt => $set->{'mapping'}{'gradient_dynamic'} );
            pop @color_object if $color_nr != $end_nr;
        }
        $background_color = (substr($set->{'mapping'}{'background_color'}, 0, 5) eq 'color')
                          ? $set->{'color'}{'11'}
                          : $set->{'mapping'}{'background_color'};
        $background_color = '#001845' if $background_color eq 'blue';
        $background_color = color( $background_color );
    } else {
        @color_object = color('white')->gradient( to => 'black', steps => $max_iter,
                                                  in => $set->{'mapping'}{'gradient_space'},
                                             dynamic => $set->{'mapping'}{'gradient_dynamic'} );
        $background_color = $color_object[ -1 ];
    }

    if ($set->{'mapping'}{'use_subgradient'}){
        push @color_object, $color_object[-1];
        my %subgradient_mapping = %{ App::GUI::Juliagraph::Compute::Mapping::scales(
             $set->{'mapping'}{'subgradient_distro'},
             $set->{'mapping'}{'subgradient_size'},
             $set->{'mapping'}{'subgradient_steps'},
        )};
        for my $subgradient_nr (1 .. $max_iter) {

lib/App/GUI/Juliagraph/Compute/Image.pm  view on Meta::CPAN

                    for 0 .. $set->{'mapping'}{'subgradient_size'} - 1;
        }
    } else {
        @color_value = map { [$_->values( 'RGB' )] } @color_object;
        if (%gradient_mapping){
            my @temp_color = @color_value;
            $color_value[$_] = $temp_color[ $gradient_mapping{$_} ] for 0 .. $max_iter-1;
        }
    }

    return \@color_value, [ $background_color->values( 'RGB' ) ];
}

sub from_settings {
    my( $set, $size, $sketch ) = @_;
    my $img = Wx::Image->new( $size->{'x'}, $size->{'y'} );
    my $sketch_factor = (defined $sketch) ? SKETCH_FACTOR : 0;
    #my $t0 = Benchmark->new();

    my $max_iter  =  int $set->{'constraint'}{'stop_nr'} ** 2;
    my $max_value =  int $set->{'constraint'}{'stop_value'} ** 2;
    my $zoom      = 140 * $set->{'constraint'}{'zoom'};
    my $schranke  = $max_value;

    my $color_index_max = $schranke + $set->{'mapping'}{'subgradient_size'};
    my ($colors, $background_color) = compute_colors( $set, $max_iter );
    for my $bar_name (keys %progress_bar){
        my $bar = $progress_bar{$bar_name};
        my $gradient_percent = 100 / @$colors;
        $bar->reset;
        next if $bar_name eq 'pen' and $sketch_factor;
        if ($bar_name eq 'background'){
            $bar->set_start_color( @$background_color );
            $bar->add_percentage( 100, $background_color );
        } else {
            if ($set->{'mapping'}{'use_subgradient'}){
                $bar->set_start_color( @{$colors->[0][0]} );

                my $subgradient_length = @{$colors->[0]};
                $gradient_percent /= $subgradient_length;
                my $color_counter = 0;
                for my $gradient_nr (0 .. $#$colors) {
                    for my $subgradient_pos (0 .. $subgradient_length - 1) {
                        $bar->add_percentage( $color_counter++ * $gradient_percent ,

lib/App/GUI/Juliagraph/Compute/Image.pm  view on Meta::CPAN

    my $x = $offset_x;
    my @code = (
        'for my $pixel_x (0 .. $max_pixel_x){',
        '  my $y = $offset_y',
        '  for my $pixel_y (0 .. $max_pixel_y){',
       ($set->{'constraint'}{'coor_as_start'} ?
        '    ($za, $zb) = ($start_a + $x, $start_b + $y)' :
        '    ($za, $zb) = ($start_a, $start_b)' ),
        '    $zqa = $za * $za',
        '    $zqb = $zb * $zb',
        '    $color = $background_color',
        '    for my $i (0 .. $max_iter - 1){',
        '      ($z[2][0], $z[2][1]) = ($zqa - $zqb, 2 * $za * $zb)',
        @monomial_code,
        ($set->{'constraint'}{'coor_as_const'} ?
       ('      $za += $x + '.$const_a,
        '      $zb += $y + '.$const_b) :
       ('      $za += '.$const_a,
        '      $zb += '.$const_b,    ) ),
        '      $zqa = $za * $za',
        '      $zqb = $zb * $zb',

lib/App/GUI/Juliagraph/Frame.pm  view on Meta::CPAN


    $self->{'tab_names'} = [keys %{ $self->{'tab'} }];
    $self->{'tab'}{$_}->SetCallBack( sub { $self->sketch( ) } ) for @{$self->{'tab_names'}};

    $self->{'dialog'}{'about'}     = App::GUI::Juliagraph::Dialog::About->new();
    $self->{'progress_bar'}        = App::GUI::Juliagraph::Widget::ProgressBar->new( $self, 430, 5, [20, 20, 110]);
    $self->{'board'}               = App::GUI::Juliagraph::Frame::Panel::Board->new( $self , 600, 600 );
    $self->{'board'}->connect_constrains_tab( $self->{'tab'}{'constraint'} );
    App::GUI::Juliagraph::Compute::Image::add_progress_bar('pen', $self->{'progress_bar'});
    App::GUI::Juliagraph::Compute::Image::add_progress_bar('preview', $self->{'tab'}{'mapping'}{'color_rainbow'});
    App::GUI::Juliagraph::Compute::Image::add_progress_bar('background', $self->{'tab'}{'mapping'}{'background_rainbow'});

    my $btnw = 50; my $btnh     = 40;# button width and height
    $self->{'btn'}{'draw'}      = Wx::Button->new( $self, -1, '&Draw', [-1,-1],[$btnw, $btnh] );
    $self->{'btn'}{'draw'}->SetToolTip('redraw the harmonographic image');

    Wx::Event::EVT_BUTTON(     $self, $self->{'btn'}{'draw'},  sub { draw( $self ) });
    Wx::Event::EVT_CLOSE(      $self, sub {
        $self->{'tab'}{'color'}->update_config();
        $self->{'config'}->save();
        $self->{'dialog'}{about}->Destroy();

lib/App/GUI/Juliagraph/Frame/Tab/Color.pm  view on Meta::CPAN


    $self->{'used_colors'}     = [ color('blue')->gradient( to => 'red', steps => $self->{'active_color_count'}) ];
    $self->{'used_colors'}[$_] = color( $default_color_def ) for $self->{'active_color_count'} .. $self->{'color_count'}-1;
    $self->{'color_marker'}    = [ map { App::GUI::Juliagraph::Widget::PositionMarker->new
                                           ($self, $self->{'display_size'}, 20, $_, '', $default_color_def) } 0 .. $self->{'color_count'}-1 ];
    $self->{'color_display'}[$_] = App::GUI::Juliagraph::Widget::ColorDisplay->new
        ($self, $self->{'display_size'}-2, $self->{'display_size'},
         $_, $self->{'used_colors'}[$_]->values(as => 'hash')      ) for 0 .. $self->{'color_count'}-1;
    $self->{'color_marker'}[$_-1]->SetToolTip("color $_, to change (marked by arrow - crosses mark currently passive colors)") for 1 .. $self->{'color_count'}-1;
    $self->{'color_display'}[$_-1]->SetToolTip("color $_, to change (marked by arrow - crosses mark currently passive colors)") for 1 .. $self->{'color_count'}-1;
    $self->{'color_marker'}[$size-1]->SetToolTip("lost color, often background color, shown where values do not converge");
    $self->{'color_display'}[$size-1]->SetToolTip("last color, often background color, shown where values do not converge");

    $self->{'label'}{'color_set_store'} = Wx::StaticText->new($self, -1, 'Color Set Store' );
    $self->{'label'}{'color_set_funct'} = Wx::StaticText->new($self, -1, 'Colors Set Function' );
    $self->{'label'}{'used_colors'}     = Wx::StaticText->new($self, -1, 'Currently Used Colors' );
    $self->{'label'}{'selected_color'}  = Wx::StaticText->new($self, -1, 'Selected Color' );
    $self->{'label'}{'color_store'}     = Wx::StaticText->new($self, -1, 'Color Store' );

    $self->{'widget'}{'tilt'} = Wx::ComboBox->new( $self, -1, 1, [-1,-1], [80, -1], [ -6, -5, -4, -3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3, 4, 5, 6]);
    $self->{'widget'}{'delta_S'} = Wx::TextCtrl->new( $self, -1, 0, [-1,-1], [50,-1], &Wx::wxTE_RIGHT);
    $self->{'widget'}{'delta_L'} = Wx::TextCtrl->new( $self, -1, 0, [-1,-1], [50,-1], &Wx::wxTE_RIGHT);

lib/App/GUI/Juliagraph/Frame/Tab/Mapping.pm  view on Meta::CPAN

use warnings;
use base qw/Wx::Panel/;
use Graphics::Toolkit::Color qw/color/;
use Wx;
use App::GUI::Juliagraph::Widget::SliderStep;
use App::GUI::Juliagraph::Widget::SliderCombo;
use App::GUI::Juliagraph::Widget::ProgressBar;

my $default_settings =  {
        custom_partition => 0, scale_steps => 20, scale_distro => 'square',
        user_colors => 1, begin_color => 'color 2', end_color => 'color 4', background_color => 'black',
        gradient_dynamic => 0, gradient_space => 'HSL',
        use_subgradient => 0, subgradient_size => 500, subgradient_steps => 5,
        subgradient_dynamic => 0, subgradient_space => 'HSL', subgradient_distro => 'sqrt',
    };

sub new {
    my ( $class, $parent ) = @_;

    my $self = $class->SUPER::new( $parent, -1);
    $self->{'callback'} = sub {};

lib/App/GUI/Juliagraph/Frame/Tab/Mapping.pm  view on Meta::CPAN


    my @color_names = map { 'color '.$_ } 1 .. 11;
    $self->{'custom_partition'} = Wx::CheckBox->new( $self, -1,  '', [-1,-1],[30, -1]);
    $self->{'user_colors'}      = Wx::CheckBox->new( $self, -1,  '', [-1,-1],[30, -1]);
    $self->{'use_subgradient'}  = Wx::CheckBox->new( $self, -1,  '', [-1,-1],[30, -1]);
    $self->{'scale_steps'}  = App::GUI::Juliagraph::Widget::SliderCombo->new( $self, 252, 'Steps :', "In how many parts the scale (0 .. max) will be partitioned, meaning: how many different colors/shades we use to paint the fractal", 2, 100, 20);
    $self->{'scale_max'}    = Wx::TextCtrl->new( $self, -1,         0, [-1,-1], [60, -1], &Wx::wxTE_RIGHT | &Wx::wxTE_READONLY);
    $self->{'scale_distro'} = Wx::ComboBox->new( $self, -1, 'linear',  [-1,-1],[100, -1], [qw/log cubert sqrt linear square cube exp/]);
    $self->{'begin_color'}  = Wx::ComboBox->new( $self, -1, 'color 3', [-1,-1],[100, -1], [@color_names]);
    $self->{'end_color'}    = Wx::ComboBox->new( $self, -1, 'color 4', [-1,-1],[100, -1], [@color_names]);
    $self->{'background_color'}   = Wx::ComboBox->new( $self, -1,'black', [-1,-1],[100,-1], [qw/black blue gray white/, 'color 11']);
    $self->{'gradient_dynamic'}   = Wx::ComboBox->new( $self, -1,      0, [-1,-1],[80, -1], [-5, -4, -3, -2.5, -2, -1.6, -1.3, -1, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 1, 1.3, 1.6, 2, 2.5, 3, 4, 5...
    $self->{'gradient_space'}     = Wx::ComboBox->new( $self, -1,  'RGB', [-1,-1],[80, -1], [qw/RGB HSL/]);
    $self->{'subgradient_steps'}  = App::GUI::Juliagraph::Widget::SliderCombo->new( $self, 249, 'Steps :', "How man shades toes the subgradient have ?", 2, 100, 5, 1);
    $self->{'subgradient_size'}   = App::GUI::Juliagraph::Widget::SliderCombo->new( $self, 249, 'Size :', "Up to which value (Bailout/Stop Value + X) does the scale goes, from which subgradient is computed", 100, 5000, 500, 50);
    $self->{'subgradient_space'}  = Wx::ComboBox->new( $self, -1,  'RGB', [-1,-1],[80, -1], [qw/RGB HSL/]);
    $self->{'subgradient_dynamic'}= Wx::ComboBox->new($self, -1,     0, [-1,-1],[80, -1], [-5, -4, -3, -2.5, -2, -1.6, -1.3, -1, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 1, 1.3, 1.6, 2, 2.5, 3, 4, 5])...
    $self->{'subgradient_distro'} = Wx::ComboBox->new( $self, -1, 'linear',  [-1,-1],[100, -1], [qw/log cubert sqrt linear square cube exp/]);
    $self->{'custom_partition'}->SetToolTip('Divide the scale of possible iterations into goups (partitions) that can be mapped to colors. Use every iteration count gets its own color when off.');
    $self->{'scale_max'}->SetToolTip('Maximal iteration count.');
    $self->{'scale_distro'}->SetToolTip('Relation between partitions size wise, linear means they all equally big.');
    $self->{'user_colors'}->SetToolTip('Use chosen color selection to compute color rainbow (on) or just a gray scale (off).');
    $self->{'use_subgradient'}->SetToolTip('Make color gradient smoother by computing gradients between colored areas based on final value of iteration.');
    $self->{'begin_color'}->SetToolTip('Starting color of the rainbow.');
    $self->{'end_color'}->SetToolTip('Endcolor of the rainbow');
    $self->{'background_color'}->SetToolTip('Color that is used to paint areas where iteration stays below stop value.');
    $self->{'gradient_dynamic'}->SetToolTip('Skew direction of gradient (positive value = left)');
    $self->{'subgradient_dynamic'}->SetToolTip('Skew direction of gradient (positive value = left)');
    $self->{'subgradient_distro'}->SetToolTip('Relation between parts of subgradient size wise');
    $self->{'color_rainbow'}      = App::GUI::Juliagraph::Widget::ProgressBar->new( $self, 450, 30, [20, 20, 110]);
    $self->{'background_rainbow'} = App::GUI::Juliagraph::Widget::ProgressBar->new( $self, 450, 10, [20, 20, 110]);
    $self->{'color_rainbow'}->SetToolTip('Color gradient display.');
    $self->{'background_rainbow'}->SetToolTip('Background color display.');

    Wx::Event::EVT_CHECKBOX( $self, $self->{'custom_partition'},sub { $self->enable_partition($self->{'custom_partition'}->GetValue); $self->{'callback'}->() });
    Wx::Event::EVT_CHECKBOX( $self, $self->{'user_colors'},     sub { $self->enable_user_colors($self->{'user_colors'}->GetValue);    $self->{'callback'}->() });
    Wx::Event::EVT_CHECKBOX( $self, $self->{'use_subgradient'}, sub { $self->enable_subgradient($self->{'use_subgradient'}->GetValue);$self->{'callback'}->() });
    Wx::Event::EVT_COMBOBOX( $self, $self->{$_},                sub { $self->update_max_color; $self->{'callback'}->() })
        for qw/begin_color end_color/;
    Wx::Event::EVT_COMBOBOX( $self, $self->{$_},                sub { $self->{'callback'}->() })
        for qw/scale_distro gradient_dynamic gradient_space background_color
               subgradient_distro subgradient_dynamic subgradient_space/;
    $self->{$_}->SetCallBack( sub { $self->{'callback'}->(); }) for qw/scale_steps subgradient_size subgradient_steps/;

    my $std_margin = 20;
    my $std  = &Wx::wxALIGN_LEFT | &Wx::wxALIGN_CENTER_VERTICAL | &Wx::wxGROW;
    my $box  = $std | &Wx::wxTOP | &Wx::wxBOTTOM;
    my $item = $std | &Wx::wxLEFT;
    my $row  = $std | &Wx::wxTOP;

    my $div_sizer = Wx::BoxSizer->new(&Wx::wxHORIZONTAL);

lib/App/GUI/Juliagraph/Frame/Tab/Mapping.pm  view on Meta::CPAN

    $color_sizer->AddSpacer( 10 );
    $color_sizer->Add( $self->{'end_color'},      0, $box,  5);
    $color_sizer->AddStretchSpacer();
    $color_sizer->AddSpacer( $std_margin );

    my $map_sizer = Wx::BoxSizer->new(&Wx::wxHORIZONTAL);
    $map_sizer->AddSpacer( $std_margin );
    $map_sizer->AddSpacer( 10 );
    $map_sizer->Add( $self->{'lbl_backg'},        0, $box, 12);
    $map_sizer->AddSpacer( 10 );
    $map_sizer->Add( $self->{'background_color'}, 0, $box,  5);
    $map_sizer->AddSpacer( 23 );
    $map_sizer->Add( $map_dyn_lbl,                0, $box, 12);
    $map_sizer->AddSpacer( 10 );
    $map_sizer->Add( $self->{'gradient_dynamic'}, 0, $box,  5);
    $map_sizer->AddSpacer( 22 );
    $map_sizer->Add( $map_space_lbl,              0, $box, 12);
    $map_sizer->AddSpacer( 10 );
    $map_sizer->Add( $self->{'gradient_space'},   0, $box,  5);
    $map_sizer->AddStretchSpacer();
    $map_sizer->AddSpacer( $std_margin );

lib/App/GUI/Juliagraph/Frame/Tab/Mapping.pm  view on Meta::CPAN

    my $sizer = Wx::BoxSizer->new(&Wx::wxVERTICAL);
    $sizer->AddSpacer( 10 );
    $sizer->Add( $map_lbl,      0, $item,  $std_margin);
    $sizer->Add( $color_sizer,  0, $row,   8);
    $sizer->Add( $map_sizer,    0, $row,  10);
    $sizer->AddSpacer( 2 );
    $sizer->Add( Wx::StaticLine->new( $self, -1), 0, $box,  10 );
    $sizer->AddSpacer( 5 );
    $sizer->Add( $self->{'color_rainbow'},        0, $item | &Wx::wxRIGHT, 20 );
    $sizer->AddSpacer( 10 );
    $sizer->Add( $self->{'background_rainbow'},   0, $item | &Wx::wxRIGHT, 20 );
    $sizer->AddSpacer( 5 );
    $sizer->Add( Wx::StaticLine->new( $self, -1), 0, $box,  10 );
    $sizer->Add( $scale_lbl,    0, $item,  $std_margin);
    $sizer->Add( $div_sizer,    0, $row,   8);
    $sizer->Add( $div2_sizer,   0, $row,  10);
    $sizer->Add( Wx::StaticLine->new( $self, -1), 0, $box,  10 );
    $sizer->Add( $submap_lbl,   0, $item, $std_margin);
    $sizer->Add( $sub_sizer,    0, $row,   8);
    $sizer->Add( $sub2_sizer,   0, $row,  10);
    $sizer->Add( $sub3_sizer,   0, $row,  10);

lib/App/GUI/Juliagraph/Frame/Tab/Mapping.pm  view on Meta::CPAN


sub init         { $_[0]->set_settings ( $default_settings ) }
sub set_settings {
    my ( $self, $settings ) = @_;
    return 0 unless ref $settings eq 'HASH' and exists $settings->{'user_colors'};
    $self->PauseCallBack();
    for my $key (qw/custom_partition scale_steps user_colors use_subgradient subgradient_size subgradient_steps/){
        next unless exists $settings->{$key} and exists $settings->{$key};
        $self->{$key}->SetValue( $settings->{$key} );
    }
    for my $key (qw/scale_distro background_color begin_color end_color gradient_dynamic
                gradient_space subgradient_dynamic subgradient_space subgradient_distro/){
        next unless exists $settings->{$key} and exists $self->{$key};
        $self->{$key}->SetSelection( $self->{$key}->FindString($settings->{$key}) );
    }
    $self->enable_partition( $settings->{'custom_partition'} );
    $self->enable_user_colors( $settings->{'user_colors'} );
    $self->enable_subgradient( $settings->{'use_subgradient'} );
    $self->update_max_color( );
    $self->RestoreCallBack();
    1;
}

sub get_settings {
    my ( $self ) = @_;
    return {
        custom_partition  => int $self->{'custom_partition'}->GetValue,
        user_colors       => int $self->{'user_colors'}->GetValue,
        use_subgradient   => int $self->{'use_subgradient'}->GetValue,
        scale_steps       => $self->{'scale_steps'}->GetValue,
        scale_distro      => $self->{'scale_distro'}->GetStringSelection,
        background_color  => $self->{'background_color'}->GetStringSelection,
        begin_color       => $self->{'begin_color'}->GetStringSelection,
        end_color         => $self->{'end_color'}->GetStringSelection,
        gradient_dynamic  => $self->{'gradient_dynamic'}->GetStringSelection,
        gradient_space    => $self->{'gradient_space'}->GetStringSelection,
        subgradient_size  => $self->{'subgradient_size'}->GetValue,
        subgradient_steps => $self->{'subgradient_steps'}->GetValue,
        subgradient_dynamic=>$self->{'subgradient_dynamic'}->GetStringSelection,
        subgradient_space => $self->{'subgradient_space'}->GetStringSelection,
        subgradient_distro => $self->{'subgradient_distro'}->GetStringSelection,
    };

lib/App/GUI/Juliagraph/Frame/Tab/Mapping.pm  view on Meta::CPAN

    $self->{'custom_partition'}->SetValue( $on ) unless int($on) == int $self->{'custom_partition'}->GetValue;
    $self->{$_}->Enable( $on ) for qw/scale_steps scale_distro scale_max lbl_max lbl_distro/;
    $self->enable_subgradient(0) if $on;
    $self->{'use_subgradient'}->Enable( not $on );
    $self->{'lbl_sub_use'}->Enable( not $on );
}
sub enable_user_colors {
    my ( $self, $on ) = @_;
    $on //= $self->{'user_colors'}->GetValue;
    $self->{'user_colors'}->SetValue( $on ) unless int($on) ==  int $self->{'user_colors'}->GetValue;
    $self->{ $_ }->Enable( $on ) for qw/background_color begin_color end_color lbl_begin lbl_end lbl_backg/;
}
sub enable_subgradient {
    my ( $self, $on ) = @_;
    $on //= $self->{'use_subgradient'}->GetValue;
    $self->{'use_subgradient'}->SetValue($on) unless int($on) == int $self->{'use_subgradient'}->GetValue;
    $self->{$_}->Enable( $on ) for qw/subgradient_steps subgradient_dynamic subgradient_space subgradient_distro
                                    lbl_sub_dyn lbl_sub_space lbl_sub_distro subgradient_size/;
}

sub update_max_color {



( run in 0.736 second using v1.01-cache-2.11-cpan-f56aa216473 )