Class ImagePainter

    • Field Detail

      • calculateByWidth

        protected boolean calculateByWidth
      • calculateByHeight

        protected boolean calculateByHeight
    • Constructor Detail

      • ImagePainter

        public ImagePainter​(org.eclipse.swt.graphics.Image image)
        Creates an ImagePainter that renders the provided image.
        Parameters:
        image - The image to render.
      • ImagePainter

        public ImagePainter​(boolean paintBg)
        Creates an ImagePainter that retrieves the image to render from the IConfigRegistry.
        Parameters:
        paintBg - true if the cell background should be painted by this painter, false if it should be skipped.
        Since:
        1.4
      • ImagePainter

        public ImagePainter​(org.eclipse.swt.graphics.Image image,
                            boolean paintBg)
        Creates an ImagePainter that renders the provided image.
        Parameters:
        image - The image to render.
        paintBg - true if the cell background should be painted by this painter, false if it should be skipped.
    • Method Detail

      • getPreferredWidth

        public int getPreferredWidth​(ILayerCell cell,
                                     org.eclipse.swt.graphics.GC gc,
                                     IConfigRegistry configRegistry)
        Description copied from interface: ICellPainter
        Get the preferred width of the cell when rendered by this painter. Used for auto-resize.
        Specified by:
        getPreferredWidth in interface ICellPainter
        Overrides:
        getPreferredWidth in class CellPainterWrapper
        Parameters:
        cell - The cell for which the preferred width is requested.
        gc - The GC that is used for rendering.
        configRegistry - The IConfigRegistry that contains the configuration used for rendering.
        Returns:
        The preferred width of the given cell when rendered by this painter.
      • getPreferredHeight

        public int getPreferredHeight​(ILayerCell cell,
                                      org.eclipse.swt.graphics.GC gc,
                                      IConfigRegistry configRegistry)
        Description copied from interface: ICellPainter
        Get the preferred height of the cell when rendered by this painter. Used for auto-resize.
        Specified by:
        getPreferredHeight in interface ICellPainter
        Overrides:
        getPreferredHeight in class CellPainterWrapper
        Parameters:
        cell - The cell for which the preferred height is requested.
        gc - The GC that is used for rendering.
        configRegistry - The IConfigRegistry that contains the configuration used for rendering.
        Returns:
        The preferred height of the given cell when rendered by this painter.
      • isCalculateByWidth

        public boolean isCalculateByWidth()
        Returns:
        true if this ImagePainter is resizing the cell width to show the whole configured image, false if the cell width is not touched by this painter.
      • setCalculateByWidth

        public void setCalculateByWidth​(boolean calculateByWidth)
        Configure whether the ImagePainter should calculate the cell dimensions by containing image width. This means the width of the cell is calculated by image width.
        Parameters:
        calculateByWidth - true to calculate and modify the cell dimension according to the image width, false to not modifying the cell dimensions.
      • isCalculateByHeight

        public boolean isCalculateByHeight()
        Returns:
        true if this ImagePainter is resizing the cell height to show the whole configured image, false if the cell height is not touched by this painter.
      • setCalculateByHeight

        public void setCalculateByHeight​(boolean calculateByHeight)
        Configure whether the ImagePainter should calculate the cell dimensions by containing image height. This means the height of the cell is calculated by image height.
        Parameters:
        calculateByHeight - true to calculate and modify the cell dimension according to the image height, false to not modifying the cell dimensions.