How should the files of TIIMP be saved? (Note: An option to enable/disable archiving will be added)
User created files as protected programs, internal files (Settings, etc.) as appvars
 20%  [ 2 ]
Everything as appvars
 80%  [ 8 ]
Everything as protected programs
 0%  [ 0 ]
Other (Please tell me what you mean!)
 0%  [ 0 ]
Total Votes : 10

I decided to post my mind here... I am planning to make a picture editing program for Ti-83+'es.
Yes, I know there are tons of them on ticalc.org, but they are all low quality and don't offer the functions I need. I want to make the standard tools (Lines/Boxes/Triangles/Circles/Dots, filled/inverted/outline/...) and in addition to that layers and area selection (like in Photoshop and GIMP). I also want to add a flood fill tool, but every attempt till now either was too slow taking about ten minutes to fill half of the screen (painter algorithm) or lagged me out with a memory overflow (standard recursive method).

I thought about the algorithms too. The standard tools will be easy to implement. The layers and area selection could be a hassle but I thought of a method in theory, without testing yet:

The layers will be made of several pictures layed one on top of the other making it flexible movable and easy to edit.
The area selection is more complicated:
I will make a new layer for a "mask". It will be basically just a white pic with the selected area being filled black (Floodfill algorithm necessary.). Now one can edit whatever he wants and when he is done I am "and-ing" those pics and I get the result, only the marked part being edited and all the other kept like they were.

As this can't be done efficiently in basic I will use xLib for graphics and, thanks to Xeda for your awesome libraries, Copyprog which allows me to modificate any data type and Xtravar which gives me acess to hacked vars (pics in that case).

I plan on storing the not finished projects in the Archive by appvars, this can be done with simply copying the binary data of pictures and putting it one after another and then simply getting the last few bytes for misc. Information. I will do this by modulo division (I first get the number of pictures and then I get the rest amount of bytes, being less than 767, and know it is the misc. data section).

This will be done all in basic with these three libs, one of them being more a tool than a lib. I haven't started yet but tell me, what do you think, should I better start from the harder algorithms or from the beginning of my program?

Any help appreciated, thanks!

Edit:
I added the todo and features list at the front page now.

