Fez Touch Error in the display image


i have a problem when i load a image to my fez tocuh.
I make a easy example in the attached image.
In two words, the image has the first line instead of the last…

The image is 50x50 and is converted by FEZ Touch Image Converter, and i use Fez panda II.
the driver is: Enhanced FEZ Touch Driver


Which version of the driver are you using? In the optimized driver I posted a few months ago on the Codeshare I did fix a few things that caused a ‘off by one’ painting error like you are seeing.

Hi Jeff,
i take the driver version here…3 day ago:

OK, you are using the ‘latest’, can you post your code?

I think so… i only modify (in the driver) the method “ClearScreen(Color color)”…

public void ClearScreen(Color color)
                //FillRectangle(new Rectangle(0, 0, Width - 1, Height - 1), FEZ_Components.FEZTouch.Color.White);
                FillRectangle(new Rectangle(0, 0, Width, Height), color);

the zip file is: 390_390_FEZ_Touch_2_x.zip

and class “FEZTouchDriver.cs” as modify date 28/2/2012.
the class is too big for posting.

This the code;
i save the images generated from fez converter to sd and the load one a one…
have you need more code?

 public static void Menu()

            fezImage = new FT.Image(GetImmagine("info1"));
            fezTouch.DrawImage(5, 5, fezImage);
            fezImage = new FT.Image(GetImmagine("info2"));
            fezTouch.DrawImage(55, 5, fezImage);
            fezImage = new FT.Image(GetImmagine("info3"));
            fezTouch.DrawImage(5, 55, fezImage);
            fezImage = new FT.Image(GetImmagine("info4"));
            fezTouch.DrawImage(55, 55, fezImage);
private static byte[] GetImmagine(string nome)
            string rootDirectory = VolumeInfo.GetVolumes()[0].RootDirectory;
            FileStream FileHandle = new FileStream(rootDirectory + @ "\" + nome, FileMode.Open, FileAccess.Read);
            long lunghezza_messaggio = FileHandle.Length;
            byte[] data = new byte[lunghezza_messaggio];
            FileHandle.Read(data, 0, Convert.ToInt32(lunghezza_messaggio.ToString()));
            return data;

i do this patch… i replece the first row whit the last…it’s work fine but i think is not the good solution

private static void PatchImage(ref FT.Image fezImage)
byte[] array_last_row = new byte[fezImage.Width * 2];
int start_first_row = 8;
int start_last_row = 8 + fezImage.Width * fezImage.Height * 2 - fezImage.Width * 2;
array_last_row = Utility.ExtractRangeFromArray(fezImage.ImageBytes, start_last_row, fezImage.Width * 2);
Array.Copy(array_last_row, 0, fezImage.ImageBytes, start_first_row, fezImage.Width * 2);

When I was testing the driver I was using images stored as resources, not from the SD card. It is not clear to me if the issue is due to the way the image is being generated or the way it is being displayed. Can you email me the image file? birt_j@ soigeneris.com

Thanks for Valkyrie for emailing me his test image. The problem was that in certain orientations you have to change the cursor position after defining the drawing window. If you don’t then the first data written to the second row instead of the first. I fixed a couple of other little things and uploaded the new version to the Codeshare.

I found the easiest way to test for this problem was to create a 100x100 image that was black with one row of green pixels around the outer edge. When displayed on a red background at position (1, 1) it was easy to see if it was in the right position and that it was rendered properly.

Can work with EMX?

It’s for Fez Touch, which is not primarily focussed on EMX. Can Fez Touch work on EMX, it can probably be done. Whether you can or not is a matter of experience. What do you not get from existing software on EMX?

I used


      FEZ_Components.FEZTouch.LCDConfiguration lcdConfig = new FEZ_Components.FEZTouch.LCDConfiguration(
            new Cpu.Pin[8] { EMX.Pin.IO56, EMX.Pin.IO51, EMX.Pin.IO53, EMX.Pin.IO55, EMX.Pin.IO17, EMX.Pin.IO57, EMX.Pin.IO59, EMX.Pin.IO63 },