Go Down

Topic: Background DTX1 Screen Image (Read 44 times) previous topic - next topic

leydar

Aug 26, 2015, 04:58 pm Last Edit: Sep 01, 2015, 10:40 pm by leydar
Hi

I'm using the FT801 graphics chip to talk to a 480*272px TFT screen. I want to load a full background image. With the standard image importer doing so uses all of the available 256kb of graphics RAM. I have therefore split the image using a png2dtx1 converter. The output is 4 raw compressed image files. I managed to load these from memory and reassemble the image following instructions online.

The problem is that redrawing the background in the Loop function replaces the image after the first iteration with garbage. I figure the RAM is being overwritten and the memory locations are no longer viable. Is there any way of loading the image and storing it in a variable for the repaints?

Here is the code that draws the screen:

Code: [Select]

  FTImpl.DLStart();
  FTImpl.ColorRGB(255, 255, 255);
  FTImpl.SaveContext();
  FTImpl.BitmapHandle(0);
  FTImpl.BitmapSource(0);
  FTImpl.BitmapLayout(FT_L1, 60, 272);
  FTImpl.BitmapSize(FT_NEAREST,FT_BORDER,FT_BORDER, 480, 272);
  FTImpl.BitmapHandle(2);
  FTImpl.BitmapSource(32640);
  FTImpl.BitmapLayout(FT_RGB565, 240, 68);
  FTImpl.BitmapSize(FT_NEAREST,FT_BORDER,FT_BORDER, 480, 272);
  FTImpl.Begin(FT_BITMAPS);
  FTImpl.BlendFunc(FT_ONE,FT_ZERO);
  FTImpl.ColorA(85);
  FTImpl.Vertex2ii(0, 0, 0, 0);
  FTImpl.BlendFunc(FT_ONE,FT_ONE);
  FTImpl.ColorA(170);
  FTImpl.Vertex2ii(0, 0, 0, 1);
  FTImpl.ColorMask(1, 1, 1, 0);
  FTImpl.Cmd_Scale(262144, 262144);
  FTImpl.Cmd_SetMatrix();
  FTImpl.BlendFunc(FT_DST_ALPHA,FT_ZERO);
  FTImpl.Vertex2ii(0, 0, 2, 1);
  FTImpl.BlendFunc(FT_ONE_MINUS_DST_ALPHA,FT_ONE);
  FTImpl.Vertex2ii(0, 0, 2, 0);
  FTImpl.End();
  FTImpl.RestoreContext();
  FTImpl.Display();
  FTImpl.Cmd_Swap();
  FTImpl.DLEnd();
  FTImpl.Finish();


Stephen

leydar

By adding the command FTImpl.Cmd_LoadIdentity(); just before the FTImpl.RestoreContext(); it repaints perfectly :)

Stephen

Go Up