Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: Oldes/rs
base: bc9feac79b
...
head fork: Oldes/rs
compare: a73f5fff24
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
View
119 projects-rswf/xfl-clean/latest/rules_clean.r
@@ -0,0 +1,119 @@
+rebol []
+
+
+insert XFL-action-rules [
+ DOMDocument-clean [
+ [
+ "DOMDocument" |
+ "folders" |
+ "fonts" |
+ "media" |
+ "symbols" |
+ "timelines"
+ ]
+ (
+ parse-xfl content
+ ) |
+ "DOMFolderItem" (
+ append/only folders-to-check current-node
+ ) |
+ "Include" (
+ add-item-to-check current-node
+ ) |
+ [
+ "DOMBitmapItem" |
+ "DOMSoundItem"
+ ] (
+ add-item-to-check current-node
+ ) |
+ "DOMCompiledClipItem" |
+ "DOMTimeline" (
+ parse-xfl/act content 'DOMTimeline-clean
+ ) |
+ "swatchLists" |
+ "extendedSwatchLists" |
+ "PrinterSettings" |
+ "publishHistory"
+ ]
+ DOMSymbolItem-clean [
+ "DOMSymbolItem" (
+ parse-xfl content
+ ) |
+ "timeline" (
+ parse-xfl/act content 'DOMTimeline-clean
+ )
+ ]
+ DOMTimeline-clean [
+ [
+ "DOMTimeline" |
+ "layers" |
+ "frames" |
+ "elements" |
+ "DOMLayer" |
+ "DOMGroup" |
+ "members"
+ ] (
+ parse-xfl content
+ ) |
+ "DOMFrame" (
+ check-item current-node
+ parse-xfl content
+ ) |
+ "DOMShape" (
+ parse-xfl/act content 'DOMShape-clean
+ ) |
+ "DOMSymbolInstance" (
+ check-item current-node
+ ) |
+ "DOMBitmapInstance" (
+ check-item current-node
+ ) |
+ "matrix" |
+ "Matrix" |
+ "DOMDynamicText" |
+ "DOMInputText" |
+ "MorphShape" |
+ "SoundEnvelope" |
+ "tweens" |
+ "Actionscript" |
+ "morphHintsList" |
+ "DOMStaticText" |
+ "transformationPoint" ;do nothing
+ ]
+ DOMShape-clean [
+ "strokes" (
+ parse-xfl content
+ ) |
+ "edges" |
+ "Edge" |
+ "StrokeStyle" (
+ parse-xfl content
+ ) |
+ "SolidStroke" (
+ parse-xfl content
+ ) |
+ "StippleStroke" |
+
+ "transformationPoint" |
+ "matrix" |
+ "Matrix" |
+ "fills" (
+ parse-xfl content
+ ) |
+ "FillStyle" (
+ parse-xfl content
+ ) |
+ "GradientEntry" |
+ "fill" (
+ parse-xfl content
+
+ ) |
+ "SolidColor" |
+ "RadialGradient" |
+ "BitmapFill" (
+ check-item current-node
+ ) |
+ "LinearGradient" |
+ "DottedStroke"
+ ]
+]
View
129 projects-rswf/xfl-clean/latest/xfl-clean.r
@@ -0,0 +1,129 @@
+REBOL [
+ Title: "Xfl-clean"
+ Date: 16-Feb-2012/19:33:21+1:00
+ Author: "David 'Oldes' Oliva"
+ Purpose: "Removes unused assets from XFL sources"
+ Require: [
+ rs-project 'xfl-core
+ ]
+ Usage: [
+ xfl-clean %/d/test/XFL/clean/ %/d/test/XFL/clean-result/
+ ]
+ Preprocess: true
+]
+
+with ctx-XFL [
+ #include %rules_clean.r
+
+ folders-to-check: copy []
+ items-to-check: copy []
+
+ add-item-to-check: func[node /local atts name][
+ atts: node/2
+ name: any [
+ select atts "name"
+ select atts "href"
+ ]
+
+ forall folders-to-check [
+ if parse name compose[(folders-to-check/1/2/("name")) #"/" to end][
+ remove folders-to-check
+ ]
+ ]
+ folders-to-check: head folders-to-check
+
+ if "true" <> select atts "linkageExportForAS" [
+ append/only items-to-check node
+ ]
+ ]
+ check-item: func[node /local atts name item-name href][
+ atts: node/2
+ name: any [
+ select atts "name"
+ select atts "soundName"
+ select atts "libraryItemName"
+ select atts "bitmapPath"
+ ]
+ if node/1 = "DOMSymbolInstance" [
+ href: join atts/("libraryItemName") ".xml"
+ if none? find head files-to-parse href [
+ append files-to-parse href
+ ]
+ ]
+ if name [
+ print ["CHECK-ITEM:" name]
+ forall items-to-check [
+ if any [
+ (select items-to-check/1/2 "name") = name
+ (select items-to-check/1/2 "href") = join name %.xml
+ ][
+ remove items-to-check
+ break
+ ]
+ ]
+ items-to-check: head items-to-check
+ ]
+ ]
+
+
+ set 'xfl-clean func[src trg /local item file][
+
+ if verbose > 0 [
+ print "^/=================================================="
+ print "=== CLEANING XFL ================================="
+ print ["=== source:" src]
+ print ["=== target:" trg lf lf]
+ ]
+
+ init/into-dir src trg
+
+ parse-xfl/act xmldom 'DOMDocument-clean
+
+ while [not tail? files-to-parse] [
+ file: files-to-parse/1
+ recycle
+ current-symbol: either file? file [
+ current-symbol: form last split-path file
+ copy/part current-symbol find/last current-symbol "."
+ ][ copy/part file find/last file "." ]
+ print ["Processing file:" file mold current-symbol]
+
+ either file? file [
+ dom: to-DOM as-string read/binary file
+ new-file: file
+ ][
+ dom: to-DOM as-string read/binary xfl-source-dir/LIBRARY/(decode-filename file)
+ new-file: join xfl-target-dir ["LIBRARY/" decode-filename file]
+ ]
+ parse-xfl/act dom 'DOMSymbolItem-clean
+ ;write new-file form-xml dom
+ files-to-parse: next files-to-parse
+ ]
+ forall folders-to-check [
+ print ["REMOVING FOLDER:" folders-to-check/1/2/("name")]
+ clear folders-to-check/1
+ ]
+ forall items-to-check [
+ item: items-to-check/1
+ switch item/1 [
+ "DOMBitmapItem" [
+ print ["REMOVING BITMAP:" item/2/("name")]
+ error? try [delete rejoin [xfl-target-dir %bin/ item/2/("bitmapDataHRef")]]
+ ]
+ "DOMSoundItem" [
+ print ["REMOVING SOUND:" item/2/("name")]
+ error? try [delete rejoin [xfl-target-dir %bin/ item/2/("soundDataHRef")]]
+ ]
+ "Include" [
+ print ["REMOVING SYMBOL:" item/2/("href")]
+ error? try [delete rejoin [xfl-target-dir %LIBRARY/ item/2/("href")]]
+ ]
+ ]
+
+ clear items-to-check/1
+ ]
+
+ write xfl-target-dir/DOMDocument.xml form-xml xmldom
+ print "^/--------------------------------------------------^/"
+ ]
+]
View
22 projects-rswf/xfl-combine-bmps/latest/xfl-combine-bmps.r
@@ -7,9 +7,9 @@ REBOL [
rs-project 'rectangle-pack
]
usage: [
- ;xfl-combine-bmps %tests/merge-one/ %tests/merge-one-result/
- ;xfl-combine-bmps %tests/merge-multi/ %tests/merge-multi-result/
- xfl-combine-bmps %tests/pes/ %tests/pes-result/
+ ;xfl-combine-bmps %/d/test/XFL/merge-one/ %/d/test/XFL/merge-one-result/
+ ;xfl-combine-bmps %/d/test/XFL/merge-multi/ %/d/test/XFL/merge-multi-result/
+ xfl-combine-bmps %/d/test/XFL/t15/ %/d/test/XFL/t15-result/
]
preprocess: true
]
@@ -147,6 +147,9 @@ with ctx-XFL [
imgspec: select images-to-replace atts/("bitmapPath")
][
atts/("bitmapPath"): rejoin ["combined_" imgspec/3]
+ if none? node/3 [
+ node/3: to-DOM {<matrix><Matrix tx="0" ty="0"/></matrix>}
+ ]
matrix: get-node reduce [node] %BitmapFill/matrix/Matrix
;writeSBPair reduce [
@@ -161,6 +164,8 @@ with ctx-XFL [
nx: imgspec/1/x
ny: imgspec/1/y
+ unless find matrix/2 "tx" [repend matrix/2 ["tx" 0]]
+ unless find matrix/2 "ty" [repend matrix/2 ["ty" 0]]
matrix/2/("tx"): (to-decimal matrix/2/("tx")) - (((nx * a) + (ny * c)) / 20)
matrix/2/("ty"): (to-decimal matrix/2/("ty")) - (((nx * b) + (ny * d)) / 20)
]
@@ -172,10 +177,16 @@ with ctx-XFL [
imgspec: select images-to-replace atts/("libraryItemName")
][
print ["REPLACING:" atts/("libraryItemName") imgspec]
+ if none? node/3 [
+ node/3: to-DOM {<matrix><Matrix tx="0" ty="0"/></matrix>}
+ ]
matrix: get-node reduce [node] %DOMBitmapInstance/matrix/Matrix
- tx: to-decimal any [select matrix/2 "tx" 0]
- ty: to-decimal any [select matrix/2 "ty" 0]
+ unless find matrix/2 "tx" [repend matrix/2 ["tx" 0]]
+ unless find matrix/2 "ty" [repend matrix/2 ["ty" 0]]
+
+ tx: to-decimal matrix/2/("tx")
+ ty: to-decimal matrix/2/("ty")
w: imgspec/2/x
h: imgspec/2/y
@@ -184,7 +195,6 @@ with ctx-XFL [
either v: select matrix/2 "d" [matrix/2/("d"): 20 * d: to-decimal v][ d: 1 insert matrix/2 ["d" "20"]]
either v: select matrix/2 "b" [matrix/2/("b"): 20 * b: to-decimal v][ b: 0 ]
either v: select matrix/2 "c" [matrix/2/("c"): 20 * c: to-decimal v][ c: 0 ]
-
matrix/2/("tx"): tx - imgspec/1/x
matrix/2/("ty"): ty - imgspec/1/y
View
4 projects-rswf/xfl-core/latest/xfl-core.r
@@ -39,7 +39,7 @@ ctx-XFL: context [
Shape-bounds: copy []
BmpFills: copy []
Media-to-remove: copy []
- shape-counter: copy []
+ Shape-counter: copy []
Media-counter: copy []
Symbol-counter: copy []
files-to-parse: copy []
@@ -47,7 +47,7 @@ ctx-XFL: context [
scale-x:
scale-y: 1
- verbose: 2
+ verbose: 1
num-imported: 0 ;imported media files counter

No commit comments for this range

Something went wrong with that request. Please try again.