Exemple #1
0
def activate(app):
    white = Grx.color_get_white()
    x = Grx.get_width() // 10
    y = Grx.get_height() // 10

    line_opts = Grx.LineOptions()
    line_opts.color = white
    line_opts.width = 3
    line_opts.n_dash_patterns = 2
    line_opts.dash_pattern0 = 6
    line_opts.dash_pattern1 = 4
    line_opts0 = Grx.LineOptions()
    pat = demo.get_checkerboard_pixmap()
    Grx.draw_box(x * 1, y * 1, x * 3, y * 3, white)
    Grx.draw_box_with_options(x * 4, y * 1, x * 6, y * 3, line_opts)
    Grx.draw_box_with_pixmap(x * 7, y * 1, x * 9, y * 3, line_opts0, pat)

    img = demo.get_smiley_pixmap(x * 2, y * 2)
    Grx.draw_filled_box(x * 1, y * 4, x * 3, y * 6, white)
    Grx.draw_filled_box_with_pixmap(x * 4, y * 4, x * 6, y * 6, img)
    Grx.draw_filled_box_with_offset_pixmap(x * 2, y, x * 7, y * 4, x * 9,
                                           y * 6, img)

    frame_colors = Grx.FramedBoxColors()
    frame_colors.background = Grx.color_get(224, 223, 228)
    frame_colors.border_top = Grx.color_get(255, 255, 255)
    frame_colors.border_right = Grx.color_get(155, 157, 154)
    frame_colors.border_bottom = Grx.color_get(110, 110, 100)
    frame_colors.border_left = Grx.color_get(241, 239, 226)
    Grx.draw_framed_box(x * 1, y * 7, x * 3, y * 9, y / 4, frame_colors)
    Grx.draw_rounded_box(x * 4, y * 7, x * 6, y * 9, y / 4, white)
    Grx.draw_filled_rounded_box(x * 7, y * 7, x * 9, y * 9, y / 4, white)
Exemple #2
0
def activate(app):
    white = Grx.color_get_white()
    x = Grx.get_width() // 10
    y = Grx.get_height() // 10

    line_opts = Grx.LineOptions()
    line_opts.color = white
    line_opts.width = 3
    line_opts.n_dash_patterns = 2
    line_opts.dash_pattern0 = 6
    line_opts.dash_pattern1 = 4
    line_opts0 = Grx.LineOptions()
    pat = demo.get_checkerboard_pixmap()
    Grx.draw_box(x * 1, y * 1, x * 3, y * 3, white)
    Grx.draw_box_with_options(x * 4, y * 1, x * 6, y * 3, line_opts)
    Grx.draw_box_with_pixmap(x * 7, y * 1, x * 9, y * 3, line_opts0, pat)

    img = demo.get_smiley_pixmap(x * 2, y * 2)
    Grx.draw_filled_box(x * 1, y * 4, x * 3, y * 6, white)
    Grx.draw_filled_box_with_pixmap(x * 4, y * 4, x * 6, y * 6, img)
    Grx.draw_filled_box_with_offset_pixmap(x * 2, y, x * 7, y * 4, x * 9,
                                           y * 6, img)

    frame_colors = Grx.FramedBoxColors()
    frame_colors.background = Grx.color_get(224, 223, 228)
    frame_colors.border_top = Grx.color_get(255, 255, 255)
    frame_colors.border_right = Grx.color_get(155, 157, 154)
    frame_colors.border_bottom = Grx.color_get(110, 110, 100)
    frame_colors.border_left = Grx.color_get(241, 239, 226)
    Grx.draw_framed_box(x * 1, y * 7, x * 3, y * 9, y / 4, frame_colors)
    Grx.draw_rounded_box(x * 4, y * 7, x * 6, y * 9, y / 4, white)
    Grx.draw_filled_rounded_box(x * 7, y * 7, x * 9, y * 9, y / 4, white)
Exemple #3
0
def get_checkerboard_pixmap():
    """Gets a blue/red checkerboard pattern"""
    global _demo_pattern_context
    if not _demo_pattern_context:
        _demo_pattern_context = Grx.Context.new(32, 32)
        save = Grx.save_current_context()
        Grx.set_current_context(_demo_pattern_context)
        Grx.clear_context(Grx.color_get(0, 0, 255))
        Grx.draw_filled_box(0, 0, 16, 16, Grx.color_get(255, 0, 0))
        Grx.draw_filled_box(17, 17, 32, 32, Grx.color_get(255, 0, 0))
        Grx.set_current_context(save)

    return Grx.Pixmap.new_from_context(_demo_pattern_context)
Exemple #4
0
    def do_activate(self):
        """called when the application starts
        overrides Grx.Application.do_activate
        """
        Grx.clear_screen(self.bg_color)

        count = len(self.colors)
        remaining = Grx.get_width()
        x0, y0 = 0, 0
        y1 = self.color_picker_y
        for c in self.colors:
            x1 = x0 + remaining // count
            Grx.draw_filled_box(x0, y0, x1, y1, self.colors[c])
            Grx.draw_box(x0, y0, x1, y1, self.fg_color)
            count -= 1
            remaining -= x1 - x0
            x0 = x1
            self.color_lookup.append(c)
        Grx.set_clip_box(0, y1 + 1, Grx.get_max_x(), Grx.get_max_y())
Exemple #5
0
    def do_activate(self):
        """called when the application starts
        overrides Grx.Application.do_activate
        """
        Grx.clear_screen(self.bg_color)

        count = len(self.colors)
        remaining = Grx.get_width()
        x0, y0 = 0, 0
        y1 = self.color_picker_y
        for c in self.colors:
            x1 = x0 + remaining // count
            Grx.draw_filled_box(x0, y0, x1, y1, self.colors[c])
            Grx.draw_box(x0, y0, x1, y1, self.fg_color)
            count -= 1
            remaining -= x1 - x0
            x0 = x1
            self.color_lookup.append(c)
        Grx.set_clip_box(0, y1 + 1, Grx.get_max_x(), Grx.get_max_y())