Main Site Documentation

FEZ Touch rectangle fill vs. image


#1

I finally got my Tinkerer kit assembled today (had it for months) and have been playing with trying to improve the FEZ Touch display response. I was surprised how slow it was when drawing eight 10x10 rectangles to represent LEDs to the screen so I started by trying to tweak FillRectangle. I was able to improve it a little and slightly improve the time to fill the who screen from 298ms to 257ms.

When displaying 8 individual 10x10 rectangles with FillRectangle it took about 520ms.

I then created a 10x10 image and added to the resources file. The time to display eight of the 10x10 images was 64ms!

When you look at all the buffer shuffling that has to take place for FillRectangle and compare it to DrawImage it is easy to see why using an image is much faster. The downside is that you are using more flash and the image size is fixed. Still for things like LEDs, Radio Buttons, etc it seems like it might be the way to go.


#2

Yeah there are some buffer issues with the example provided…I should run a test on Spiral and see how it stacks up to your numbers.


#3

The image is directly flushed to the screen with no processing.
FillRect has to fill a buffer first with the needed color…Maybe it should be split into SetRectangleColor that does any needed processing and FlushRectangle that is similar to image drawing.


#4

That would work iif you needed multiple of the same graphic as I did in this test case. It would also be possible to dynamically create image objects at run time for common resued grahics, but that would take precious RAM. I’m guessing that ‘predefining’ the most used graphics items as static arrays or images would be of the most benifit.


#5

I just did a quick test by using images instead of rectangle fills for a slider control. This was quickly added to the TouchUIControl code on Fezzer. The difference is response speed is dramatic. Using images the slider moves as fast as I can move my finger with no flickering.

Mike, you might be right in that having a method to simply flush a buffer, like the Image class does, could be a big help in some cases. It might also be just as easy to be able to ‘draw’ to an image and then the image can be uses as many times as needed.

Creating the Image at run time uses RAM whilst adding images as static arrays or as resources lets you use flash. Both methods would be useful in different cases though.