Computer Science Canada New Draw Module |
Author: | copthesaint [ Thu May 03, 2012 4:04 pm ] | ||
Post subject: | New Draw Module | ||
I have been working on something to replace the Turing Draw Module with something that will hopefully be an improvement. The whole idea is to use a picture as the buffer for the screen, and since you can edit the values of the pixels in Turing in 24bit format, I thought it would be awesome if people could ditch the crappy 8 bit colors that are given in the Draw Module and replace it with this! The reason why I posted this in the help, is because I have never attempted making drawing methods before and I would like some help. Currently I added a few fun things into the class like Color Filter, Color Inverting. If anyone can help, it would be appreciated.
|
Author: | evildaddy911 [ Fri May 04, 2012 10:05 am ] | ||
Post subject: | Re: New Draw Module | ||
i wouldnt mind some rounded rectangles, such as:
edit for your module's style of course also, the program either crashes ("segment violation" on line 163), says Halt is not on the export list of Error, or crashes Turing because of a bug in the environment (depending on the version) ps, what will newLayer do? |
Author: | copthesaint [ Tue May 08, 2012 2:03 pm ] |
Post subject: | Re: New Draw Module |
I have updated the module, Currently you can draw: - Ovals - FillRectangles - lines (Problem with rounding I think, if anyone wants to look at that.) - polygons (Problem with lines causes problem with polygons) Currently you can also: -Invert Colors -Fixed Color Filter I wish I could have done this sooner but I have been busy. @evildaddy that can definatly be done but right now Im just figuring the math out behind the draw modules. Its something ive never spent the time to learn or figure out. @compsci, if anyone wants anything like evildaddy Its more then fine to post it here, but right now I just need reasorces for the mathematics of drawing objects by each individual pixel. |
Author: | Amarylis [ Wed May 09, 2012 9:10 pm ] |
Post subject: | RE:New Draw Module |
As I mentioned in the other post, I'd love 2D array buffers as opposed to 1D array buffers ![]() |
Author: | copthesaint [ Wed May 09, 2012 10:36 pm ] |
Post subject: | RE:New Draw Module |
Although I could do that, it would be useless because turing doesnt allow flexible arrays of fleixble array. plus manipulating a one dimensional array that holds only values specific to the pixel at that index is a hell of alot easier then dealing with a 1 dimensional buffer that holds more then one pixels values at a certain index point. |
Author: | Raknarg [ Thu May 10, 2012 12:44 pm ] |
Post subject: | RE:New Draw Module |
@copthesaint var arr : flexible array 1 .. 3, 1 .. 3 of int new arr, 2, 3 Works as long as you only change the first element. Maybe that helps. |
Author: | Amarylis [ Thu May 10, 2012 12:49 pm ] |
Post subject: | RE:New Draw Module |
Works with both of them new ar, 1, 0 chances the array bounds to 1, 0 |
Author: | Raknarg [ Thu May 10, 2012 12:50 pm ] |
Post subject: | RE:New Draw Module |
You're sure it works? Whenever I try to change the second element, it gives me an error, saying that it hasnt been implemented yet |
Author: | Amarylis [ Thu May 10, 2012 1:27 pm ] |
Post subject: | RE:New Draw Module |
What version of Turing are you using? ![]() |
Author: | Dreadnought [ Thu May 10, 2012 1:49 pm ] | ||
Post subject: | Re: New Draw Module | ||
http://compsci.ca/holtsoft/doc/flexible.html wrote: In the current implementation (1999), with a multi-dimensional array with a non-zero number of total elements, it is a run-time error to change any but the first dimension (unless one of the new upper bounds is one less than the corresponding lower bound, giving 0 elements in the array) as the algorithm to rearrange the element memory locations has not yet been implemented.
Hope this clear things up. |
Author: | Raknarg [ Thu May 10, 2012 2:20 pm ] |
Post subject: | RE:New Draw Module |
So basically you can either make it smaller or change the first one. |
Author: | Dreadnought [ Thu May 10, 2012 2:47 pm ] |
Post subject: | Re: New Draw Module |
There is only one kind of "smaller" that is allowed and that is size 0. Note that a size 0 flexible array can be changed into an array of any size you desire. |
Author: | copthesaint [ Thu May 10, 2012 3:14 pm ] | ||
Post subject: | Re: New Draw Module | ||
You cannot do flexible array of flexible arrays. Its not happening. The buffer for drawpic is an array 1 .. * of int, It would be completly pointless to convert the values then set them to a 2D array so then it can be set as a 1D array for the buffer again. Plus I already have done the math so you Can draw as if it were a 2D array... for the amount of work for this to work would be ridiculous since you can already, easily used a single dimension array. :
|
Author: | Amarylis [ Thu May 10, 2012 3:54 pm ] | ||
Post subject: | Re: New Draw Module | ||
Dreadnought @ Thu May 10, 2012 1:49 pm wrote: http://compsci.ca/holtsoft/doc/flexible.html wrote: In the current implementation (1999), with a multi-dimensional array with a non-zero number of total elements, it is a run-time error to change any but the first dimension (unless one of the new upper bounds is one less than the corresponding lower bound, giving 0 elements in the array) as the algorithm to rearrange the element memory locations has not yet been implemented.
Hope this clear things up. I tried using this: [syntax="turing]var ar : flexible array 1 .. 0, 1 .. 0 of int new ar, 1, 1 new ar, 1, 5 put upper (ar, 2)[/syntax] Didn't give me any errors |
Author: | Dreadnought [ Thu May 10, 2012 4:10 pm ] |
Post subject: | Re: New Draw Module |
I feel bad for steering this post off-topic, but your code (copy-pasted as is) produces the same error in both Turing 4.0.5, 4.1.1 and 4.1.2. What version might you be using? |
Author: | Amarylis [ Thu May 10, 2012 4:12 pm ] |
Post subject: | RE:New Draw Module |
...Open Turing, with some slight modifications done by yours truly. |
Author: | copthesaint [ Thu May 10, 2012 4:27 pm ] |
Post subject: | RE:New Draw Module |
@Dreadnought, You have to use version 4.0.5 and It will work. make sure the splash screen says 4.0.5 when you open turing. I am not using openturing. |
Author: | Amarylis [ Thu May 10, 2012 4:30 pm ] |
Post subject: | RE:New Draw Module |
I know you are not- Dreadnought asked which version I was using ![]() |
Author: | copthesaint [ Thu May 10, 2012 6:27 pm ] | ||
Post subject: | Re: New Draw Module | ||
Well I am posting an update, right now the image capture works awsome! With certain exceptions, that if not meant will cause bugs atm. Currently I have found these bugs: #1 "Not divisible by 8 error": If the image is not divisable by 8, my program like to report error: Array subscript is out of range line 92 when getting the values. #2 "Height greater then width run-time error": If the image has a height greater then the width then the image crops its self from the bottom up until the height - difference = width. I am please though at how well it works, and how fast it works.
|
Author: | copthesaint [ Sun May 20, 2012 4:56 pm ] | ||
Post subject: | Re: New Draw Module | ||
I have run into another problem... for some reason picsize and takepic is not working in my Render Module... If anyone would know why, it would help ![]()
|
Author: | copthesaint [ Wed May 23, 2012 10:59 am ] |
Post subject: | Re: New Draw Module |
~Bump I have my whole program working now, I will just remake the whole thing and clean it up. then I will post my first version for turing 4.0.5 that should be bug free. I have already noticed an issue with speed however I will try to optimise my code while I remake it. |