Re: [casetta] 3-Color version of the function img_to_basic

[ Thread Index | Date Index | More lists.tuxfamily.org/casetta Archives ]


Hi,

2007/3/14, Fabien ANDRE <fabien.andre.g@xxxxxxxxxx>:
Florian Birée a écrit :
Hello,

2007/3/11, Fabien ANDRE <fabien.andre.g@xxxxxxxxxx>:
Hello,

I've corrected some bugs in the img_to_basic function and I was able to get this working with a 3-color picture.
However, the function has still lots of restrictions, I mean :
It works only with :
- 24bits picture WITHOUT ALPHA CANAL(RGB)
- Only 3 colors or less :  Black or any another color wich will be displayed as blue, Green (0,128,0) Orange (255,128,0).

For the restrictions, maybe your normalize function in pictures.py could "filter" a picture and get it working with my function, I have to check.

It's not the work of your function to check the size and things like the number of colors and alpha canal. All pictures used in casetta are from a casio format or have passed in the normalize function. This function remove alpha canal, resize the picture to 128*64 and convert colors. If your function is added in casetta_gtk, as all pictures are stored in the memory as in the calculator, there is no problem.

Maybe, It would be good to write a normalize function for black and white calculators such as Graph35+/100+...

The Graph 35+ (I don't know for the 100, but I think it's the same) work with exactly the same format than the Graph 65, but green and orange are not printed, and blue become black. So, for Casetta, it's just a question of view (I'll be possible to switch between mono and color mode in the picture editor of casetta_gtk, and a function will be added to convert orange and green in blue, to keep all colored pixel in a monochromatic picture).

See attachments for a new version of the function (pictures.py), a new script to test this function (test_img_to_basic.py, to get this stuff working, you have to put my new pictures.py in your casetta module path) and an image I succeded to get on my casio calculator (tux2.png).

I've tried your function, the result is better than the first function. I've a bug with the white color : when there is another colored pixel before the end of line, a blue line is printed in the space. I've fix this problem by adding a condition in the "end F-Line" block.
You can see as attachments your function (in pictures.py) with this modifications, and some others : I replaced the color constants by variables, because they can be changed (by users or developers), and added Cls and ViewWindow because I think your function may produce "ready to use" code.
I've also join my script to test your function, which use more the capacity of casetta (to save programs in any format, by example), and tux2bis.png, the result - a screencapture from my calculator - of the conversion of your tux by the modified function. You will see that the result is not perfect, but it's not far (green points on the top left corner are not on the screen of my calculator, maybe a transfer problem).

However, they are some problems with the beginning or the end of a line : on the beginning, (col = 0), you have condition with [col-1] ( =[-1]). This return the last pixel of the current line, which is not the expected behaviour.
And because your function to "save" the F-Line wait after the last pixel of the line, a pixel (or a colored line) which ends a line is not drawn.

For the end, just a presentation detail : could you write with 4-spaces tabs and less-than-80-characters line, as all the code in casetta ? (Yes, it's very unimportant detail ;-) )


I hope this will help !

Another time: a lot of thanks for your work, all contributions about casetta help !

--
Thesa ~ Florian Birée
e-mail : florian.biree@xxxxxxxxx
Messagerie Instantanée Jabber/XMPP/Google Talk : florian.biree@xxxxxxxxx
Site web et blog : http://filyb.info/
Hello,

Sorry for the time left before answering ! I had too much homework :-).

The changes you added in the file made my tux look bad... Tux2-1.png is the image I get with the function I sent you and Tux2-2.png, is the the I get on my calculator with your modified function.
I'm trying to see what's going wrong !

For the normalize function, the Graph 100+ has the same behaviour as a Graph 35+ (I check with the calculator of a friend).



--
Fabien ANDRE aka Xion345
Registered Linux User #418689



The last time I tried your function (without modifications), I haven't the result you have. Are you sure the function you have send is the last version you have ? Could you resent the function ? I'll send you a screencapture of the result on my calculator.

--
Thesa ~ Florian Birée
e-mail : florian.biree@xxxxxxxxx
Messagerie Instantanée Jabber/XMPP/Google Talk : florian.biree@xxxxxxxxx
Site web et blog : http://filyb.info/

Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/