Page 2 of 2

Re: Seeking comments regarding canvas syntax

Posted: Sun Oct 28, 2012 10:41 am
by qaisjp
Ref wrote:Replaced drawi and drawc with a single draw.
Thanks for the suggestion!
What is drawi? drawc seems to be "draw canvas", but what does drawi stand for?
what is this licensed under? mit? creative commons zero? public domain? same license as love?

fake canvas would be helpful ;P

you're welcome.

Re: Seeking comments regarding canvas syntax

Posted: Sun Oct 28, 2012 4:02 pm
by Xgoff
qaisjp wrote:
Ref wrote:Replaced drawi and drawc with a single draw.
Thanks for the suggestion!
What is drawi? drawc seems to be "draw canvas", but what does drawi stand for?
"image" presumably

Re: Seeking comments regarding canvas syntax

Posted: Sun Oct 28, 2012 4:08 pm
by Ref
'drawc' and 'drawi' have been depreciated.
They were originally a clumsy way to enable drawing a canvas (drawc)and drawing an image (drawi).
Newer version(see attachment) eliminates both, replacing it with a simgle draw for both canvases and images.
However, this introduces another complication.
In order to use any of the canvas functions, the object calling the action must have a metatable attached ( via object = newCanvas( item ) where item is an image, filename or width & height for a new canvas.
So to draw an image, you have to do imagecanvas=newCanvas( image_filename) and then imagecanvas:draw( ... ).
(Don't know what garbagecollection will do with all the extraneous canvases - help!)

As far as license goes, feel free to say what ever you want - talk is cheap.
I wasn't intending this to be useable code but to see if the developers of LOVE would think that this might be something to consider (if there was any interest) for future releases.

The code is very primitive and some of the more senior members of the community (after they stop laughing) could improve on it (corrections and comments saught). Documentaion is non-existing so code is only of interest to the more adventuresome.
Use, modify, correct, enhanse as you see fit and please don't blame me for my limited programming skills - still just learning.

Re: Seeking comments regarding canvas syntax

Posted: Sun Oct 28, 2012 11:19 pm
by Ref
Fun for the feable minded.
Tried to simulate above syntax for non-canvas systems.
Obviously not the way to go to fake canvases.
Constantly recreating images just too slow.
Demo takes ~16 seconds to create the simulated canvases though subsiquent display runs at same frame rate as the canvas demo.
Alternate approach to simulated canvas (Xgoff) superior!

Re: Seeking comments regarding canvas syntax

Posted: Mon Oct 29, 2012 4:32 pm
by Ref
OK! Dead horse for lack of interest.
Just for completeness before ending topic.
For those wanting a simple way to simulate canvas on machines lacking this capability, try my simcanvas.lua.
Syntax follows love.graphics.
To use, put at head of script:

Code: Select all

simcan = require 'simcanvas'
replace normal love.graphics function:

Code: Select all

canvas = love.graphics.newCanvas( width, height )
with:

Code: Select all

canvas = simcan.newCanvas( width, height )
and replace:

Code: Select all

love.graphics.setCanvas(  canvas )
with:

Code: Select all

simcan.setCanvas(canvas )
and replace

Code: Select all

love.graphics.setCanvas()
with (this is the only real change):

Code: Select all

canvas = simcan.setCanvas()
That's it.
Still a little slow but probably close to the best we can do now.
EOT