<commit_before>"""Display a rotomap."""

import enum
import functools

import cv2
import numpy

import mel.lib.common
import mel.lib.image
import mel.lib.ui
import mel.rotomap.detectmoles
import mel.rotomap.mask
import mel.rotomap.moles
import mel.rotomap.relate
import mel.rotomap.tricolour


DEFAULT_MASKER_RADIUS = 200


def draw_mole(image, x, y, colours):

    def circle(radius, col):
        cv2.circle(image, (x, y), radius, col, -1)

    white = (255, 255, 255)
    black = (0, 0, 0)

    circle(20, white)
    circle(18, black)

    radius = 16
    for index in range(3):
        circle(radius, colours[index])
        radius -= 4


def draw_non_canonical_mole(image, x, y, colours):
    radius = 16
    thickness = 4
    for index in range(3):
        top_left = (x - radius, y - radius)
        bottom_right = (x + radius, y + radius)
        cv2.rectangle(image, top_left, bottom_right, colours[index], thickness)
        radius -= thickness


def draw_crosshair(image, x, y):
    inner_radius = 16
    outer_radius = 24
    white = (255, 255, 255)
    black = (0, 0, 0)

    directions = [(1, 0), (0, -1), (-1, 0), (0, 1)]  # Right, down, left, up

    size_color_list = [(3, white), (2, black)]

    for size, color in size_color_list:
        for d in directions:
            cv2.line(
                image,
                (x + (inner_radius * d[0]), y + (inner_radius * d[1])),
                (x + (outer_radius * d[0]), y + (outer_radius * d[1])),
                color,
                size,
            )


class Display:
    def __init__(self, width, height):
        self._name = str(id(self))

        if width is None or height is None:
            full_width_height = mel.lib.ui.guess_fullscreen_width_height()
            if width is None:
                width = full_width_height[0]
            if height is None:
                height = full_width_height[1]

        self._rect = numpy.array((width, height))

        cv2.namedWindow(self._name)
        cv2.namedWindow(self._name, cv2.WINDOW_NORMAL)<commit_msg>rotomap edit: more useful 'unconfirmed' rendering<commit_after>"""Display a rotomap."""

import enum
import functools

import cv2
import numpy

import mel.lib.common
import mel.lib.image
import mel.lib.ui
import mel.rotomap.detectmoles
import mel.rotomap.mask
import mel.rotomap.moles
import mel.rotomap.relate
import mel.rotomap.tricolour


DEFAULT_MASKER_RADIUS = 200

_WHITE = (255, 255, 255)
_BLACK = (0, 0, 0)


def draw_mole(image, x, y, colours):

    def circle(radius, col):
        cv2.circle(image, (x, y), radius, col, -1)

    circle(20, _WHITE)
    circle(18, _BLACK)

    radius = 16
    for index in range(3):
        circle(radius, colours[index])
        radius -= 4


def draw_non_canonical_mole(image, x, y, colours):

    def rect(size, col):
        top_left = (x - size, y - size)
        bottom_right = (x + size, y + size)
        cv2.rectangle(image, top_left, bottom_right, col, -1)

    rect(20, _WHITE)
    rect(18, _BLACK)

    draw_mole(image, x, y, colours)


def draw_crosshair(image, x, y):
    inner_radius = 16
    outer_radius = 24

    directions = [(1, 0), (0, -1), (-1, 0), (0, 1)]  # Right, down, left, up

    size_color_list = [(3, _WHITE), (2, _BLACK)]

    for size, color in size_color_list:
        for d in directions:
            cv2.line(
                image,
                (x + (inner_radius * d[0]), y + (inner_radius * d[1])),
                (x + (outer_radius * d[0]), y + (outer_radius * d[1])),
                color,
                size,
            )


class Display:
    def __init__(self, width, height):
        self._name = str(id(self))

        if width is None or height is None:
            full_width_height = mel.lib.ui.guess_fullscreen_width_height()
            if width is None:
                width = full_width_height[0]
            if height is None:
                height = full_width_height[1]

        self._rect = numpy.array((width, height))

        cv2.namedWindow(self._name)
        cv2.namedWindow(self._name, cv2.WINDOW_NORMAL)
{'fraction_non_alphanumeric': 0.12103321033210332, 'fraction_numerical': 0.03025830258302583, 'mean_word_length': 2.265863453815261, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1741896', 'n_tokens_mistral': 1488, 'n_tokens_neox': 1369, 'n_words': 377}