Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FEATURE REQUEST EVE Image vs Tft objects
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:

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.
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:

 tft = display.TFT()
 empire=eve.Image("/flash/empire1.jpg",0 ,eve.IMG_JPG)
 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)
 empire.ellipse(260,95, 30,30,3,eve.YELLOW,eve.YELLOW)

 eve.text(250,100,"hello Rotated",font=34,rot=30)

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.

Forum Jump:

Users browsing this thread: 1 Guest(s)