# (fr) Canaux > Rendre monochrome
# (es) Canales > Hacer monocromático
# (de) Kanäle > Monochromatisch machen
from lazpaint import image, dialog, layer, filters

translation = dialog.select_translation(
    en={
        "Remove this layer to remove hue": "Remove this layer to remove hue",
        "This is not a chromatic channel": "This is not a chromatic channel"
    },
    fr={
        "Remove this layer to remove hue":
        "Supprimer ce calque pour enlever la teinte",
        "This is not a chromatic channel": "Ce n'est pas un canal chromatique"
    },
    es={
        "Remove this layer to remove hue":
        "Elimina esta capa para eliminar el tono",
        "This is not a chromatic channel": "Este no es un canal cromático"
    },
    de={
        "Remove this layer to remove hue":
        "Diese Ebene entfernen, um den Farbton zu entfernen",
        "This is not a chromatic channel": "Dies ist kein chromatischer Kanal"
    },
)

channel = layer.get_registry("split-channel")
if channel == "R" or channel == "C":
    source = "red"
elif channel == "G" or channel == "M":
translation = dialog.select_translation(en={
    "Layer already split": "Layer already split",
    "Cyan": "Cyan",
    "Magenta": "Magenta",
    "Yellow": "Yellow",
    "Black": "Black",
    "Alpha": "Alpha"
},
                                        fr={
                                            "Layer already split":
                                            "Le calque est déjà séparé",
                                            "Cyan": "Cyan",
                                            "Magenta": "Magenta",
                                            "Yellow": "Jaune",
                                            "Black": "Noir",
                                            "Alpha": "Alpha"
                                        },
                                        es={
                                            "Layer already split":
                                            "La capa ya está dividida",
                                            "Cyan": "Cian",
                                            "Magenta": "Magenta",
                                            "Yellow": "Amarillo",
                                            "Black": "Negro",
                                            "Alpha": "Alpha"
                                        },
                                        de={
                                            "Layer already split":
                                            "Die Ebene ist bereits geteilt",
                                            "Cyan": "Cyan",
                                            "Magenta": "Magenta",
                                            "Yellow": "Gelb",
                                            "Black": "Schwartz",
                                            "Alpha": "Alpha"
                                        })
# Mask > Mask from alpha channel
# (fr) Masque > Masque depuis canal alpha
# (es) Máscara > Máscara desde canal alpha
# (de) Maske > Maske vom Alphakanal
from lazpaint import image, layer, filters, selection, dialog

translation = dialog.select_translation(en={"Mask": "Mask"},
                                        fr={"Mask": "Masque"},
                                        es={"Mask": "Máscara"},
                                        de={"Mask": "Maske"})

image.do_begin()

selection.deselect()
layer.duplicate()
layer.set_name(translation["Mask"])
filters.filter_function(red="alpha",
                        green="alpha",
                        blue="alpha",
                        alpha=255,
                        gamma_correction=False)
layer.set_blend_op(layer.BLEND_MASK)

image.do_end()
# Channels > Split RGB
# (fr) Canaux > Séparer RVB
# (es) Canales > Dividir RGB
# (de) Kanäle > RVB teilen
from lazpaint import image, dialog, layer, filters

translation = dialog.select_translation(
  en = {"Layer already split": "Layer already split", "Alpha": "Alpha", "Red": "Red", "Green": "Green", "Blue": "Blue"}, 
  fr = {"Layer already split": "Le calque est déjà séparé", "Alpha": "Alpha", "Red": "Rouge", "Green": "Vert", "Blue": "Bleu"}, 
  es = {"Layer already split": "La capa ya está dividida", "Alpha": "Alpha", "Red": "Rojo", "Green": "Verde", "Blue": "Azul"}, 
  de = {"Layer already split": "Die Ebene ist bereits geteilt", "Alpha": "Alpha", "Red": "Rot", "Green": "Grün", "Blue": "Blau"}
  )
  
# check if it is a channel
if layer.get_registry("split-channel") is not None:
  dialog.show_message(translation["Layer already split"])
  exit()

layer_id = layer.get_id()
layer_index = image.get_layer_index()
layer_opacity = layer.get_opacity()
layer_transparent = layer.is_transparent()