General features planned/in progress/implemented:
  • Full GUI (Always under development)
  • Own Filesystem (Under development at the moment)
  • Basic shape drawing tools (Nothing done at all, but it's absolutely no problem)
  • Installation program (Nothing done at all)
  • File managing (Under development)
  • Simple API system (Nothing done at all, and de facto I haven't any clue what to do)


Image processing algorithms planned/in progress/implemented:
  • Bezièr Curves Rendering (Done and optimized, thanks lirtosiast!)
  • Flood fill (Done and optimized, implemeted the ScanLine algorithm, and thanks Runer112!)
  • Masking (Area selecting) algorithm (Done, implemented an own algorithm)
  • Layering algorithm (Nothing done at all, but I know what to do)
  • Dithering brushes (Nothing done at all, but I have an idea)
  • Stamp tool (It was requested, and nothing done yet, but I have an idea)
  • Scaling algorithm (Implementing Pixel Replication, what we've done did not work correctly. But thanks PT_!)


EDIT2:
After a long time being abandoned, me and PT_ are picking this project up again! Here is the point where it continues.

I am adding a new progress log, as we considerably changed the structure and fully started over with the project:

General features, sorted by importance vs. state:
  • GUI - Started on it, some stuff done, well planned through so far. (Critical, some results ready)
  • Installer - Taken over by PT_, planned from start to end by now. (Important, fully planned through)
  • Main program - Kinda done, will probably be fully reworked, though. (Critical, working version made)
  • File managing - Nothing done at all. (Important, nothing done)
  • Own file format - Working format from first program attempt. (Important, working version made)
  • As many features as possible toggleable - algorithm packages need to be implemented, GUI animations may be turned off. (Unimportant, almost nothing done)
  • Simple API system - Automatically exists with the structure I am planning. (Unimportant, no efforts needed) - We noticed the API system would have to be able to handle it, if the program's files get changed by the user, which would be a huge effort. Decided to cancel the feature.

Algorithms to be done:
- Reserved, no progress log yet -
Cool. As I am not familiar with libraries, I don't have much input on this. But I look forward to seeing how this progresses. If you need any help with ti-basic related issues though, I'd be glad to lend a hand Wink
If you're using xLIB for graphics, why not just make it a Doors CS program? Doors CS offers all the xLIB libraries as well as Celtic for creating and manipulating files and all the DCSB libs:
http://dcs.cemetech.net/index.php/Third-Party_BASIC_Libraries
http://dcs.cemetech.net/index.php/DCSB_Libs

This sounds like a great project idea, and I look forward to seeing your updates in this topic as you continue planning and implementing it.
I know about the features of Doors CS but I decided it takes too much memory on my calculator... xLib uses ~17 kB, and the two other libraries 1 kB in total, this is far less than Doors CS. But I can add a Doors CS header to make the xLib app optional for Doors CS users.

Edit: I am stuck at the flood fill routine. Does anybody have an idea what algorithm I should use? Because any iterative and/or recursive method I know fails this task. Either from a memory overflow or from speed.

Edit 2: After 3 failed attempts to get this post together, I have finally managed this.
So, I got a scanline flood fill algorithm to work, thanks to Runer112 for helping me!

Edit 4: Image added


And the code (Edit 3: added comments):

Code:
StorePic 1
0->Xmin:1->/delta/X
~62->Ymin:1->/delta/Y
RecallPic 1
//Set to friendly window settings but keep the graphscreen content safe
Menu("TIIMP ALGORITHMS","AREA SELECTION",A1,"FLOOD FILL",A2,"LAYERS",A3
Lbl A2
Input
//Get the starting pixel
~Y->Y
//Convert from Pt-format to Pxl-format
pxl-Test(Y,X->/n/
//Get the old color. On monochrome screens the new color equals not(oldcolor)
{Y+.01X->L1
0->dim(L2
//Initialize L1 (Stack to go up) and L2 (Stack to go down)
Repeat not(dim(L1)+dim(L2
//Start main loop
If dim(L1
Then
int(L1(dim(L1->Y
100fPart(L1(dim(L1->X
dim(L1)-1->dim(L1
Else
int(L2(dim(L2->Y
100fPart(L2(dim(L2->X
dim(L2)-1->dim(L2
End
//If possible pop up-stack, else pop down-stack
If /n/=pxl-Test(Y,X
Then
//This skips an iteration of the main loop if the treated line was colored after stacking. Done to save some speed.
While X and [recursiven]=pxl-Test(Y,X-(X!=0
X-1->X
End
//Move as far to the left as possible to start the line at the left
If Y and /n/=pxl-Test(Y-(Y!=0),X
Y-1+.01X->L1(1+dim(L1
If Y!=62 and /n/=pxl-Test(Y+(Y!=62),X
Y+1+.01X->L2(1+dim(L2
//If pixel above/below = oldcolor stack this line to be colored.
X->Z
//Backup X. Will be used to start a line
While X!=94 and /n/=pxl-Test(Y,X+(X!=94
X+1->X
//Move one pixel right in the line
If Y and /n/=pxl-Test(Y-(Y!=0),X
Y-1+.01X->L1(1+dim(L1
If Y!=62 and /n/=pxl-Test(Y+(Y!=62),X
Y+1+.01X->L1(1+dim(L1
//If pixel above/below = oldcolor stack this line to be colored.
End
real(12,2,Z,Y,X,Y,1
//Draw the actual scanned line
End
//End skipping If-statement
End
//End main loop
Return


It can be optimized, I am sure. any ideas?
Sorry for double posting, but 24h were over and so I decided to... doublepost. I just did not want to edit my old post even more.

Okay so here is the next algorithm:
Area protecting/selecting!

Edit: Image added


Edit 2: Explanation
This takes three arguments: Pic1-Pic3.
Pic1, or original, is the main picture. Pic2, or selected area, is the area that was marked. Changes will only be saved if they are within that area. Pic3, or modified (Thanks Ivoah, for correcting me) is the picture where the changes are made.
The algorithm replaces the marked area in the original picture by the marked area in the modified picture. This technique can be used for copying areas of the picture too!


Code:
real(3,3,0,0
real(3,2,1,0
//This "logic-and´s" the modification and the picture containing  the selected area. The modification gets cut to fit into the selected area.
real(3,1,2,0
//This ²logic-or´s" the pic from the last step with the original pic. All pixels that were changed from black to white get transferred.
StorePic 1
//Store this as Pic1 for later recall
real(3,2,0,0
real(12,8,0,0,94,62,0
//This inverts the selected area...
real(3,3,2,0
//and "logic-or´s" it with Pic1 from before. We color all but the useful data of Pic1 black.
real(3,1,1,1
//"logic-and" with original. All changes from black to white get transferred.
DelVar Pic2DelVar Pic3StorePic 1
//Cleanup
It looks like your pictures are in a private folder, so we cannot see them. Can you upload them to a site like Imgur, then embed them here in [img] tags? Thanks!
I have uploaded them onto my private webspace, without any protection. It was also visible from my computer and from my phone. But I will upload it on imgur now, one second.
Today I made the intro for the program!
I decided to skip the layers algorithm for now, I would need to program too much of the user interface for it. Also it is not that hard to implement, so I will do it with the rest of the program.

Okay, intro screenshot:



Code:
StorePic 1
AxesOff:FnOff :PlotsOff
0->Xmin:1->DeltaX
~62->Ymin:1->DeltaY
//Screen Setup
real(7,0
//RunIndicator off (seems not to work on my calc somehow)
real(5,1
Ans->[recursiven]
//Store contrast in /n/
real(5,0,0
//Set contrast to 0
real(3,4,0,1
//Recall "Powered by" screen
For(A,0,25
real(5,0,A
rand(2
End
//Gradually increase contrast. This makes the effect of fading in
randInt(1,1,30
//Delay
For(A,25,0,~1
real(5,0,A
5rand(2
End
//Gradually reduce contrast. This makes the effect of fading out.
real(3,5,0,1
//Recall that awesome menu screen :P
real(5,0,[recursiven]
//Restore user set contrast


The fading in/out effect is smoother on real calculators. Also it is darker at its half and almost does not look like if the contrast was reduced.

Edit:
I need help with two questions. The first is... Well the flood fill algorithm uses much RAM during execution. To reduce the probability of an overflow I want to archive my main program when the flood fill subprogram is running. Is that risky/harmful in any way? Or am I free to do this as long as I unarchive it again?

And the second question is about the graphics and user interface. How should I design it? I thought of a sometimes popping out bar at the bottom, from which you can call menus that wipe in from the side. I have an idea on how to do this but it might get slow... Anyways, what do you think?

Any help always appreciated!

Edit 2:
Updated. The menu is now interactive and I added some entries I forgot about in the first version.



I have not pasted the code this time because I have issues with my browser and the paste malfunctions... And the code is not that hard to implement Wink.

And WabbitEmu seems to have trouble adjusting the contrast... It is still really smooth on my calc.
I really like the main menu, with the sole exception of the "PRO" text, which looks slightly out-of-place. Do you use a Pic variable for that intro? If so, I might suggest that you consider making the intro optional, but that is of course a stylistic choice. To answer your Archiving question, you should never try to Archive the program that is running (including a program that called the current program). So if prgmABC is running, you shouldn't try to Archive prgmABC, and if prgmABC called prgmXYZ so that prgmXYZ is now running, you shouldn't try to Archive either prgmABC or prgmXYZ.
Okay. I removed the inkpot and the PRO and shifted the eye up insted, thanks to Kerm who gave me that idea, and it looks awesome Smile. I also made a not yet functional attempt (graphics only) for the editing screen popup menu. I had no access to a computer today, so I haven't posted any screenshots yet, but expect them tomorrow in the morning.

Also, on the idea with making the intro optional:
I plan on making a(n) (de-)installer program, which will have no purpose other than being a menu that allows one to delete various, possibly not used, functions from the main program (Including the intro). As Kerm said, it would be unsafe to modify the main program from a subprogram, so this will be a standalone program called directly from the homescreen. Maybe I will add an ability to create/delete this program from the settings submenu in the main program.

A question again: Should I make a custum menu in that deinstaller or should I use the built in function for simplicity and memory saving? What do you think?

Edit:
Made the menu. I will make another edit from my phone with the screenshots because I can´t get imgur to work from my PC.
Anyways, here is the code:


Code:
StorePic 1
AxesOff:FnOff :PlotsOff
0->Xmin:1->DeltaX
~62->Ymin:1->DeltaY
real(7,0 real(5,1
Ans->[recursiven]
real(5,0,0
real(3,4,0,1
For(A,0,25
real(5,0,A
rand(2
End
randInt(1,1,30
For(A,25,0,~1
real(5,0,A
5rand(2
End
ClrDraw
real(5,0,[recursiven]
Lbl M
real(3,5,0,1 0->[recursiven]:0->theta
For(A,0,6
real(12,2,8,15+A,50,15+A,1
End
Repeat max(K={105,21
If [recursiven]!=theta
Then
If [recursiven]>theta
Then
For(A,0,6 A+7theta
real(12,2,8,15+Ans,50,15+Ans,1
real(12,2,8,22+Ans,50,22+Ans,1
End
End
If [recursiven]<theta
Then
For(A,0,6 A+7(6-theta
real(12,2,8,63-Ans,50,63-Ans,1
real(12,2,8,56-Ans,50,56-Ans,1
End
End
End
getKey
Repeat Ans
getKey->K
End
[recursiven]->theta
[recursiven]+(K=34 and [recursiven]!=6)-(K=25 and [recursiven]->[recursiven]
End
"--------------    MENU END    ---------------
If [recursiven]=4 Goto S
If [recursiven]=5
Goto Q
ClrDraw
If not([recursiven]
Then
"FILE ASSEMBLY HERE
End
If [recursiven]=1 or [recursiven]=2
Then
If [recursiven]=2
Then
"RECALL PIC TO GRAPH SCREEN HERE
End
"GRAPH SCREEN TO FILE HERE
End
If [recursiven]=3
Then
"FILE DECODING HERE
End
ClrDraw
{48,49,50,51,51,51,50,49,48,47,46,45,45,45,46,47->L2:{~33,~33,~34,~35,~36,~37,~38,~39,~39,~39,~38,~37,~36,~35,~34,~33->L3 For(G,2,4,2:Circle(48,~36,G,{[i]:End:Text(24,32,"Loading...
1->G
1:prgmTIIMPGUI
{48,~31,1,0,0->L1
1:prgmTIIMPGUI
|LTIIMP->L4
1:prgmTIIMPGUI
DeltaList(cumSum(L2->L2
1:prgmTIIMPGUI
1->M
1:prgmTIIMPGUI
ClrDraw
Text(~1,1,1,"EDITING MODE
RecallPic 1
While 1
Repeat Ans
getKey->K
End
If K=31
Then "LayersBrush Tools File  ->Str1
2.4:prgmTIIMPGUI
End
End



Code:
Subprogram:prgmTIIMPGUI
Ans->|N
If Ans=1
Then
Pt-Change(L2(G),L3(G
G+1-16(G=16->G
End
If |N=1
Return
If 2=int(|N
Then
real(9,0,1
For([recursiven],63,70fPart(|N)+6,~1
real(12,9,0,63,30,[recursiven],1
End
10fPart(|N->[recursiven]
length(Str1)/[recursiven]
For(theta,[recursiven],1,~1
Text(63-7theta,2,sub(Str1,thetaAns-Ans+1,Ans
End
6+70fPart(|N->[recursiven]
0->theta:0->Z
real(12,8,1,[recursiven]+1,29,[recursiven]+7
Repeat max(K={21,105,45
getKey
Repeat Ans
getKey->K
End
theta->Z
theta-(K=25 and theta)+(K=34 and 1+theta!=10fPart(|N->theta
real(12,8,1,[recursiven]+7theta+1,29,[recursiven]+7theta+7,0
real(12,8,1,[recursiven]+7Z+1,29,[recursiven]+7Z+7,1
End
For([recursiven],70fPart(|N)+6,63
real(12,9,0,63,30,[recursiven],1
real(3,1,0,0
End
DispGraph
If K=45
~1->theta
End
If 2=int(|N
Return


Edit 2:
Screenies are done:
Nice menus! I like the open/close animation, although I bet if you're using the program a lot for editing, you'd want a way to turn that off and simply make the menus appear and disappear instantaneously. Do you plan to add a setting like that?
I am stuck!

I am designing the file format now. The idea is the following: <metadata>/<layer1>/<layer2>/...

I am actually using the slash as the first delimiter between metadata and layers. The problem is, that whole thing is stored as a string, meaning if I encode pictures as string any binary pattern (and thus token) is possible. This means there is no safe delimiter that can't occur in a picture except if it is bigger than 767 bytes. I believe there must be a better solution?
I would even accept an assembly program for that, but only a secondary solution and keep in mind that I don't know any assembly and so someome else must do this.

Edit:
Kerm, sorry, I haven't seen your post somehow. Thanks for the idea! I will add such an option.

I haven't found a solution for the delimiter problem, probably I will just use "<layer>", it is really unlikely that the user will draw exactly that pattern. Maybe I will add a function called "restore", if the picture messes up it will run a really time consuming process but it will detect what is wrong and show the picture correctly. This will be annoying but there seems to be no way around that.
I haven't done the code yet but this can't take long, expect it in one to two hours.

P.S.: Tomorrow we are leaving to spain till September, the 13th. I do not suppose to have internet there but if I will have, it will be limited. I will post maximally every two days, and I won't be able to take screenshots or paste the code. If I will have time, I will try to explain what the program does, and I will post the screenshots and code after arriving at home again.

Edit 2:
I am so sorry for this, but it was harder than expected. I haven't yet finished this but I am also making the GUI paralelly. It is evening at me, I won't have access to my computer today anymore amd we are leaving tomorrow at 5 am so I wont have tomorrow too.
Here is just an explanation of what I did and what I am doing:

  • Make the file related entries of the menu actually doing what they must and not just load the editing mode (almost done)
  • Make some more GUI elements in yhe subprogram
    (Input and alert)(Just started)
  • Design data type (Done)
    -> This will look like Filemetadata(Name only currently)<layer=layer1name> Layer1data<layer=layer2name>Layer2data
  • Other:

    • I made a file limitation. You can olnly have 5 files because if it would be too much it wwon't fit into the "load file" menu. 5 is just a safe number till now, I will calculate later how many files will fit. If I get to it, I might even do a scrollbar and remove the limitation, but thats very unlikely.
    • All file names are stored in an appvar (Done) which is made to speed up the file reading process by multiple times.
    • Made a list for data storage. (Done) Currently holds only the number of files, which also speeds up the process. Laer Iit will hold another element or two where the settings flags are stored.

I am back!
I had not that much time in spain to code, and in addition the part after the menu (File creating) was complicated. It took that long because of a lack of a good IDE, there were simply too many nested commands.

Anyways, whats done:

  • Improved the flood fill algorithm by far, now it is smaller and times faster!
  • Finished the error message and text/number input GUI parts. I am still trying to redesign the latter. It fails till now because I can't get xLib to display a black rectangle.
  • Make every menu entry until "Load File" work. The "Load Picture" seems to malfunction, however.


Problems:

  • xLib seems to have massive problems displaying rectangles. Half of the trouble with fixed sizes (this can be worked around most of the time by trying different things out), I am not sure how it will behave with the "Rectangle Tool", where I don't know for any rectangle in advance if it will work or not.
  • Xeda's Library "CopyProg" has trouble somewhere with the "Copy Var" function, I haven't had enough time to analyze this yet.
  • Because of the latter, I cannot proceed with the appvar data part. Maybe I will have to change to celtic but I haven't worked with it before.


If someone knows a library that allows me to read, write, archive and unarchive appvars, I would thank for the help!

Edit:
I just remembered to explain why I have no screenshots... Well, I simply have no access to a computer till tomorrow, since it is night at me. Sorry again, screenshots will be tomorrow!
Doors has both xLIB and Celtic libs built-in, and it should work with the stuff you have written already, if not with some minor changes. And it's all-in-one, so no need ot have xLIB and CopyProg/Celtic loaded, all you need is DCS. Then again, that solution might not be what you are looking for.
I second NoahK's suggestion very heartily. The xLIB libraries in Doors CS do all the (fast) graphics manipulation you might want, and the Celtic III libraries have your AppVar manipulation covered. Plus, your program would be smaller, because you wouldn't need to include any libraries. Go with Doors CS!
I did not abandon this project, I am just a bit busy (school started and stuff), got stuck with freeing up space for DoorsCS and I am not sure what is going on at school... They said TI-83+es are not allowed for the High School graduation anymore and they will soon exchange it by another. In the worst case I will need to do everything I did earlier on emulators.

Ok so I will try to keep you up to date! Smile
Thanks for the update, Nik. Do you mean not [/i[required[/i] for graduation, or are you saying that they'll require you to purchase a different calculator instead? Or have you even been using a school calculator rather than one of your own, as it sounds?
They forbid that model in the whole country as they found a possibility to cheat with it.

As for whom the calculator belongs to: I got it for free at my school and theoretically it belongs to my school, but every school year it's price to buy it from them shrinks by 20% and by the 12th grade, when the school ends, I am allowed to keep it for free.

For the changes: We are said to have gotten those calculators accidentally as we are the forst year not allowed to use it (the grade above us are the last who are allowed to). All I have heard were rumors at first, now our math teacher told us that they will replace our calcs by something else. I do not know what... Maybe I will just buy the calc at 60% of its price and keep it Smile

I really only know we will need another calculator, if they will take the old or if they will allow us to keep it or if they will give us a better TI? I do not know...
Okay... So a bit got cleared up: They forbid graphing calculators, so we will gey scientific ones. I still do not know whether we may keep our TI's. In the worst case my parents won't allow me to buy it, they don't like it for some reason.

For the project: I made a to-do list, it may seem that I didn't work on... And maybe that is so Razz ...but a bit progressed.

  • Short term:
    • Finish after-menu part (Almost done)
    • Free up space and install Doors CS (I will mention later why I need this) (Done)
    • Re-design file format and implement in code (File format designed, not implemented)
    • Convert Doors CS logo to use it oncalc and update "Powered by" screen (Done)
    • Make sure program is compatible with the new libraries and correct if needes (Program compatible, now I need to optimize it with the new abilities)


  • Long term
    • Implement various tools
    • Make file managing ability
    • Design general appvar


As promised, why I installed Doors CS: I will use xLib and Celtic III isntead of xLib and CopyProg, as both stamdalone seemed to be broken at some points. It is also easier to handle pictures now, as I can put them in a single line of a program and get that line.
(I decided to use programs over appvars now, as celtic allows me to manage them easier with its functions).

(Edit: Updated list)
Our teacher told us that he is collecting the calculators next week and we will get much worse scientific calculators... I guess I have to use an emulator and eventually buy another TI someday...

And I haven't had any time today so I did not work on.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 4
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement