N18 Display Module Problems


I have the FEZ CerbuinoNet microntroller board and a N18 Display module. I am trying to get images greater then 50x50 to display onto the screen but I am having issues.

I have read up on some things and have found out that the memory of the board is not large enough to support anything larger then 50x50. I read that to accomplish this, you have to load the image as pieces and load one at a time to the desired location on the screen and dispose of the image before loading the next piece. Problem is that I tried that and it is not working.

What I did was this. I created a 50x50 bitmap object and loaded it with the bitmap file data from the resources of the entire application. I then used the Display.SimpleGraphics.DisplayImage() function to show the image. I would then just call Bitmap.Dispose(), then load another seperate copy of the resources image into a different Bitmap object and tried to draw it to the screen like the first time. Of course this doesn’t work. I also have tried to just use the displays standard Draw() and DrawRaw() methods like the GHI website example says to and no luck.

Is there another way to dispose of the bitmap from memory before loading the second image? I thought maybe by the time the code tries to run the code for loading the second image, garbage collection hasn’t fully disposed of the bitmap and memory has not been released yet.

        /// <summary>
        /// Sets up the user interface.
        /// </summary>
        private void SetupUI()
            Bitmap pic1 = Resources.GetBitmap(Resources.BitmapResources._50x50);
            Bitmap pic2;

            dspDisplay.SimpleGraphics.DisplayImage(pic1, 0, 0);

            pic2 = Resources.GetBitmap(Resources.BitmapResources._50x50);
            dspDisplay.SimpleGraphics.DisplayImage(pic2, 51, 0);

Welcome to the forum KinsonDigital !

This thread has some background that might be useful - I think your use of SimpleGraphics is your challenge, and if you re-use the bitmap you might also find some benefit.

I tried that already and it does not work either. I loaded the bitmap in the ProgramStarted() method first. In a timer tick event I have the code below. What do you mean SimpleGraphics is my challege? Should I be using Display.Draw() instread?

       dspDisplay.SimpleGraphics.DisplayImage(pic1, 0, 0);
       dspDisplay.SimpleGraphics.DisplayImage(pic1, 51, 0);

How and where is your pic1 defined?

pic1 is a class wide variable. I have it instantiated in the ProgramStarted() method. Or the method that is first ran when the program starts. The main() method if you want to call it.

like this…

pic1 = Resources.GetBitmap(Resources.BitmapResources._50x50);

what does “not working” mean? exception? out of memory? bad image?

@ KinsonDigital - Have you tried physically creating, say 4, images from the 50x50? If you are still running into problems, you may need to do that because the Resources.GetBitmap(Resources.BitmapResources._50x50); call is still allocating the entire bitmap array.

… and I don’t know where my link went, but this is the thread I was talking about.


SimpleGraphics uses another bitmap behind the scenes That is what is using your memory.

I will get an out of memory exception. I know why there is an out of memory exception, problem is that I want to be able to break that bitmap into pieces and display it. So if I had a 128x160 image which is the size of the screen, I can construct the image at that size in an image editor then break it up into pieces and put it together to show as one whole image.

One thing is how many 50x50 image resources can I add to the project?