Devnetwork project idea!

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Devnetwork project idea!

Post 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.
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: Devnetwork project idea!

Post 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.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: Devnetwork project idea!

Post by RobertGonzalez »

Dude, that is a sweet Google app.
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Re: Devnetwork project idea!

Post by JellyFish »

My application wouldn't be so much a charting application, but instead a graphical one; for drawing diagrams.
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Re: Devnetwork project idea!

Post 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?
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Devnetwork project idea!

Post 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.
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Re: Devnetwork project idea!

Post 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.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Devnetwork project idea!

Post 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.
(#10850)
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Re: Devnetwork project idea!

Post 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.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Devnetwork project idea!

Post by Christopher »

JellyFish wrote:... if I had the commitment to do the project.
Don't you mean the determination! ;)
(#10850)
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: Devnetwork project idea!

Post 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... :banghead:
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Devnetwork project idea!

Post 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;
    }
(#10850)
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Re: Devnetwork project idea!

Post 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... :banghead:
Why would you waste one whole day of your life using IE? :lol:

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. :(
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: Devnetwork project idea!

Post 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... :banghead:
Why would you waste one whole day of your life using IE? :lol:
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. :evil:
Post Reply