Page 2 of 2
Re: Devnetwork project idea!
Posted: Mon Mar 17, 2008 4:28 am
by onion2k
JellyFish wrote:What kind of information would I record in a database? Would it be the 'per-pixel' rendering information?
You'd record whatever is required to recreate the image.
Re: Devnetwork project idea!
Posted: Mon Mar 17, 2008 8:31 am
by Zoxive
The Ninja Space Goat wrote:I hadn't considered drawing diagrams. That
would be pretty useful. Good luck to ya.

Have you taken a look at the google chart API?
http://code.google.com/apis/chart/
Its pretty much around the idea of this thread. The url takes the params and generates an image of the data.
Last Friday at work I started writing a php class to generate the url with the correct params.
Re: Devnetwork project idea!
Posted: Mon Mar 17, 2008 10:40 am
by RobertGonzalez
Dude, that is a sweet Google app.
Re: Devnetwork project idea!
Posted: Mon Mar 17, 2008 7:49 pm
by JellyFish
My application wouldn't be so much a charting application, but instead a graphical one; for drawing diagrams.
Re: Devnetwork project idea!
Posted: Tue Mar 18, 2008 4:41 pm
by JellyFish
Hmm. Is there a way to get the rgba color values from a specific pixel in a canvas element? Without this I won't be able to translate my canvas element to a bitmap, which would prevent me from rendering the same image on the server-side.
Any ideas?
Re: Devnetwork project idea!
Posted: Wed Mar 19, 2008 3:21 am
by onion2k
I don't think there is, but I don't see why you'd need to do that either. Record what the user does (eg 'red circle, radius 20, at 300,200', 'wrote 'hello' in Arial size 12, red, at 350,100', and so on). Then upload those details to the server and recreate the image from that. Uploading the individual pixel data would result in a massive amount of information ... a simple 640*480 image would require a string that's 921,600 bytes long (640 * 480 * 3 bytes per pixel for the colour) unless you write some fancy compression code.
Re: Devnetwork project idea!
Posted: Sat Mar 22, 2008 11:05 pm
by JellyFish
onion2k wrote:I don't think there is, but I don't see why you'd need to do that either. Record what the user does (eg 'red circle, radius 20, at 300,200', 'wrote 'hello' in Arial size 12, red, at 350,100', and so on). Then upload those details to the server and recreate the image from that. Uploading the individual pixel data would result in a massive amount of information ... a simple 640*480 image would require a string that's 921,600 bytes long (640 * 480 * 3 bytes per pixel for the colour) unless you write some fancy compression code.
Right, I figured that. But what will happen if they circles and shape data the client draws exceeds that of the per-pixel data? What likeliness is there of this happening, would you say?
It's prolly best choice anyway.
Re: Devnetwork project idea!
Posted: Sun Mar 23, 2008 2:08 am
by Christopher
Don't forget that what onion is proposing also gets you complete editing history to allow full undo. That would be worth the extra data if it theoretically was larger. Encode the image in JSON, write a Javascript editor, and have a backend renderer that will allow you do download rendered images whenever you ask.
Re: Devnetwork project idea!
Posted: Wed Apr 09, 2008 4:32 pm
by JellyFish
http://www.nihilogic.dk/labs/canvas2image/
Looks like this guy/girl pulled it off (that is, converted a canvas element to a bitmap). And I don't even know how he/she did it.
But this says that I could use this to assist my project, if I had the commitment to do the project.
Re: Devnetwork project idea!
Posted: Wed Apr 09, 2008 4:57 pm
by Christopher
JellyFish wrote:... if I had the commitment to do the project.
Don't you mean the
determination!

Re: Devnetwork project idea!
Posted: Wed Apr 09, 2008 4:58 pm
by RobertGonzalez
Maybe next time they can put the notice that it only works in FF, Opera and Safari higher up on the page. The one day I use IE...

Re: Devnetwork project idea!
Posted: Wed Apr 09, 2008 5:10 pm
by Christopher
Javascript amazes me. The code is tiny. I was wondering what magic tricks you need to do get the image to download. None it ends up:
Code: Select all
// sends the generated file to the client
var saveFile = function(strData) {
document.location.href = strData;
}
Re: Devnetwork project idea!
Posted: Wed Apr 09, 2008 5:12 pm
by JellyFish
Everah wrote:Maybe next time they can put the notice that it only works in FF, Opera and Safari higher up on the page. The one day I use IE...

Why would you waste one whole day of your life using IE?
But anyhow, I researched a bit and found that they use the .toDataURL() method for the canvas element. the toDataURL method returns a string of
data: URI scheme.
So data: URIs aren't implemented in IE; only in IE8.

Re: Devnetwork project idea!
Posted: Wed Apr 09, 2008 5:13 pm
by RobertGonzalez
JellyFish wrote:Everah wrote:Maybe next time they can put the notice that it only works in FF, Opera and Safari higher up on the page. The one day I use IE...

Why would you waste one whole day of your life using IE?
Because as much as I hate it, it is the only browser that is staying open today. Safari is crapping out almost every hour, FF is still running up the memory and Opera does not want to seem to work as expected at all today.
IE is still a piece of crap, but right now it is the lesser of all evils.
