【Gimp】四角形の描き方がわかりにくい

Gimp で、色付きの四角形の描き方がわかりませんでした。

UIを使ったやり方は、↓こちら。

naokixtechnology.net

これをPythonで書くと以下の通り、

関数は以下のサイトを参照。

python_fu_sample.py · GitHub

例:白色の四角

def set_color_background(r, g, b, a):
color = (r, g, b, a)
pdb.gimp_palette_set_background(color)
def set_color_foreground(r, g, b, a):
color = (r, g, b, a)
pdb.gimp_context_set_foreground(color)
def draw_pencil_lines(drawable, lines):
pdb.gimp_pencil(drawable, len(lines), lines)
def draw_rect(drawable, x1, y1, x2, y2):
lines = [x1, y1, x2, y1, x2, y2, x1, y2, x1, y1]
draw_pencil_lines(drawable, lines)
set_color_foreground(255,255,255,1.0)
set_color_background(255,255,255,1.0)
image = create_image(500, 500)
layer = add_layer(image, "背景")
draw_rect(layer, 0, 0, layer.width, layer.height)

描画色、背景色を設定してから色を付けるしかないのかな。

www.dev-dev.net

知識ゼロからはじめる GIMPの教科書 2.10対応

知識ゼロからはじめる GIMPの教科書 2.10対応

  • 作者: ソシムデザイン編集部
  • 出版社/メーカー: ソシム
  • 発売日: 2019/09/04
  • メディア: 単行本

返信を残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA