/*********************************************************************
*
*       GUI_DispStringInRectEx
*/
void GUI_DispStringInRectEx(const char GUI_UNI_PTR *s, GUI_RECT* pRect, int TextAlign, int MaxLen, const GUI_ROTATION * pLCD_Api) {
  const GUI_ROTATION * pLCD_ApiOld;
  if (pLCD_Api == GUI_ROTATE_0) {
    /* Do nothing else but calling GUI_DispStringInRectMax if pLCD_Api == GUI_ROTATE_0 */
    GUI_DispStringInRectMax(s, pRect, TextAlign, MaxLen);
  } else {
    #if (!GUI_WINSUPPORT)
      GUI_RECT Rect_Old;
    #else
      const GUI_RECT * pOldClipRect = NULL;
    #endif
    GUI_RECT rClip, rText = {0};
    GUI_LOCK();
    /* Set the clip rectangle */
    if (pRect) {
      rText = *pRect;
      GUI_RectDispString = rText;
      #if (GUI_WINSUPPORT)
        pOldClipRect = WM_SetUserClipRect(pRect);
        if (pOldClipRect) {
          GUI__IntersectRects(&rClip, pRect, pOldClipRect);
          WM_SetUserClipRect(&rClip);
        }
      #else
        Rect_Old = GUI_Context.ClipRect;
        GUI__IntersectRects(&rClip, pRect, &Rect_Old);
        LCD_SetClipRectEx(&rClip);
      #endif
    }
    pLCD_ApiOld = _SetRotation(pLCD_Api);                /* Set the new function pointer for rotating text */
    pLCD_Api->pfRect2TextRect(&rText);                   /* Calculate the text rectangle */
    GUI__DispStringInRect(s, &rText, TextAlign, MaxLen); /* Display the string */
    /* Restore old clipping rectangle */
    #if (GUI_WINSUPPORT)
      WM_SetUserClipRect(pOldClipRect);
    #else
      LCD_SetClipRectEx(&Rect_Old);
    #endif
    _SetRotation(pLCD_ApiOld);
    GUI_UNLOCK();
  }
}
Exemplo n.º 2
0
/*********************************************************************
*
*       GUI_DispStringInRect
*/
void GUI_DispStringInRect(const char GUI_UNI_PTR *s, GUI_RECT* pRect, int TextAlign) {
  GUI_DispStringInRectMax(s, pRect, TextAlign, 0x7fff);
}