You'd record whatever is required to recreate the image.JellyFish wrote:What kind of information would I record in a database? Would it be the 'per-pixel' rendering information?
Devnetwork project idea!
Moderator: General Moderators
Re: Devnetwork project idea!
Re: Devnetwork project idea!
Have you taken a look at the google chart API?The Ninja Space Goat wrote:I hadn't considered drawing diagrams. That would be pretty useful. Good luck to ya.
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.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: Devnetwork project idea!
Dude, that is a sweet Google app.
Re: Devnetwork project idea!
My application wouldn't be so much a charting application, but instead a graphical one; for drawing diagrams.
Re: Devnetwork project idea!
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?
Any ideas?
Re: Devnetwork project idea!
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!
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?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.
It's prolly best choice anyway.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Devnetwork project idea!
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.
(#10850)
Re: Devnetwork project idea!
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.
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.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Devnetwork project idea!
Don't you mean the determination!JellyFish wrote:... if I had the commitment to do the project.
(#10850)
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: Devnetwork project idea!
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... 
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Devnetwork project idea!
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;
}(#10850)
Re: Devnetwork project idea!
Why would you waste one whole day of your life using IE?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...
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.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: Devnetwork project idea!
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.JellyFish wrote:Why would you waste one whole day of your life using IE?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...![]()
IE is still a piece of crap, but right now it is the lesser of all evils.