/*********************************************************************
*
*       _DrawMax
*/
static void _DrawMax(void) {
  GUI_RECT r;
  WM_GetInsideRect(&r);
  WM_ADDORG(r.x0, r.y0);
  WM_ADDORG(r.x1, r.y1);
  WM_ITERATE_START(&r); {
    LCD_DrawHLine(r.x0 + 1, r.y0 + 1, r.x1 - 1);
    LCD_DrawHLine(r.x0 + 1, r.y0 + 2, r.x1 - 1);
    LCD_DrawHLine(r.x0 + 1, r.y1 - 1, r.x1 - 1);
    LCD_DrawVLine(r.x0 + 1, r.y0 + 1, r.y1 - 1);
    LCD_DrawVLine(r.x1 - 1, r.y0 + 1, r.y1 - 1);
  } WM_ITERATE_END();
}
/*********************************************************************
*
*       GUI_DrawFocusRect
*/
void GUI_DrawFocusRect(const GUI_RECT *pRect, int Dist) {
  GUI_RECT r;
  GUI__ReduceRect(&r, pRect, Dist);
  GUI_LOCK();
  #if (GUI_WINSUPPORT)
    WM_ADDORG(r.x0, r.y0);
    WM_ADDORG(r.x1, r.y1);
    WM_ITERATE_START(&r); {
  #endif
    _DrawFocusRect(&r);
  #if (GUI_WINSUPPORT)
    } WM_ITERATE_END();
  #endif
  GUI_UNLOCK();
}
void GUI_DrawBitmapExp(int x0,    int y0,
                       int XSize, int YSize,
                       int XMul,  int YMul,
                       int BitsPerPixel, 
                       int BytesPerLine,
                       const U8* pData,
                       const GUI_LOGPALETTE* pPal)
{
  GUI_DRAWMODE PrevDraw;
  GUI_LOCK();
  PrevDraw = GUI_SetDrawMode((pPal && pPal->HasTrans) ? GUI_DRAWMODE_TRANS : 0);
  #if (GUI_WINSUPPORT)
    WM_ADDORG(x0,y0);
    {
      GUI_RECT r;
      r.x0 = x0;
      r.x1 = x0 + XSize * XMul -1;
      r.y0 = y0;
      r.y1 = y0 + YSize * YMul -1;
      WM_ITERATE_START(&r); {
  #endif
  LCD_DrawBitmap( x0, y0 ,XSize ,YSize, XMul, YMul
                 ,BitsPerPixel, BytesPerLine, pData, pPal);
  #if (GUI_WINSUPPORT)
      } WM_ITERATE_END();
    }
  #endif
  GUI_SetDrawMode(PrevDraw);
  GUI_UNLOCK();
}
/*********************************************************************
*
*       GUI_DrawBitmapEx
*/
void GUI_DrawBitmapEx(const GUI_BITMAP GUI_UNI_PTR * pBitmap, int x0, int y0,
                      int xCenter, int yCenter, int xMag, int yMag) {
  GUI_COLOR OldColor;
  #if (GUI_WINSUPPORT)
    GUI_RECT r;
  #endif
  GUI_LOCK();
  OldColor = GUI_GetColor();
  #if (GUI_WINSUPPORT)
    WM_ADDORG(x0, y0);
    if (xMag >= 0) {
      r.x0 = x0 + GUI__DivideRound32(((I32)(-xCenter) * (I32)(xMag)), 1000);
      r.x1 = x0 + GUI__DivideRound32(((I32)(pBitmap->XSize - xCenter - 1) * (I32)(xMag)), 1000);
    } else {
      r.x1 = x0 + GUI__DivideRound32(((I32)(-xCenter) * (I32)(xMag)), 1000);
      r.x0 = x0 + GUI__DivideRound32(((I32)(pBitmap->XSize - xCenter - 1) * (I32)(xMag)), 1000);
    }
    if (yMag >= 0) {
      r.y0 = y0 + GUI__DivideRound32(((I32)(-yCenter) * (I32)(yMag)), 1000);
      r.y1 = y0 + GUI__DivideRound32(((I32)(pBitmap->YSize - yCenter - 1) * (I32)(yMag)), 1000);
    } else {
      r.y1 = y0 + GUI__DivideRound32(((I32)(-yCenter) * (I32)(yMag)), 1000);
      r.y0 = y0 + GUI__DivideRound32(((I32)(pBitmap->YSize - yCenter - 1) * (I32)(yMag)), 1000);
    }
    WM_ITERATE_START(&r) {
  #endif
  GL_DrawBitmapEx(pBitmap, x0, y0, xCenter, yCenter, xMag, yMag);
  #if (GUI_WINSUPPORT)
    } WM_ITERATE_END();
  #endif
  GUI_SetColor(OldColor);
  GUI_UNLOCK();
}
Beispiel #5
0
void GUI_ClearRect(int x0, int y0, int x1, int y1) {
  GUI_DRAWMODE PrevDraw;
  GUI_LOCK();
  PrevDraw = LCD_SetDrawMode(GUI_DRAWMODE_REV);
  #if GUI_WINSUPPORT
    WM_ADDORG(x0,y0);
    WM_ADDORG(x1,y1);
    WM_ITERATE_START(NULL) {
  #endif
  LCD_FillRect(x0,y0,x1,y1);
  #if GUI_WINSUPPORT
    } WM_ITERATE_END();
  #endif
  LCD_SetDrawMode(PrevDraw);
  GUI_UNLOCK();
}
Beispiel #6
0
/*********************************************************************
*
*       _DispLine
*/
static void _DispLine(const U16 GUI_UNI_PTR *s, int Len, const GUI_RECT* pr) {
  GUI_RECT r;
  r = *pr;
  #if GUI_WINSUPPORT
  WM_ADDORG(r.x0,r.y0);
  WM_ADDORG(r.x1,r.y1);
  WM_ITERATE_START(&r) {
  #endif
     GUI_Context.DispPosX[GUI_Context.SelLayer] = r.x0;
     GUI_Context.DispPosY[GUI_Context.SelLayer] = r.y0;
     _DispLine_UC(s, Len, &r);    /* Do the actual drawing via routine call. */
  #if GUI_WINSUPPORT
  } WM_ITERATE_END();
  WM_SUBORG(GUI_Context.DispPosX[GUI_Context.SelLayer], GUI_Context.DispPosY[GUI_Context.SelLayer]);
  #endif
}
Beispiel #7
0
/*********************************************************************
*
*       GUI_FillRect
*/
void GUI_FillRect(int x0, int y0, int x1, int y1) {
  #if (GUI_WINSUPPORT)
    GUI_RECT r;
  #endif
  GUI_LOCK();
  #if (GUI_WINSUPPORT)
    WM_ADDORG(x0,y0);
    WM_ADDORG(x1,y1);
    r.x0 = x0; r.x1 = x1;
    r.y0 = y0; r.y1 = y1;
    WM_ITERATE_START(&r); {
  #endif
  LCD_FillRect(x0,y0,x1,y1);
  #if (GUI_WINSUPPORT)
    } WM_ITERATE_END();
  #endif
  GUI_UNLOCK();
}
/*********************************************************************
*
*       _DrawRestore
*/
static void _DrawRestore(void) {
  GUI_RECT r;
  int Size;
  WM_GetInsideRect(&r);
  WM_ADDORG(r.x0, r.y0);
  WM_ADDORG(r.x1, r.y1);
  Size = ((r.x1 - r.x0 + 1) << 1) / 3;
  WM_ITERATE_START(&r); {
    LCD_DrawHLine(r.x1 - Size, r.y0 + 1,        r.x1 - 1);
    LCD_DrawHLine(r.x1 - Size, r.y0 + 2,        r.x1 - 1);
    LCD_DrawHLine(r.x0 + Size, r.y0 + Size,     r.x1 - 1);
    LCD_DrawVLine(r.x1 - Size, r.y0 + 1,        r.y1 - Size);
    LCD_DrawVLine(r.x1 - 1,    r.y0 + 1,        r.y0 + Size);
    LCD_DrawHLine(r.x0 + 1,    r.y1 - Size,     r.x0 + Size);
    LCD_DrawHLine(r.x0 + 1,    r.y1 - Size + 1, r.x0 + Size);
    LCD_DrawHLine(r.x0 + 1,    r.y1 - 1,        r.x0 + Size);
    LCD_DrawVLine(r.x0 + 1,    r.y1 - Size,     r.y1 - 1);
    LCD_DrawVLine(r.x0 + Size, r.y1 - Size,     r.y1 - 1);
  } WM_ITERATE_END();
}
/* Note on usage of this routine:
   If at all possible, try to avoid using this, since
   every call will invoke the window manager. If possible,
   use the string routines.
*/
static void CL_DispChar(U16 c) {
  GUI_RECT r;
  WM_ADDORG(GUI_Context.DispPosX, GUI_Context.DispPosY);
  r.x1 = (r.x0 = GUI_Context.DispPosX) + GUI_GetCharDistX(c)-1;
  r.y1 = (r.y0 = GUI_Context.DispPosY) + GUI_GetFontSizeY()-1;
  WM_ITERATE_START(&r) {
    GL_DispChar(c);
    if (c != '\n')
      GUI_Context.DispPosX = r.x1 + 1;
  } WM_ITERATE_END();
  WM_SUBORG(GUI_Context.DispPosX,GUI_Context.DispPosY);
}
Beispiel #10
0
/*********************************************************************
*
*       GUI_DrawGraph
*/  
void GUI_DrawGraph(I16 *pay, int NumPoints, int x0, int y0) {
  GUI_LOCK();
  #if (GUI_WINSUPPORT)
    WM_ADDORG(x0,y0);
    WM_ITERATE_START(NULL); {
  #endif
  _DrawGraph(pay, NumPoints, x0, y0);
  #if (GUI_WINSUPPORT)
    } WM_ITERATE_END();
  #endif
  GUI_UNLOCK();
}
Beispiel #11
0
/*********************************************************************
*
*       GUI_DrawPie
*/
void GUI_DrawPie(int x0, int y0, int r, int a0, int a1, int Type) {
  GUI_LOCK();
  #if GUI_WINSUPPORT
    WM_ADDORG(x0,y0);
    WM_ITERATE_START(NULL) {
  #endif
  _DrawPie( x0, y0, r, a0, a1, Type);
  #if GUI_WINSUPPORT
    } WM_ITERATE_END();
  #endif
  GUI_UNLOCK();
}
Beispiel #12
0
/*********************************************************************
*
*       _DrawPolyLine
*/
static void _DrawPolyLine(const GUI_POINT * pPoints, int NumPoints, int x0, int y0) {
  unsigned PixelCnt;
  PixelCnt = 0;
  WM_ADDORG(x0,y0);
  WM_ITERATE_START(NULL); {
    GL_MoveTo(pPoints->x + x0, y0 - pPoints->y);
    while (--NumPoints >0) {
      pPoints++;
      GL_DrawLineToEx(pPoints->x + x0, y0 - pPoints->y, &PixelCnt);
    }
  } WM_ITERATE_END();
}
void GUI_DrawArc (int x0, int y0, int rx, int ry, int a0, int a1) {
  GUI_LOCK();
  #if (GUI_WINSUPPORT)
    WM_ADDORG(x0,y0);
    WM_ITERATE_START(NULL) {
  #endif
  GL_DrawArc( x0, y0, rx, ry, a0, a1);
  #if (GUI_WINSUPPORT)
    } WM_ITERATE_END();
  #endif
  GUI_UNLOCK();
}
Beispiel #14
0
void GUI_DrawPolyLine     (const GUI_POINT* pPoints, int NumPoints, int x0, int y0) {
  GUI_LOCK();
  #if (GUI_WINSUPPORT)
    WM_ADDORG(x0,y0);
    WM_ITERATE_START(NULL); {
  #endif
  _DrawPolyLine (pPoints, NumPoints, x0, y0);
  #if (GUI_WINSUPPORT)
    } WM_ITERATE_END();
  #endif
  GUI_UNLOCK();
}
Beispiel #15
0
/*********************************************************************
*
*       GUI_DrawPoint
*/
void GUI_DrawPoint(int x, int y) {
  GUI_LOCK();
  #if (GUI_WINSUPPORT)
    WM_ADDORG(x, y);
    WM_ITERATE_START(NULL); {
  #endif
  GL_DrawPoint(x, y);
  #if (GUI_WINSUPPORT)
    } WM_ITERATE_END();
  #endif
  GUI_UNLOCK();
}
Beispiel #16
0
/*********************************************************************
*
*       GUI_InvertRect
*/
void GUI_InvertRect(int x0, int y0, int x1, int y1) {
  GUI_DRAWMODE PrevDraw;
  #if (GUI_WINSUPPORT)
    GUI_RECT r;
  #endif
  GUI_LOCK();
  PrevDraw = GUI_SetDrawMode(GUI_DRAWMODE_XOR);
  #if (GUI_WINSUPPORT)
    WM_ADDORG(x0, y0);
    WM_ADDORG(x1, y1);
    r.x0 = x0;
    r.x1 = x1;
    r.y0 = y0;
    r.y1 = y1;
    WM_ITERATE_START(&r); {
  #endif
  LCD_FillRect(x0, y0, x1, y1);
  #if (GUI_WINSUPPORT)
    } WM_ITERATE_END();
  #endif
  GUI_SetDrawMode(PrevDraw);
  GUI_UNLOCK();
}
/*********************************************************************
*
*       GUI_JPEG_Draw
*/
int GUI_JPEG_Draw(const void * pFileData, int DataSize, int x0, int y0) {
  #if (GUI_WINSUPPORT)
    GUI_RECT r;
  #endif
  int Ret = 0;
  GUI_HMEM hBuffer = 0;
	struct jpeg_decompress_struct cinfo;
	struct jpeg_error_mgr jerr;
  GUI_LOCK();
  _Init(&jerr, &cinfo, pFileData, DataSize);
  #if (GUI_WINSUPPORT)
    WM_ADDORG(x0,y0);
    r.x1 = (r.x0 = x0) + cinfo.image_width - 1;
    r.y1 = (r.y0 = y0) + cinfo.image_height - 1;
    WM_ITERATE_START(&r) {
  #endif
    if (hBuffer) {
      _Init(&jerr, &cinfo, pFileData, DataSize);
    }
    /* 4. Set up parameters for decompression (optional ...) */
    /* 5. jpeg_start_decompress(...); Should normally return quickly */
	  jpeg_start_decompress(&cinfo);
    /* 6. while (scan lines remain to be read) */
	  /*     jpeg_read_scanlines(...); */
    if (!hBuffer) {
      hBuffer = GUI_ALLOC_AllocNoInit(cinfo.image_width * 3);
    }
    while (cinfo.output_scanline < cinfo.output_height) {
      U8* p;
      p = (U8*)GUI_ALLOC_h2p(hBuffer);
      jpeg_read_scanlines(&cinfo, &p, 1);
      if (cinfo.jpeg_color_space == JCS_GRAYSCALE) {
        _WritePixelsGray(p, x0, y0 + cinfo.output_scanline, cinfo.image_width);
      } else {
        _WritePixelsRGB(p, x0, y0 + cinfo.output_scanline, cinfo.image_width);
      }
    }
    /* 7. jpeg_finish_decompress(...); */
    /*    Complete the decompression cycle.  This causes working memory associated */
    /*    with the JPEG object to be released. */
	  jpeg_finish_decompress(&cinfo);
    /* 8. Release the JPEG decompression object. */
    jpeg_destroy_decompress(&cinfo);
  #if (GUI_WINSUPPORT)
    } WM_ITERATE_END();
  #endif
  GUI_ALLOC_Free(hBuffer);
  GUI_UNLOCK();
  return Ret;
}
Beispiel #18
0
/*********************************************************************
*
*       GUI_ClearRect
*/
void GUI_ClearRect(int x0, int y0, int x1, int y1) {
    GUI_DRAWMODE PrevDraw;
#if GUI_WINSUPPORT
    GUI_RECT r;
#endif
    GUI_LOCK();
    PrevDraw = LCD_SetDrawMode(GUI_DRAWMODE_REV);
#if GUI_WINSUPPORT
    WM_ADDORG(x0,y0);
    WM_ADDORG(x1,y1);
    r.x0 = x0;
    r.x1 = x1;
    r.y0 = y0;
    r.y1 = y1;
    WM_ITERATE_START(&r) {
#endif
        LCD_FillRect(x0,y0,x1,y1);
#if GUI_WINSUPPORT
    }
    WM_ITERATE_END();
#endif
    LCD_SetDrawMode(PrevDraw);
    GUI_UNLOCK();
}
Beispiel #19
0
/*********************************************************************
*
*       GUI_DrawPixel
*/
void GUI_DrawPixel(int x, int y) {
  #if (GUI_WINSUPPORT)
    GUI_RECT r;
  #endif
  GUI_LOCK();
  #if (GUI_WINSUPPORT)
    WM_ADDORG(x,y);
    r.x0 = r.x1 = x;
    r.y0 = r.y1 = y;
    WM_ITERATE_START(&r); {
  #endif
  LCD_HL_DrawPixel(x,y);
  #if (GUI_WINSUPPORT)
    } WM_ITERATE_END();
  #endif
  GUI_UNLOCK();
}
Beispiel #20
0
/*********************************************************************
*
*       GUI_DrawVLine
*/
void GUI_DrawVLine(int x0, int y0, int y1) {
  #if (GUI_WINSUPPORT)
    GUI_RECT r;
  #endif
  GUI_LOCK();
  #if (GUI_WINSUPPORT)
    WM_ADDORG(x0,y0);
    WM_ADDORGY(y1);
    r.x1 = r.x0 = x0;
    r.y0 = y0;
    r.y1 = y1;
    WM_ITERATE_START(&r); {
  #endif
  LCD_DrawVLine(x0, y0, y1);
  #if (GUI_WINSUPPORT)
    } WM_ITERATE_END();
  #endif
  GUI_UNLOCK();
}
Beispiel #21
0
/*********************************************************************
*
*       GUI_DrawHLine
*/
void GUI_DrawHLine(int y0, int x0, int x1) {
  #if (GUI_WINSUPPORT)
    GUI_RECT r;
  #endif
  GUI_LOCK();
  #if (GUI_WINSUPPORT)
    WM_ADDORG(x0,y0);
    WM_ADDORGX(x1);
    r.x0 = x0;
    r.x1 = x1;
    r.y1 = r.y0 = y0;
    WM_ITERATE_START(&r) {
  #endif
  LCD_HL_DrawHLine(x0, y0, x1);
  #if (GUI_WINSUPPORT)
    } WM_ITERATE_END();
  #endif
  GUI_UNLOCK();
}