3 Jun 2007 sye   » (Journeyer)

nodebox.net is _very_ cool



python source code…( I have a special chinese fonts installed… Its name is whacky as it was borrowed from Windows font library…)

speed(0.5)
from AppKit import *

def export(name, extension=".png", compression=0):

    try:
        # Exporting only works from the second run.
        img = _ctx._ns["graphicsView"].image
    except:
        return
    img = img.TIFFRepresentation()
    img = NSBitmapImageRep.imageRepWithData_(img)

    options = None
    if extension == ".gif":
        type = NSGIFFileType
    if extension == ".png":
        type = NSPNGFileType
    if extension == ".jpg":
        type = NSJPEGFileType
#   options = {NSImageCompressionFactor: compression}

    data = img.representationUsingType_properties_(type, options)
    f = open(name+extension, "w")
    f.write(data.bytes())
    f.close()

def setup():
    global str1,str2,str3,str4,str5,str6,str7,str8
    str1 = u"小 不 忍 而 乱 大 谋"
    str2 = u"叶 子 已 黄 花 依 旧"
    str3 = u"妖 娆 总 在 烟 雨 时"
    str4 = u"女 娲 补 天 天 常 漏"
    str5 = u"奇 谈 怪 问 不 绝 口"
    str6 = u"妙 言 恶 语 齐 出 头"
    str7 = u"有 意 无 意 装 天 真"
    str8 = u"趣 事 终 在 人 背 后"

def draw():
  if FRAME > 8:
    fill(0,0,1,0)
    image('8.png',0,0)
#  elif FRAME == 8:

#    pass
  else:
    size(520,400)
    image("gogogirl.tiff",0,0)
#    export(str(FRAME-1), extension=".png", compression=0)
    x=36
    y=40
    translate(80,40)

    font(u"䡡湄楮札䍓ⵆ潮瑳",30)
    fill(0,0,1,1)    

    text(str1, x, HEIGHT-y-FRAME*y)
    fill(0,0,1,FRAME-1)
    text(str2, x, HEIGHT-FRAME*y)
    fill(0,0,1,FRAME-2)
    text(str3, x, HEIGHT+y-FRAME*y)
    fill(0,0,1,FRAME-3)
    text(str4, x, HEIGHT+2*y-FRAME*y)
    fill(0,0,1,FRAME-4)
    text(str5, x, HEIGHT+3*y-FRAME*y)
    fill(0,0,1,FRAME-5)
    text(str6, x, HEIGHT+4*y-FRAME*y)
    fill(0,0,1,FRAME-6)
    text(str7, x, HEIGHT+5*y-FRAME*y)
    fill(0,0,1,FRAME-7)
    text(str8, x, HEIGHT+6*y-FRAME*y)
#   print FRAME
#   print str(FRAME)
    export(str(FRAME), extension=".png", compression=0)

Syndicated 2007-06-03 16:48:22 from AllThingsGO 万物皆空

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!