Data pubblicazione: 24-mag-2008 22.39.21
Much more easy to implement than PHOTO Shop.
Here just a sample. Production of this sample is really much more rapid than in photoshop.
Things needing to be done:
- make it alpha (white on trasparent) so that it can be effectively used with xytext
- be sure it has the same pixelling than the previous version made with photoshop so that we can use it interchangeably
We will generate the following image jpg:
Here it is:
(define (script-fu-text-box inText inFont inFontSize inTextColor)
(let*
(
; define our local variables
; create a new image:
(theImageWidth 512)
(theImageHeight 512)
(theImage (car
(gimp-image-new
theImageWidth
theImageHeight
RGB
)
)
)
(r 0)
(c 0)
(p 32)
(theText) ;a declaration for the text
;we create later
;create a new layer for the image:
(theLayer
(car
(gimp-layer-new
theImage
theImageWidth
theImageHeight
RGB-IMAGE
"layer 1"
100
NORMAL
)
)
)
) ;end of our local variables
(gimp-image-add-layer theImage theLayer 0)
;(gimp-context-set-background '(255 255 255) )
(gimp-context-set-foreground inTextColor)
(gimp-drawable-fill theLayer TRANSPARENT-FILL ()
(while (< c 10)
(while (< r 10)
(set! theText
(car
(gimp-text-fontname
theImage theLayer
(+ (* r 50) 10) (* c 50)
(string (integer->char p))
0
TRUE
48 PIXELS
inFont)
)
)
(set! p (+ p 1))
(set! r (+ r 1))
)
(set! r 0)
(set! c (+ c 1))
)
(set! theImageWidth (car (gimp-drawable-width theText) ) )
(set! theImageHeight (car (gimp-drawable-height theText) ) )
;(gimp-image-resize theImage theImageWidth theImageHeight 0 0)
;(gimp-layer-resize theLayer theImageWidth theImageHeight 0 0)
(gimp-display-new theImage)
))
(script-fu-register
"script-fu-text-box" ;func name
"Text Box" ;menu label
"Creates a simple text box, sized to fit\
around the user's choice of text,\
font, font size, and color." ;description
"Michael Terry" ;author
"copyright 1997, Michael Terry" ;copyright notice
"October 27, 1997" ;date created
"" ;image type that the script works on
SF-STRING "Text:" "Text Box" ;a string variable
SF-FONT "Font:" "Charter" ;a font variable
SF-ADJUSTMENT "Font size" '(50 1 1000 1 10 0 1)
;a spin-button
SF-COLOR "Color:" '(0 0 0) ;color variable
)
(script-fu-menu-register "script-fu-text-box" "<Toolbox>/Xtns/Script-Fu/Text")
And here the resulting image: