r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[View] discuss view related issues

james_nak
21-Dec-2006
[6456]
That's cool!
Gregg
21-Dec-2006
[6457]
Wow, indeed! That's very cool Jerry.
Maxim
21-Dec-2006
[6458]
I immediately saw a very easy way to condense all of that for in 
ram memory reduction... I'd use a dialect to convert to/from binary 
byte code... it would greatly compress the data... probably a 5 to 
1 ratio !
Henrik
21-Dec-2006
[6459]
what about storing differences instead of absolute coordinates?
Maxim
21-Dec-2006
[6460x2]
I don't that is even needed.
since all values are within one byte.
Henrik
21-Dec-2006
[6462]
it could probably be done, but it's not worth it without slowing 
it down a lot. I wonder how coords are stored in fonts normally.
Maxim
21-Dec-2006
[6463]
that depends how much ram he is using... at some point the GC slows 
down soooo much that speed exponentially decreases.
Henrik
21-Dec-2006
[6464]
I wasn't following how the data block is generated. was that with 
a C# program?
Maxim
21-Dec-2006
[6465]
Anton, the shape dialect was generated by my REBOL script. So it's 
not easy to optimize it. I wrote a C# program, which get all the 
glyph data of Chinese characters. I put these data in this format 
: x y type x y type ... where type is the type of the point. My REBOL 
script loads the glyph data, and generates a Shape dialect for every 
character.
Geomol
21-Dec-2006
[6466]
Chinese! :-) Cool! To better see the character, you can make it larger 
with this:

view layout [
	box 4 * 128x128 black effect [draw [
	scale 4.0 4.0
	anti-alias on
... followed by the rest of Jerry's program.
Henrik
21-Dec-2006
[6467]
is it possible to use any drawing this way and not only kanji/chinese 
chars?
Geomol
21-Dec-2006
[6468]
Someone should train a neural network to make calligraphy, then the 
chinese chars could maybe be made with less information.
Maxim
21-Dec-2006
[6469x2]
eeek  I'm affraid of the amount of neurons needed for such an endeavour 
especially since it would need one output for each pixel...   :-)
probably after a few years of training... it would be able to actually 
draw something ;-)
Henrik
21-Dec-2006
[6471]
I'm always thinking in generalization, creating an easy way to import 
vector drawings in rebol.
Geomol
21-Dec-2006
[6472x3]
Henrik, if info about points or whatever the drawing is made of is 
available, then I see no problem. (If I understand you correctly.)
Clipart is a good example.
What data format is used for clipart? An importer to DRAW dialect 
shouldn't be too big a problem, if the format is easily read.
Henrik
21-Dec-2006
[6475]
yes! I've always wanted to see all that kitchy clipart available 
to Windows users since Windows 3.1...
Geomol
21-Dec-2006
[6476]
There is probably a lot stored in SVG (Scalable Vector Graphics) 
format. There's been talk about that format around here, I think.
Henrik
21-Dec-2006
[6477]
would be nice to integrate this into postscript.r (wink wink) :-)
Geomol
21-Dec-2006
[6478]
yeah! :-)
Maxim
21-Dec-2006
[6479x5]
here is a draw glyph compressor  :-)

rule: [
	any[
		[copy val pair! (
			val: first val
			bignum: max bignum max val/x val/y
			append bin to-binary to-char val/x
			append bin to-binary to-char val/y
		)] |

  [copy val word! (append bin select [curve #{81} line #{82} move #{83}] 
  val )]
	]
]
the above glyph takes up 2223 bytes
oops... forgot to remove bignum check...
rule: [
	any[
		[copy val pair! (
			val: first val
			append bin to-binary to-char val/x
			append bin to-binary to-char val/y
		)] |

  [copy val word! (append bin select [curve #{81} line #{82} move #{83}] 
  val )]
	]
]
to use it:

bin: copy #{}
parse draw-shape-block rule
Geomol
21-Dec-2006
[6484x2]
W3C link to this from their SVG page: http://openclipart.org/cchost/

so there's a lot of clipart in SVG format, I guess. SVG uses XML, 
so it should be easy to import using my RebXML packet. Problem is 
to figure out content  of the format.
Hmm, it seems to be a large format, so it's not a week-end project: 
http://www.w3.org/TR/SVG11/
Henrik
21-Dec-2006
[6486]
isn't shadwolf working on something?
Maxim
21-Dec-2006
[6487]
doesn't Cyphre already have an AGG SVG viewer
Henrik
21-Dec-2006
[6488]
how is the tiger demo done?
Geomol
21-Dec-2006
[6489]
There is a "SVG RENDERER" group here.
Maxim
21-Dec-2006
[6490x2]
my god profiling stuff in REBOL in quite rewarding!
my latest shape compressor is now 2.5 times faster, by using a list! 
instead of a binary while accumulating values, and then converting 
it to binary!
Geomol
21-Dec-2006
[6492]
Can you try a hash!?
Maxim
21-Dec-2006
[6493]
there is no point... since I'm never accessing it... list! is the 
fastest insert series in REBOL
Geomol
21-Dec-2006
[6494]
ok. Do you preallocate space for all the entries beforehand? So it 
doesn't have to expand along the way.
Maxim
21-Dec-2006
[6495x4]
and since I'm only converting it to binary at the end, a lot of GC 
processing is alleviated.
oh, and 1000 of the above glyphs now takes 4.5 seconds to compress... 
imagine if we had rebcode !
lst: make list! 5000

rule: [
	any[
		[copy val pair! (
			insert lst val/1/x
			insert lst val/1/y
		)] |

  [copy val word! (insert  lst select [curve 130 line 131 move 132] 
  val )]
	]
]
parse draw-shape rule
bin: to-binary head lst
clear head lst

lst: head lst  ; a small quirk in list! datatype... it MUST be reset 
to head after a clear.
and 1000 glyphs takes 8.95 MB of RAM which is quite optimal IMHO 
   :-)
Ashley
21-Dec-2006
[6499]
How does that compare with:

	glyph: compress mold draw-blk
	load decompress glyph
Maxim
21-Dec-2006
[6500x4]
didn't try, I was having fun with parsing  ;-)
using compress is 2 times faster but takes up 20% more ram
(in compression)
but there is no comparison in decompression... using decompress  
is 4 times faster so far.. I could probably squeze a bit more more 
out of parse... but not much.
Jerry
21-Dec-2006
[6504x2]
Maxim, it's not "tsai", it's "yung". The meaning is some kind of 
traditional chinese musical instruments. http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=93DE
Henrik, it is possible to draw all the characters this way, not just 
Chinese characters. I am designing my own Text-Rendering System this 
way.