View in color | License | Download script | History |
9-Oct 21:21 UTC
[0.076] 25.239k
[0.076] 25.239k
ai.rREBOL [
Title: "REBOL/AI Image linker"
Date: 26-Mar-2002/15:44:25+1:00
Version: 1.0.0
File: %ai.r
Author: "Oldes"
Purpose: {Simple dialect for creating AdobeIllustrator files (ai) with linked images}
Comment: {I have no spec on the AI file structure so here are just a few things I needed}
Email: %oliva--david--seznam--cz
library: [
level: 'advanced
platform: none
type: 'dialect
domain: 'graphics
tested-under: none
support: none
license: none
see-also: none
]
]
dialect-example: [
artsize A4
layer "images" [
group [
group [
at 0x0 image %/M/xicht/l-006.gif 300x350
at 300x0 image %/M/xicht/l-007.gif 300x350
]
group [
at 0x350 image %/M/xicht/l-008.gif 300x350
at 300x350 image %/M/xicht/l-009.gif 300x350
]
]
]
layer "shapes" [
fill color 255.0.0
edge color 0.255.0 width 10 join round
at 100x100 box 0x0 100x100
edge join bevel dashed [12 6 3 10]
at 100x200 box 0x0 100x100
]
]
;this is the ai-file template:
ai: decompress 64#{
eJztPWtTG0mSnzUR/IciLiYCzwXWC/HwFwdg8LBrYxaYGc85JrhGakHbjVrubvE4
BffbLx/1yKruFvJjN24mdjwguiorKysrMysrK6v14+rJ2fruKLuM1/vPO2rlhx9/
3M/jqMzyF2p1df/0YPf83enqKpYfYtna6uohFjxTa+oZlp4nZRpT+fnR+ZsDqLE4
kmzyKipji+jo3fGr3fMDxraXzSajZHK1l92/UN2NDdXrbakN+BxsbWH9z8lpXDwF
9Cobzm7iSXmSZ8O4KPazNMuLF2r/IZqot9EV1ETq9zhNszu1l0bDT7LN2Ww6TZN4
BN1ksxyav1BTQFPEpSJ+XKTxbZz2LnaPBqr7vKc62Pg/Axjq8egGugK4TYDr1sMd
pemsKHPk62KEw+IaiO3BVGxDNYBeHCZpDKy/iUrVp6I+9/pLAb3CWPFvKt+6IELO
4rIElsFwqAMgi+HP4mmU06QABHAT/q0hza/icTRLS0akHBT8WT5TTOO7KZYU1GpT
deCjQwjcJ/zbhgf/33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8EjnMTfelKDLIWd8Fvtzku10cePr2m8nY//KbdX15SVAyI7ws6W4T4NjkJYJw
rJYx/qWY5qt415XZ/39wJ8+RxPduvOdQCaFzfwDe5U7lD1AM22+Ayr/eX9wkbKFb
LeqoyfdST3td/OYa+f2NZ3GJN3gr36on3BDxEjm54C+CCL7hYxFoeM27HtbtIPV2
gl4gonDjcbKnq91eQw9Vj211df/d8fnB8Tl/9Sx+OeZ5HiUpRpI4v9QLoNtUU5eK
By6oadBAtPvSkKdY0Qyp2doMIKenDgoG/e5w5Yf/A5SD7BfVdwAA
}
;and here comes the code:
make-warning!: func[val /msg m][
prin "WARNING: "
print either msg [m][
rejoin [
"misplaced item: " mold first val newline
" NEAR: " copy/part val 4 " ..."
]
]
]
aicreate: make object! [
layer: func[name content][
rejoin [
{%AI5_BeginLayer} CRLF
{1 1 1 1 0 0 1 255 79 79 Lb} CRLF
{(} name {) Ln} CRLF
{0 A} CRLF
{0 O} CRLF
;{0 g} CRLF
;{0 R} CRLF
{800 Ar} CRLF
;{0 J 0 j 1 w 4 M []0 d} CRLF
{%AI3_Note:} CRLF
{0 D} CRLF
{0 XR} CRLF
content CRLF
"LB" CRLF
{%AI5_EndLayer--} CRLF
]
]
image: func[src size pos /local sz][
sz: rejoin [size/1 " " size/2]
pos: rejoin [pos/1 " " pos/2]
rejoin [
{%AI5_File:} CRLF
{%AI5_BeginRaster} CRLF
{(} replace/all to-local-file src "\" "\\" {) 0 XG} CRLF
{[ 1 0 0 1 } pos { ] } sz { 0 Xh} CRLF
{[ 1 0 0 1 } pos { ] 0 0 } sz { } sz { 8 3 0 0 0 0} CRLF
{XF} CRLF
{XH} CRLF
{%AI5_EndRaster} CRLF
{S^M}
]
]
]
buff-layer: make string! 1000
buff-content: make string! 1000
ofs: copy [0 0]
TileBox: [30 31 582 759]
ArtSize: [612 792]
layers: 0
edge: make object! [color: 0.0.0 width: 0]
draw-lines: func[corners /local buff][
buff: make string! 1000
insert buff reform [ofs/1 + corners/1/1 ofs/2 + corners/1/2 "m^M^/"]
corners: next corners
forall corners [
append buff reform [ofs/1 + corners/1/1 ofs/2 + corners/1/2 "L^M^/"]
]
buff
]
ai-layer-rules: [
any [
'at set ofs [pair! | block!] (
ofs: reduce [
ofs/1 + TileBox/1
TileBox/4 - ofs/2
]
)
| 'image set src file! set size [block! | pair!] (
append buff-layer aicreate/image src size ofs
)
| 'group set tmp block! (
append buff-layer join "u" CRLF
parse tmp ai-layer-rules
append buff-layer join "U" CRLF
)
| 'fill 'color set tmp [block! | tuple!] (
if tuple? tmp [
tmp: reduce [tmp/1 / 255 tmp/2 / 255 tmp/3 / 255]
]
append tmp "Xa"
append buff-layer join reform tmp CRLF
)
| 'edge [
some [
'color set tmp [block! | tuple!] (
if tuple? tmp [
tmp: reduce [tmp/1 / 255 tmp/2 / 255 tmp/3 / 255]
]
append tmp "XA"
append buff-layer join reform tmp CRLF
)
| 'width set tmp number! (
edge/width: tmp
append buff-layer join tmp " w^M^/"
)
| 'join set tmp ['round | 'bevel | 'none] (
append buff-layer join either found? tmp: find [round bevel] tmp
[index? tmp][0] " j^M^/"
)
| 'dashed set tmp block! (
append buff-layer rejoin ["[" reform tmp "]0 d^M^/"]
)
]
]
| 'box copy tmp any pair! (
foreach [b-min b-max] tmp [
append buff-layer draw-lines reduce [
b-min
to-pair reduce [b-max/1 b-min/2]
b-max
to-pair reduce [b-min/1 b-max/2]
b-min
]
append buff-layer rejoin [
either edge/width = 0 ["f"]["b"] CRLF
]
]
)
| val: any-type! (make-warning! val)
]
]
ai-main-rules: [
any [
'layer set name [string! | none] set content block! (
parse content ai-layer-rules
append buff-content copy aicreate/layer name buff-layer
clear buff-layer
layers: layers + 1
)
| 'artsize copy tmp [block! | pair! | word!] (
artsize: switch type?/word first tmp [
word! [
switch tmp/1 [
Letter [
TileBox: [30 31 582 759]
[612 792]
]
A4 [
TileBox: [38 56 590 784]
[595.2756 841.8898]
]
]
]
pair! [reduce [tmp/1/1 tmp/1/2]]
]
)
]
]
parse dialect-example ai-main-rules
ai-data: compose [
creator (system/script/title)
for (system/user/name)
title "aitest.ai"
creationdate (rejoin ["(" now/month "/" now/day "/" skip mold now/year 2 ") (" now/time ")"])
pageorigin (reform copy/part tilebox 2)
tilebox (reform tilebox)
artsize (reform artsize)
layers (layers)
content (buff-content)
]
foreach [par val] ai-data [
par: uppercase rejoin ["!!" mold par "!!"]
replace/case ai par val
]
write/binary %aitest.ai ai Notes
|