This is a blog about Rebol, it's a fantastic free programming language, it permits easily to create complete software with few lines of code. It's cross-platform, so if you write it on Windows, it will work on Linux and Mac, and vice-versa. You can produce also wonderful GUI with just 3 lines of code!
Friday, 4 January 2013
CD label crator
The following script is just an example of crating a CD Label, it's an idea and you may improve it:
Title: "Make And Print A CD Label"
Author: R. v.d.Zee
Owner: "R. v.d.Zee"
Rights: "Copyright (C) R. v.d.Zee 2008"
This script illustrates how CD labels may be drawn and printed with REBOL and
illustrates how REBOL output may be printed when incorporated into an HTML page.
Vectorial text of the Draw dialect is used for the CD label title.
The vector points to bend the text around the label are determined with
the Pythagorean Theorem.
The drawn layout of the label is presented in the GUI. The layout may be saved
as a PNG image. The script can incorporate this image into an HTML page.
So the script calls the PC's browser, which loads the HTML page. The
Finally, %label-and-print.r deletes the HTML page with the "Quit" button.
Other scripts that may be of interest:
- %pdf-labels.r, a script by Gregg Irwin for making 3x10 labels from an 8.5x11 PDF document.
- %bestfit.r, a script by Mauro Fontana to list the files that best fill up the available disc space.
This script is provided "as is", without warranty of any kind, express or implied,
including but not limited to the warranties of merchantability, fitness for a particular
purpose and non infringement. In no event shall the author or copyright holder(s) be liable
for any claim, damages or other liability, whether in an action of contract, tort or otherwise,
arising from, out of or in connection with the software or the use or other dealings in
] eitherexists?%all-cds.txt [ all-cds:load%all-cds.txt last-number:first all-cds
][ all-cds:makeblock!50 last-number:0
] start-sketch: [
] label-maker:func [title-string][ radius:228-32 center:300x300 x:80 circumference:2* pi * radius intervals:round circumference /32 points:makeblock! intervals loop intervals [ radius-squared: radius * radius side: center/x - x side-squared: side * side y: center/y -roundsquare-rootabsolute radius-squared - side-squared if y >300 [y:300] append points as-pair x y x: x +10
] dorejoin ["points/" (length? points) "/x: points/" (length? points) "/x - 3"] dorejoin ["points/" (length? points) "/y: points/" (length? points) "/y + 3"] characters: (length? title-string) if characters >28 [title-string:copy/part title-string 28characters:28] loops: (18-round (.5* characters)) loop loops [insert title-string " "] bold32:make face/font [style:'boldsize:32name: font-fixed] label-sketch:copy start-sketch ;copy start-sketch for a new sketch to prevent overwriting the title
append label-sketch rejoin [points title-string] append label-sketch [line-width 2 circle center 223] append label-sketch [line-width 1 circle center 38]
] file-saved?: false label:layout [
origin 0x0 title-box: box 600x600 white effect [draw label-sketch]
origin 250x140sequence-info: info 100x40 font-size 25 center middle font-size 15 with [edge: none]
] controls:layout [
backdrop effect [
gradient 0x1255.255.255190.190.190draw [
fill-pen linear 47x91301461864222.214.171.124126.96.36.199255.0.0.2070.48.0.1650.48.0.176188.8.131.52 184.108.40.2060.0.255.146220.127.116.1118.104.22.16822.214.171.124126.96.36.199188.8.131.52184.108.40.206 255.0.0.201245.222.129.152 box 0x0600x650
fill-pen conic 911x932018623537245.222.129.136255.228.196.1320.255.255.136220.127.116.11 box 0x0600x650
fill-pen cubic -116x-136026730249255.255.0.195255.0.0.1870.0.0.19818.104.22.1680.128.128.20322.214.171.124 126.96.36.199255.255.240.176188.8.131.52184.108.40.206220.127.116.110.0.255.15618.104.22.16822.214.171.124 126.96.36.1990.255.0.1370.0.255.210255.255.0.149 box 0x0600x650