Class DrawUtils


  • public class DrawUtils
    extends Object
    Drawing utils class
    • Field Detail

      • SELECTION_BORDER_WIDTH

        public static final int SELECTION_BORDER_WIDTH
        Толщина рамки выделения.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DrawUtils

        public DrawUtils()
    • Method Detail

      • getSWTColor

        public static org.eclipse.swt.graphics.Color getSWTColor​(org.eclipse.swt.graphics.GC gc,
                                                                 Color ourColor)
        Получить цвет.
      • getSWTColor

        public static org.eclipse.swt.graphics.Color getSWTColor​(org.eclipse.swt.graphics.Device display,
                                                                 Color ourColor)
        Get swt color
        Parameters:
        display - Device
        ourColor - Color
        Returns:
        swt color
      • getSelectionColor

        public static Color getSelectionColor​(Color cellColor)
        Get cell selection color.
        Parameters:
        cellColor - cell background color
        Returns:
        color of the selected cell
      • getHeaderSelectionColor

        public static Color getHeaderSelectionColor​(Color headerColor)
        Get header selection color.
        Parameters:
        headerColor - header background color
        Returns:
        color of selected header
      • getActiveCellSelectionColor

        public static Color getActiveCellSelectionColor​(Color activeColor)
        Get active cell selection color.
        Parameters:
        activeColor - active cell background color, must not be null
        Returns:
        color of active cell selection, never null
      • getSelectionColor

        public static org.eclipse.swt.graphics.Color getSelectionColor​(org.eclipse.swt.graphics.Color color)
        Get cell selection color.
        Parameters:
        cellColor - cell background color
        Returns:
        color of the selected cell
      • getHeaderSelectionColor

        public static org.eclipse.swt.graphics.Color getHeaderSelectionColor​(org.eclipse.swt.graphics.Color headerColor)
        Get header selection color.
        Parameters:
        headerColor - header background color
        Returns:
        color of selected header
      • getActiveCellSelectionColor

        public static org.eclipse.swt.graphics.Color getActiveCellSelectionColor​(org.eclipse.swt.graphics.Color activeColor)
        Get active cell selection color.
        Parameters:
        activeColor - active cell background color, must not be null
        Returns:
        color of selected active cell selection, never null
      • prepareTextForDraw

        public static String prepareTextForDraw​(String str)
        Подготовить текст для отрисовки.
      • drawText

        public static org.eclipse.swt.graphics.Rectangle drawText​(org.eclipse.swt.graphics.GC gc,
                                                                  MoxelOutputDeviceInfo outputDeviceInfo,
                                                                  Font font,
                                                                  String text,
                                                                  org.eclipse.swt.graphics.Rectangle startRect,
                                                                  HorizontalAlignment align,
                                                                  int iangle,
                                                                  boolean mesureOnly,
                                                                  boolean noWrap,
                                                                  int indent,
                                                                  boolean calcHeight,
                                                                  UnitsConverter unitsConverter)
        Вывести текст.
        Parameters:
        gc -
        text -
        startRect -
        font -
        align -
        angle -
        mesureOnly -
        noWrap -
        clipRect -
        indent -
        calcHeight -
        Returns:
      • drawString

        public static void drawString​(org.eclipse.swt.graphics.GC gc,
                                      Font font,
                                      String text,
                                      int x,
                                      int y,
                                      int angle)
        Вывести строку.
      • getBottomVerticalMargin

        public static int getBottomVerticalMargin​(org.eclipse.swt.graphics.FontMetrics tm)
        Получить отступ снизу для метрик шрифта.
      • drawBorder

        public static void drawBorder​(org.eclipse.swt.graphics.GC gc,
                                      int x1,
                                      int y1,
                                      int x2,
                                      int y2,
                                      CellLine line,
                                      Color borderColor)
        Вывести линию.
      • drawHorizontalCellBorder

        public static void drawHorizontalCellBorder​(org.eclipse.swt.graphics.ImageData imageData,
                                                    int x1,
                                                    int x2,
                                                    int y,
                                                    CellLine line,
                                                    Color borderColor)
        Draw horizontal cell border
        Parameters:
        imageData - - image data to draw onto
        x1 - - beginning x-coord
        x2 - - ending x-coord
        y - = y-coord
        line - - cell line
        borderColor - - line color
      • drawVerticalCellBorder

        public static void drawVerticalCellBorder​(org.eclipse.swt.graphics.ImageData imageData,
                                                  int x,
                                                  int y1,
                                                  int y2,
                                                  CellLine line,
                                                  Color borderColor)
        Draw vertical cell border
        Parameters:
        imageData - - image data to draw onto
        x - - x-coord
        y1 - - beginning y-coord
        y2 - - ending y-coord
        line - - cell line
        borderColor - - line color
      • drawSelection

        public static void drawSelection​(org.eclipse.swt.graphics.GC gc,
                                         org.eclipse.swt.graphics.Rectangle selectionRectanglePixel,
                                         boolean[] sides)
        Отрисовать выделение.
        Parameters:
        sides - - какие стороны нужно отрисовывать. Лево, верх, право, низ.
      • drawDropSelection

        public static void drawDropSelection​(org.eclipse.swt.graphics.GC gc,
                                             org.eclipse.swt.graphics.Rectangle selectionRectanglePixel,
                                             boolean[] sides)
        Paint selection with 'drag selection' style.
        Parameters:
        gc - GC
        selectionRectanglePixel - selection rectangle
        sides - array of booleans, which sides are to be painted [left, top, right, bottom]
      • getDrawingLineAttributes

        public static org.eclipse.swt.graphics.LineAttributes getDrawingLineAttributes​(DrawingLine line)
        Create line atributes for drawing figures
        Parameters:
        line - - type of DrawingLine
        Returns:
        LineAttributes containg necessary line properties