# check if it has been split
if layer.get_registry("split-channels-id") is not None:
  for cur_layer_id in image.iterate_layers():
    if layer.get_registry("split-source-id") == layer_id:
      dialog.show_message(translation["Layer already split"])
      exit()

image.do_begin()
예제 #5
0
# Render > Fractal tree
# (fr) Rendu > Arbre fractal
# (es) Renderizar > Árbol fractal
# (de) Rendering > Fraktaler Baum
from lazpaint import tools, image, layer, dialog
import math, random

translation = dialog.select_translation(
  en = {"Invalid angle": "Invalid angle", "Vertical size": "Vertical size"}, 
  fr = {"Invalid angle": "Angle invalide", "Vertical size": "Taille verticale"}, 
  es = {"Invalid angle": "Ángulo invalido", "Vertical size": "Tamaño vertical"}, 
  de = {"Invalid angle": "Ungültiger Winkel", "Vertical size": "Vertikal Größe"}, 
  )
  
line_buf = []

def line(x, y, x2, y2):
  global line_buf
  if len(line_buf) > 0 and line_buf[-1] == (x, y):
    line_buf.append( (x2, y2) )
  else:
    flush_line()
    line_buf = [(x, y), (x2, y2)]

def flush_line():
  global line_buf
  if len(line_buf) > 0:
    tools.choose(tools.PEN)
    tools.mouse(line_buf)
  line_buf = []
예제 #6
0
# Channels > Split HSL
# (fr) Canaux > Séparer TSL
# (es) Canales > Dividir HSL
# (de) Kanäle > HSL teilen
from lazpaint import image, dialog, layer, filters

translation = dialog.select_translation(
  en = {"Layer already split": "Layer already split", "Hue": "Hue", "Saturation": "Saturation", "Lightness": "Lightness", "Alpha": "Alpha"}, 
  fr = {"Layer already split": "Le calque est déjà séparé", "Hue": "Teinte", "Saturation": "Saturation", "Lightness": "Luminosité", "Alpha": "Alpha"}, 
  es = {"Layer already split": "La capa ya está dividida", "Hue": "Matiz", "Saturation": "Saturación", "Lightness": "Luminosidad", "Alpha": "Alpha"}, 
  de = {"Layer already split": "Die Ebene ist bereits geteilt", "Hue": "Farbwinkel", "Saturation": "Farbsättigung", "Lightness": "Farbhelligkeit", "Alpha": "Alpha"}
  )
  
# check if it is a channel
if layer.get_registry("split-channel") is not None:
  dialog.show_message(translation["Layer already split"])
  exit()

layer_id = layer.get_id()
layer_index = image.get_layer_index()
layer_opacity = layer.get_opacity()
layer_transparent = layer.is_transparent()

# check if it has been split
if layer.get_registry("split-channels-id") is not None:
  for cur_layer_id in image.iterate_layers():
    if layer.get_registry("split-source-id") == layer_id:
      dialog.show_message(translation["Layer already split"])
      exit()

image.do_begin()
예제 #7
0
# Channels > Merge
# (fr) Canaux > Fusionner
# (es) Canales > Fusionar
# (de) Kanäle > Zusammenführen
from lazpaint import image, dialog, layer

translation = dialog.select_translation(
    en={"Current layer is not split": "Current layer is not split"},
    fr={"Current layer is not split": "Le calque actuel n'est pas séparé"},
    es={"Current layer is not split": "La capa actual no está dividida"},
    de={"Current layer is not split": "Die aktuelle Ebene wird nicht geteilt"},
)

channels_id = None
new_layer_index = None
image.do_begin()

if layer.get_registry("split-channel") is not None:
    layer_id = layer.get_registry("split-source-id")
    if image.contains_layer_id(layer_id):
        layer.select_id(layer_id)
        channels_id = layer.get_registry("split-channels-id")
        new_layer_index = image.get_layer_index() + 1
    else:
        channels_id = []
        for cur_layer_id in image.iterate_layers():
            cur_source_id = layer.get_registry("split-source-id")
            if cur_source_id == layer_id:
                channels_id.insert(0, cur_layer_id)
                if new_layer_index is None:
                    new_layer_index = image.get_layer_index()