Draw a the background color on a rect optionally clearing the text.

    If clr is True the affected tiles are changed to space character.

    .. deprecated:: 8.5
        Use :any:`Console.rect` instead.
17442
def console_rect(
    con: tcod.console.Console,
    x: int,
    y: int,
    w: int,
    h: int,
    clr: bool,
    flag: int = BKGND_DEFAULT,
) -> None:
    
    lib.TCOD_console_rect(_console(con), x, y, w, h, clr, flag)
746134
def rect(self, x,y,w,h,style=''):
        ""
        if(style=='F'):
            op='f'
        elif(style=='FD' or style=='DF'):
            op='B'
        else:
            op='S'
        self._out(sprintf('%.2f %.2f %.2f %.2f re %s',x*self.k,(self.h-y)*self.k,w*self.k,-h*self.k,op))
1310788
function (rect) {
		var s = '';
		for (var n in rect) {
			s += (n + ':' + rect[n] + (isNaN(rect[n]) ? '; ' : 'px; '));
		}
		this.addStyles(s);
	}
1302201
def write_color(self, text, attr=None):
        '''
        '''
        log(u'write_color("%s", %s)' % (text, attr))
        chunks = self.terminal_escape.split(text)
        log(u'chunks=%s' % repr(chunks))
        bg = self.savebg
        n = 0 # count the characters we actually write, omitting the escapes
        if attr is None:#use attribute from initial console
            attr = self.attr
        try:
            fg = self.trtable[(0x000f&attr)]
            bg = self.trtable[(0x00f0&attr)>>4]
        except TypeError:
            fg = attr
            
        for chunk in chunks:
            m = self.escape_parts.match(chunk)
            if m:
                log(m.group(1))
                attr = ansicolor.get(m.group(1), self.attr)
            n += len(chunk)
            System.Console.ForegroundColor = fg
            System.Console.BackgroundColor = bg
            System.Console.Write(chunk)
        return n
667539
def foreground(color, content, readline=False):
    
    return encode(color, readline=readline) + content + encode(DEFAULT, readline=readline)
1150029
function writeGraphicCtrlExt() {
    out.writeByte(0x21); // extension introducer
    out.writeByte(0xf9); // GCE label
    out.writeByte(4); // data block size
    var transp;
    var disp;
    if (transparent === null) {
      transp = 0;
      disp = 0; // dispose = no action
    } else {
      transp = 1;
      disp = 2; // force clear if using transparent color
    }
    if (dispose >= 0) {
      disp = dispose & 7; // user override
    }
    disp <<= 2;
    // packed fields
    out.writeByte(0 | // 1:3 reserved
      disp | // 4:6 disposal
      0 | // 7 user input - 0 = none
      transp); // 8 transparency flag

    WriteShort(delay); // delay x 1/100 sec
    out.writeByte(transIndex); // transparent color index
    out.writeByte(0); // block terminator
  }
501140
def pickTextBackgroundColor(self):
        
        clr = QColorDialog.getColor(self.textBackgroundColor(),
                                    self.window(),
                                    'Pick Background Color')
        
        if clr.isValid():
            self.setTextBackgroundColor(clr)
895068
def _rect_to_css(rect):
    
    return rect.top(), rect.right(), rect.bottom(), rect.left()
168380
function(rect) {
        rect = rect || Crafty.viewport.rect();
        var q = Crafty.DebugCanvas.entities,
            i = 0,
            l = q.length,
            ctx = Crafty.DebugCanvas.context,
            current;

        var view = Crafty.viewport;
        ctx.setTransform(
            view._scale,
            0,
            0,
            view._scale,
            Math.round(view._x * view._scale),
            Math.round(view._y * view._scale)
        );

        ctx.clearRect(rect._x, rect._y, rect._w, rect._h);

        var lastLayer = null;
        for (; i < l; i++) {
            current = q[i];

            // If necessary, update the view transform to match the current entities layer
            // If the current entity has no layer, switch back to the viewport's transform
            if (lastLayer !== current._drawLayer) {
                if (current._drawLayer) {
                    view = current._drawLayer._viewportRect();
                    ctx.setTransform(
                        view._scale,
                        0,
                        0,
                        view._scale,
                        Math.round(-view._x * view._scale),
                        Math.round(-view._y * view._scale)
                    );
                } else {
                    view = Crafty.viewport;
                    ctx.setTransform(
                        view._scale,
                        0,
                        0,
                        view._scale,
                        Math.round(view._x * view._scale),
                        Math.round(view._y * view._scale)
                    );
                }
                lastLayer = current._drawLayer;
            }
            current.debugDraw(ctx);
        }
    }
