GIMP Chat
http://gimpchat.com/

GTK help needed text in black needed
http://gimpchat.com/viewtopic.php?f=8&t=17768
Page 1 of 1

Author:  PKHG [ Fri Nov 01, 2019 6:51 am ]
Post subject:  GTK help needed text in black needed

GIMP Version:
Operating System: Mac OS
GIMP Experience: Experienced User



In my checker (plugin to be found here) I use
drawable = pdb.gimp_layer_new(image, 10, 10, 1, "dambackground", 100, NORMAL_MODE)
pdb.gimp_image_add_layer(image, drawable, 0)
theText = text_layer = pdb.gimp_text_fontname(image, drawable, 0, 0, 'Dam', 0, True, 32, 0, 'Segoe print')

to change a stone to a "DAM" stone (promoted stone on the base-line)
That works nice on black stones:... a white name on the stone: Dam
BUT on a white stone DAM is written too in white and not really visible.

Would someone be so kind and knows how to make the written DAM in black and tells it to me?

Files to run see: https://github.com/PKHG/guidelab_paint

Author:  ofnuts [ Fri Nov 01, 2019 3:35 pm ]
Post subject:  Re: GTK help needed text in black needed

Set the foreground to whatever is needed by

import gimpcolor
pdb.gimp_context_set_foreground(gimpcolor.RGB(0,0,0))

RGB values are either 0..255 (type "int") or (0. .. 1.) (type float).

It is good form to start your script with pdb.gimp_context_push() and use pdb.gimp_context_pop() just before exiting (after catching all exceptions), so that the user's settings aren't polluted with the settings needed in your script.

Author:  PKHG [ Sat Nov 02, 2019 1:12 am ]
Post subject:  Re: GTK help needed text in black needed

What an easy solution.
Was not aware that the forgroundcolor is used ..
Thanks Ofnuts ;-)

Author:  ofnuts [ Sat Nov 02, 2019 3:59 am ]
Post subject:  Re: GTK help needed text in black needed

PKHG wrote:
What an easy solution.
Was not aware that the forgroundcolor is used ..
Thanks Ofnuts ;-)


The color has to come from somewhere... Have a look at all the *-context-* functions, that where you set all parameters used to render things.

Author:  PKHG [ Sat Nov 02, 2019 6:14 am ]
Post subject:  Re: GTK help needed text in black needed

Just discovered something, which looks like an error:
pdb.gimp_vectors_bezier_stroke_new_ellipse(new_vectors ,W/2 ,W/2,W/2 ,W/2, 0)
Does not create a real Circle. The Circle from the toolbox CAN do it

Picture above Circle from the Gimp_window tools
picture below result of the pub....ellipse ;-(

Can the toolbox ellipse be run from a python-plugin?
If so, please tell me ;-)

Solved: gimp-image-select-ellipse works perfectly

Attachments:
Screen Shot 2019-11-02 at 12.06.44.png
Screen Shot 2019-11-02 at 12.06.44.png [ 30.22 KiB | Viewed 5720 times ]

Author:  ofnuts [ Sat Nov 02, 2019 10:29 am ]
Post subject:  Re: GTK help needed text in black needed

PKHG wrote:
Just discovered something, which looks like an error:
pdb.gimp_vectors_bezier_stroke_new_ellipse(new_vectors ,W/2 ,W/2,W/2 ,W/2, 0)
Does not create a real Circle. The Circle from the toolbox CAN do it

Picture above Circle from the Gimp_window tools
picture below result of the pub....ellipse ;-(

Can the toolbox ellipse be run from a python-plugin?
If so, please tell me ;-)

Solved: gimp-image-select-ellipse works perfectly


I create the ellipse myself, all you have to know is the "kappa" magic number:

kappa=4*(math.sqrt(2)-1)/3


Then to create a quarter of circle of radius R, you create tangents of length R*Kappa. For a full circles, 4 anchors and 8 tangents. For an ellipse, use half-axes instead of R.

See http://spencermortensen.com/articles/bezier-circle/

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/