about summary refs log tree commit diff stats
path: root/doc
Commit message (Expand)AuthorAgeFilesLines
...
* pick.sh: added variables for easier customizationhut2010-02-041-7/+8
* added doc/pick.shhut2010-02-041-0/+24
* updated dochut2010-01-211-4/+20
* 1.0.2! v1.0.2hut2010-01-1430-84/+116
* updated pydoc documentationhut2010-01-1361-846/+795
* todo: added more info on bug #31hut2010-01-091-0/+5
* random cleanups and fixeshut2010-01-071-5/+6
* new minor version v1.0.1hut2010-01-022-4/+4
* updated pydoc documentationhut2010-01-0248-788/+3167
* notify: merged into statusbar, allow to view the log in the pagerhut2010-01-013-35/+2
* cleanupshut2009-12-311-1/+5
* rename filelist(container) to browsercolumn/browserviewhut2009-12-313-38/+76
* updated uml projecthut2009-12-305-73/+215
* shorten comment in ranger.pyhut2009-12-261-0/+4
* moved /uml to /doc/umlhut2009-12-2514-0/+2180
* Explained cd-after-exit featurehut2009-12-251-0/+132
* moved pydoc pages to doc/pydochut2009-12-2565-0/+0
* updated pydoc pageshut2009-12-2565-0/+10505
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
# This module has been adapted from Fornax::GenerateFrame.

use Cairo;
use Octans::Hex2RGB;

# Colors.
constant %C = (
    bg-main => "#ffffff",

    red-subtle-bg => "#f2b0a2",
    blue-subtle-bg => "#b5d0ff",
    cyan-subtle-bg => "#c0efff",
    green-subtle-bg => "#aecf90",

    fg-main => "#000000",

    fg-special-cold => "#093060",
    fg-special-warm => "#5d3026",
    fg-special-mild => "#184034",
    fg-special-calm => "#61284f",
).map: {.key => hex2rgb(.value)};

enum IterStatus <Walking Blocked Completed>;

sub generate-frame(
    :%canvas, :$out, :$side, :@puzzle, :@visited, :%meta, :$found
) is export {
    given Cairo::Image.create(
        Cairo::FORMAT_ARGB32, %canvas<width>, %canvas<height>
    ) {
        given Cairo::Context.new($_) {
            # Paint the entire canvas white.
            .rgb: |%C<bg-main>;
            .rectangle(0, 0, %canvas<width>, %canvas<height>);
            .fill;

            # This seems to be slower than creating an intermediate
            # variable and assigning from that. Difference is not much
            # so we'll ignore it.
            for ^%meta<rows> X ^%meta<cols>  -> ($r, $c) {
                my Int @target = $c * $side, $r * $side,
                                 $side, $side;
                .rectangle: |@target;

                if @visited[$r][$c] {
                    .rgba: |%C<cyan-subtle-bg>, 0.72;
                    .rgba: |%C<green-subtle-bg>, 0.84 if $found;
                    .fill :preserve;
                }

                .select_font_face("Mono", Cairo::FONT_SLANT_NORMAL, Cairo::FONT_WEIGHT_NORMAL);
                .set_font_size(72.0);
                .move_to($c * $side + 32, ($r + 1) * $side - 28);

                .rgb: |%C<fg-main>;
                .show_text: @puzzle[$r][$c].uc;
                .stroke;
            }
        }
        .write_png($out);
        .finish;
    }
}