Package ilcd
Class Draw
Public Method drawRectangle
static void drawRectangle(int mode, int width, int height)
Throws:
_INSERT_METHOD_SIGNATURE_HERE_
Description:
Parameter |
Range |
Description |
mode |
Bit 0 ... 7 |
flags for the rectangle properties |
width |
1 ... display width |
width of the rectangle |
height |
1 ... display height |
height of the rectangle |
Draws a rectangle starting from the current cursor position to the ending point specified via width and height. The parameter mode allows to set several properties for the rectangle:
mode |
RECTANGLE_ROUNDED_CORNERS |
RECTANGLE_DROP_SHADOW |
RECTANGLE_SOUROUNDED_WITH_BACKGROUND_COLOR |
RECTANGLE_FILLED_WITH_BACKGROUND_COLOR |
RECTANGLE_USE_FOREGROUND_COLOR_FOR_FILLING (bit 3 must be set too) |
RECTANGLE_FILLED_WITH_CURRENT_FILL_PATTERN (bits 3 and 4 ignored if set) |
RECTANGLE_DRAW_WITHOUT_FRAME |
RECTANGLE_ALPHA_BLENDING_FOR_SHADOW_ONLY |
Note
- If mode RECTANGLE_DRAW_WITHOUT_FRAME is not set, the rectangle frame is drawn with the current border color (see Attribute.setBorderColor(int)). If the line thickness is greater than 1 (refer to Attribute.setLineThickness(int)), the lines of the rectangle expand to both sides of the specified corner points.
- By default, alpha blending is done for every activated feature (frame, filling, shadow). When mode RECTANGLE_ALPHA_BLENDING_FOR_SHADOW_ONLY is set, the shadow will still be drawn with alpha blending, but frame and filling will have full opacity (refer to Attribute.setAlpha(int)).
- The rectangle frame is drawn with regard to the current line style (see Attribute.setLineStyle(int)) only if the corner radius and alpha are set to their default values (refer to Attribute.setRectangleCornerRadius(int) and Attribute.setAlpha(int)).
- If mode DROP_SHADOW is set, the drop shadow is drawn with the border shadow color (see Attribute.setBorderShadowColor(int)) with regard to the current shadow offset (see Attribute.setShadowOffset(int, int)). If the offset leads to a negative left/upper corner of the shadow rectangle, no shadow will be drawn.
- When filling with a pattern (mode RECTANGLE_FILLED_WITH_CURRENT_FILL_PATTERN), the fill pattern has to be set in advance via Attribute.setFillingColor(int), Attribute.setFillingGradient(int, int, int, int) or Attribute.setFillingTile(int). When filling with a tile graphic, any previously set adjustments for graphics are taken into account (see Attribute.setAdjustmentForGraphics(int)).
- When the rounded corners flag (mode RECTANGLE_ROUNDED_CORNERS) is set, the attribute rectangle corner radius is taken into account (see Attribute.setRectangleCornerRadius(int)). If the corner radius exceeds half of the rectangle width and/or height, the flag is ignored and a rectangle without rounded corners is drawn.
- The surrounding line (mode RECTANGLE_SURROUNDED_WITH_BACKGROUND_COLOR) is only drawn when corner radius and alpha are set to their default values (refer to Attribute.setRectangleCornerRadius(int) and Attribute.setAlpha(int)) and a frame is drawn (mode RECTANGLE_DRAW_WITHOUT_FRAME is not set).
- Filling with a fill pattern as well as drawing without a frame (mode RECTANGLE_FILLED_WITH_CURRENT_FILL_PATTERN and RECTANGLE_DRAW_WITHOUT_FRAME) are supported by firmware versions 4.20 and higher. In previous versions, those bits are ignored.
Draw.drawRectangle(Draw.RECTANGLE_ROUNDED_CORNERS |
Draw.RECTANGLE_DROP_SHADOW,
50, 30);
Draws a rectangle with a width of 50 pixels and a height of 30 pixels at the actual cursor position. Moreover, the rectangle has rounded corners and a drop shadow.
See also:
Copyright © demmel products gmbh. All rights reserved.