Showing posts with label graffiti. Show all posts
Showing posts with label graffiti. Show all posts

Tuesday, September 30, 2008

Random Ramblings

Sorry for not blogging in a long time. This has been a very busy week, and so I'm just going to drop some snippets.

First RMS and Larry Ellison both commented against cloud computing.

Graffiti is uploaded and ready to use ( but not necessarily stable ).

I read Snow Crash and >loved it.

I'm confused between getting a Dell Studio 15 and HP Pavilion dv6767tx.

Meanwhile I'll be leaving for Pune tomorrow for SUMMIT '08 at MIT Pune. This is a sports fest, and I'm proud to be the only first year in the football team. This is the first time I'll be playing football as part of an official team with jerseys ( no. 2 ) and all, so it will be fun.

I'll be back on the 5th after which I will probably start with a new project. Right now I'm thinking of something like hyperlink visualizations, though I've no idea how to accomplish this.

Sunday, September 14, 2008

Graffiti is almost released


Aside from some code cleanup, testing, and writing architecture documentation, Graffiti is good to go. You can Download it

Wednesday, August 27, 2008

Reworked Graffiti's first render


After quite a few weeks of work, Graffiti has (again) reached the stage where it can render it's first words. It's now at 488 lines of code, of which the CSS related stuff itself comes in at 288 lines! There is no word wrapping yet, or any layout logic. I've been busy fixing quite a few bugs in the CSS overlays and so on.

This is how you would use it.



import pygame
from pygame.locals import *

import graffiti as g # 1

pygame.init()

g.init() # 2

pygame.display.set_caption('Graffiti Render Test')

screen = pygame.display.set_mode((800, 600))
screen.fill((0, 0, 0))

page = g.page.Page('<body><p>Testing Graffiti</p></body>') # 3

page.render.on(screen) # 4

while True:
for event in pygame.event.get():
if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE):
pygame.quit()
sys.exit(0)

pygame.display.update()


Monday, August 04, 2008

Great Weekend

So my second weekend in this place went pretty great. Now that I've found the right computer which easily boots from external devices I'm ready to slowly begin coding. On saturday five of us saw Ugly and Pagli — crappy movie — but I got my first pair of studs. Its been raining a lot for the last three days here. It starts at around 7 and goes on till late into the night, which means a lot of fun football (I've discovered that playing barefoot is better than playing with normal shoes), but being cooped up in the rooms afterwards.

I also made some headway into How To Design Programs which is a really great book, and read almost all of Joel On Software (the book) which is entertaining to say the least.

So right now I'm sitting here after attending a particularly boring calculus lecture. I haven't had a bath because there was no water, and I'm reading a boring story as part of the assignment for Communication Skills.

Right now I'm replanning Graffiti since I wiped it out a few weeks ago. I've also been messing around with Scheme, but can't think of what application to write to dig deeper into it.

Thursday, July 17, 2008

Graffiti: disaster

I Gitted Graffiti yesterday, and made an error in adding the files to version control, so I decided to undo the changes and because Git complained, I added -f.


git rm graffiti -rf


BOOM! Graffiti is gone.

Except for the basic style parser which I was writing at that time, which was saved by Kate.

I'm not blaming Git, just my stupidity.

I usually don't version control as soon as I begin a project, since I like to get the structure right, without having really bad log comments. From next time, versioning first.

In retrospect this is a really bad week. Experience isn't the most fun teacher.

Monday, July 14, 2008

Graffiti and more

It turns out parsing CSS according to specifications is no mean feat. So I am going to stall that for a moment, or implement a bare bones parser specifically written for Graffiti, and just plow along with Graffiti and doing what I can do, properly.

Maybe later ( read quite a few months ) I'll write a nice SAC compliant CSS parser and hook it into Graffiti.

Whatever I want to do, things aren't going to be moving fast. On Sunday I'm leaving for university ( DA-IICT ) and that involves a lot of pre-leaving things to do. And the week after that will go in getting settled there and taking a look at the computing facilities. I'll probably be taking a external HDD with all my files and I might just do a blind copy of this hard disk itself so I can boot Arch their if it is allowed.

Wednesday, July 02, 2008

Graffiti first view

Word wrapping is now implement and I've got a fairly decent design for the first version

So here is the client code it took

import sys
import pygame
from pygame.locals import *

import graffiti as g # Line 1

pygame.init()
g.init() # Line 2

s = g.spraybuilder.parse_string(
"""
<body>
<p>

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean id diam. Curabitur lectus. Nullam ultricies ultrices tellus. Praesent id turpis vitae lorem varius posuere. Donec id diam. Nam risus sem, aliquet ac, dignissim eget, aliquam ac, dolor. Aenean lacus metus, eleifend eu, elementum ut, lacinia non, nisi. Morbi odio. Aenean id massa. Ut arcu urna, elementum et, iaculis ac, lacinia eget, dolor. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Maecenas eleifend facilisis dolor. Quisque eget nulla. Sed ut eros. Maecenas ut diam. Nullam tellus urna, sodales ac, cursus nec, tempus ac, purus.

Aenean malesuada est quis velit. Nulla vitae nunc. Integer gravida. Curabitur purus velit, egestas quis, aliquet quis, mattis ac, orci. Aliquam ac lectus. Mauris congue orci faucibus est. In orci odio, sodales at, pretium nec, dignissim et, neque. Suspendisse potenti. Fusce eget ante. Etiam purus ligula, placerat tempor, pellentesque quis, tincidunt accumsan, turpis.

</p>
</body>
"""
) # Line 3

surf = g.spray.SprayRenderer(s.sprays[0]).render() # Line 4

pygame.display.set_mode((800, 600))
pygame.display.set_caption('Spray Rendering')
screen = pygame.display.get_surface()

pygame.mouse.set_visible(1)

while True:
for event in pygame.event.get():
if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE):
pygame.quit()
sys.exit()

screen.blit(surf, (50, 50, 800, 600)) # Line 5
pygame.display.flip()


to generate this



I'm doing a bit of internal access in Line 4 right now, but that will be fixed.
If the design remains good, it should remain that easy ( just 5 lines! ) to use for all time

Sunday, June 29, 2008

Graffiti

A new project of mine is Graffiti, a library over Pygame which allows application developers to write HTML and some CSS-like styling information and let Graffiti manage styling and rendering. It's no Gecko. Just something to solve an itch of handling word wrapping and styling in raw Pygame/SDL. The distinction between CSS and CSS-like is important and will be explained later. Write now I'm just on basic API design with no CSS parser, and all styles currently encoded in source. But I'll do it eventually, in a few days if there are no distractions