Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FEATURE REQUEST EVE Image vs Tft objects
#1
If there is ever a major rework of the EVE module, I would like to propose that the Image and the Tft objects be merged into a single "Canvas" class, for the following reasons:

--They are basically similar, and there are no conflicting methods.
--If they both used eve.image(), one would be able to use all present and future features of this command (scale, wrap, filter, rotate...) with images created with Tft.
--Tft commands could be used to draw over images.
--It would significantly simplify the module code.

I have modified the Image constructor such that when it is called with a null filename, it creates an empty image. E.g.:

i=eve.Image("", 0, eve.IMG_RAW, eve.IMG_RGB332, 300, 100)

creates an empty image of the specified size.

I currently use such null images to draw using eve.memWrite as described here:
https://loboris.eu/forum/showthread.php?tid=1005&pid=2382#pid2382

I may get around to modding the Tft library to get it to write to images. If so, I don't see any point in maintaining the current Tft object.

Just a thought.
Reply
#2
So, I did a quick and dirty rework of the TFT library as per above -- adding all the TFT methods to the Image object. It works very well.

The following code:

Code:
 tft = display.TFT()
 empire=eve.Image("/flash/empire1.jpg",0 ,eve.IMG_JPG)
 canvas=eve.Image("",0,eve.IMG_RAW,eve.IMG_RGB332,100,100)

 canvas.select()
 canvas.circle(10,10,10,eve.RED,eve.BLUE)
 canvas.arc(40, 40, 20, 8, 20, 330,eve.GREEN,eve.GREEN)
 canvas.arc(40, 40, 20, 8, 330, 20,eve.RED,eve.RED)
 canvas.font(tft.FONT_Default, transparent=True)
 canvas.text(10,60,"Hello",eve.RED)
 canvas.deselect()

 empire.select()
 empire.ellipse(260,95, 30,30,3,eve.YELLOW,eve.YELLOW)
 empire.rect(130,0,50,192,eve.WHITE)
 empire.rect(131,1,48,191,eve.WHITE)

 eve.startlist()
 eve.clear(eve.LIGHTGREY)
 eve.color(eve.WHITE)
 eve.image(450,40,canvas)
 eve.image(400,200,canvas,scale=2.,rotate=-20)
 eve.image(50,400,canvas,scalex=1.5,scaley=.5,rotate=-20)
 eve.color(eve.DARKGREY)
 eve.text(250,100,"hello Rotated",font=34,rot=30)
 eve.color(eve.WHITE)
 eve.image(100,100,empire,rotate=-120)
 eve.image(600,40,empire,scale=.5)
 eve.endlist()

produces the following screen:

   

As shown, one can use the TFT commands either to create a new image, or to annotate an existing one. Then, the eve.image() features such as scaling and the "rotate" operation that I added can be applied.  The image also shows a "rotated text" feature that I added awhile ago.

My Github skills are not up to creating a fork, but I would be glad to share the modified code with anyone who might find it useful.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)