320486
def rectangle(self, clear_screen=True, x1=10, y1=10, x2=80, y2=40, fill_color='black', outline_color='black'):
        

        if clear_screen:
            self.clear()

        return self.draw.rectangle((x1, y1, x2, y2), fill=fill_color, outline=outline_color)
1361892
def draw_rect(x, y, width, height, z, color, mode = :default)
      @@draw_pixel.draw x, y, z, width, height, color, mode

      nil
    end
677622
protected void drawLabelTextAndBackground(Canvas canvas, char[] labelBuffer, int startIndex, int numChars,
                                              int autoBackgroundColor) {
        final float textX;
        final float textY;

        if (isValueLabelBackgroundEnabled) {

            if (isValueLabelBackgroundAuto) {
                labelBackgroundPaint.setColor(autoBackgroundColor);
            }

            canvas.drawRect(labelBackgroundRect, labelBackgroundPaint);

            textX = labelBackgroundRect.left + labelMargin;
            textY = labelBackgroundRect.bottom - labelMargin;
        } else {
            textX = labelBackgroundRect.left;
            textY = labelBackgroundRect.bottom;
        }

        canvas.drawText(labelBuffer, startIndex, numChars, textX, textY, labelPaint);
    }
200828
def change_cell(self, x, y, ch, fg, bg):
        
        self.console.draw_char(x, y, ch, fg, bg)
840698
def draw(self):
        """"""

        self.context.set_source_rgb(*self._get_background_color())
        self.context.rectangle(*self.rect)
        self.context.fill()

        # If show frozen is active, show frozen pattern
        if self.view_frozen and self.cell_attributes[self.key]["frozen"]:
            self._draw_frozen_pattern()
1270836
def write_color_old( text, attr=None):
    
    '''
    res = []
    chunks = terminal_escape.split(text)
    n = 0 # count the characters we actually write, omitting the escapes
    if attr is None:#use attribute from initial console
        attr = 15
    for chunk in chunks:
        m = escape_parts.match(chunk)
        if m:
            for part in m.group(1).split(u";"):
                if part == u"0": # No text attribute
                    attr = 0
                elif part == u"7": # switch on reverse
                    attr |= 0x4000
                if part == u"1": # switch on bold (i.e. intensify foreground color)
                    attr |= 0x08
                elif len(part) == 2 and u"30" <= part <= u"37": # set foreground color
                    part = int(part)-30
                    # we have to mirror bits
                    attr = (attr & ~0x07) | ((part & 0x1) << 2) | (part & 0x2) | ((part & 0x4) >> 2)
                elif len(part) == 2 and u"40" <= part <= u"47": # set background color
                    part = int(part) - 40
                    # we have to mirror bits
                    attr = (attr & ~0x70) | ((part & 0x1) << 6) | ((part & 0x2) << 4) | ((part & 0x4) << 2)
                # ignore blink, underline and anything we don't understand
            continue
        n += len(chunk)
        if chunk:
            res.append((u"0x%x"%attr, chunk))
    return res
723157
def fill_rect(self, x, y, width, height, color):
        """"""
        # pylint: disable=too-many-arguments, too-many-boolean-expressions
        self.rect(x, y, width, height, color, fill=True)
739129
function (str, x, y, options, redraw) {
            if (typeof options === "undefined") { options = {}; }
            if (typeof redraw === "undefined") { redraw = false; }
            var defaults = {
                font: 'Helvetica',
                fontSize: 12,
                // lineWidth:  0.05,
                textColor: 'rgba(0, 0, 0, 1)'
            }, ctx, prop, opts;

            ctx = this.ctx;

            opts = MathLib.Canvas.convertOptions(MathLib.extendObject(defaults, options));

            for (prop in opts) {
                if (opts.hasOwnProperty(prop)) {
                    ctx[prop] = opts[prop];
                }
            }

            ctx.fillStyle = MathLib.colorConvert(options.textColor || options.color || defaults.textColor);
            ctx.strokeStyle = MathLib.colorConvert(options.textColor || options.color || defaults.textColor);

            ctx.font = opts.fontSize + 'px ' + opts.font;
            ctx.textAlign = 'center';
            ctx.textBaseline = 'middle';

            var tf = this.screen.transformation;

            ctx.save();
            ctx.transform(1 / tf[0][0], 0, 0, 1 / tf[1][1], 0, 0);
            ctx.fillText(str, tf[0][0] * x, tf[1][1] * y);
            ctx.restore();

            if (!redraw) {
                this.stack.push({
                    type: 'text',
                    object: str,
                    x: x,
                    y: y,
                    options: options
                });
            }

            return this;
        }