It is currently Fri Jul 05, 2024 4:48 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: GTK help needed text in black needed
PostPosted: Fri Nov 01, 2019 6:51 am  (#1) 
Offline
GimpChat Member

Joined: Sep 13, 2016
Posts: 137
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


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: GTK help needed text in black needed
PostPosted: Fri Nov 01, 2019 3:35 pm  (#2) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4756
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.

_________________
Image


Top
 Post subject: Re: GTK help needed text in black needed
PostPosted: Sat Nov 02, 2019 1:12 am  (#3) 
Offline
GimpChat Member

Joined: Sep 13, 2016
Posts: 137
What an easy solution.
Was not aware that the forgroundcolor is used ..
Thanks Ofnuts ;-)


Top
 Post subject: Re: GTK help needed text in black needed
PostPosted: Sat Nov 02, 2019 3:59 am  (#4) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4756
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.

_________________
Image


Top
 Post subject: Re: GTK help needed text in black needed
PostPosted: Sat Nov 02, 2019 6:14 am  (#5) 
Offline
GimpChat Member

Joined: Sep 13, 2016
Posts: 137
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 5715 times ]
Top
 Post subject: Re: GTK help needed text in black needed
PostPosted: Sat Nov 02, 2019 10:29 am  (#6) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4756
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/

_________________
Image


Top
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) TESTER NEEDED - Test "mixed" GEGL plugins on Gimp 2.99.18 Windows 10

5

No new posts Attachment(s) Black board and text effect updated to v4

20

No new posts Attachment(s) Use of Fuzzy Select tool to remove white background from black text

2

No new posts Getting Black from Hue/Saturation

1

No new posts Attachment(s) OOB real black

7



* Login  



Powered by phpBB3 © phpBB Group