Converts the relative position of @rect into an absolute position.To be 
        used for event considerations, blitting is handled directly by the 
        Container().
506385
def convert_rect(self, rect):
        '''
        
        '''
        return self.container.convert_rect(rect.move(self.pos))
923680
public boolean absolute(int position) {

        if (position < 0) {
            position += size;
        }

        if (position < 0) {
            beforeFirst();

            return false;
        }

        if (position > size) {
            afterLast();

            return false;
        }

        if (size == 0) {
            return false;
        }

        if (position < currentPos) {
            beforeFirst();
        }

        // go to the tagget row;
        while (position > currentPos) {
            next();
        }

        return true;
    }
619690
public void set(Rect src) {
        this.left = src.left;
        this.top = src.top;
        this.right = src.right;
        this.bottom = src.bottom;
    }
1122074
def handle_absolute(self, event):
        """"""
        point = self._get_absolute(event)
        x_pos = round(point.x)
        y_pos = round(point.y)
        x_event, y_event = self.emulate_abs(x_pos, y_pos, self.timeval)
        self.events.append(x_event)
        self.events.append(y_event)
317221
public void updateOptionBarPosition() {

        // only if attached to the DOM
        if ((m_elementOptionBar != null) && RootPanel.getBodyElement().isOrHasChild(getElement())) {
            int absoluteTop = getElement().getAbsoluteTop();
            int absoluteRight = getElement().getAbsoluteRight();
            CmsPositionBean dimensions = CmsPositionBean.getBoundingClientRect(getElement());

            int top = 0;
            int right = 0;
            int offsetLeft = 0;
            int offsetTop = 0;

            final Style style = m_elementOptionBar.getElement().getStyle();

            if (m_positioningInstructionParser.tryParse(getElement().getClassName())) {
                offsetLeft = m_positioningInstructionParser.getOffsetLeft();
                offsetTop = m_positioningInstructionParser.getOffsetTop();
            }

            if (Math.abs(absoluteTop - dimensions.getTop()) > 20) {
                absoluteTop = (dimensions.getTop() - absoluteTop) + 2;
                top = absoluteTop;
            }
            if (Math.abs(absoluteRight - dimensions.getLeft() - dimensions.getWidth()) > 20) {
                absoluteRight = (absoluteRight - dimensions.getLeft() - dimensions.getWidth()) + 2;
                right = absoluteRight;
            }

            top += offsetTop;
            right -= offsetLeft;

            if (top != 0) {
                style.setTop(top, Unit.PX);
            } else {
                style.clearTop();
            }

            if (right != 0) {
                style.setRight(right, Unit.PX);
            } else {
                style.clearRight();
            }

            if (isOptionbarIFrameCollision(absoluteTop, m_elementOptionBar.getCalculatedWidth())) {
                style.setPosition(Position.RELATIVE);
                int marginLeft = getElement().getClientWidth() - m_elementOptionBar.getCalculatedWidth();
                if (marginLeft > 0) {
                    style.setMarginLeft(marginLeft, Unit.PX);
                }
            } else {
                style.clearPosition();
                style.clearMarginLeft();
            }
        }
    }
505900
function positionRectangleInsideAnother(pos, a, b) {
    var aWidth = a.x2 - a.x1;
    var aHeight = a.y2 - a.y1;

    var bWidth = b.x2 - b.x1;
    var bHeight = b.y2 - b.y1;

    if (bHeight <= aHeight || bWidth <= aWidth) {
        return a;
    }

    var adjusted;
    switch (pos) {
        case "center":
            return {
                x1: a.x1 + (bWidth - aWidth)/2,
                x2: a.x2 + (bWidth - aWidth)/2,
                y1: a.y1 + (bHeight - aHeight)/2,
                y2: a.y2 + (bHeight - aHeight)/2
            };
        case "ne":
            return {
                x1: a.x1 + (bWidth - aWidth),
                x2: a.x2 + (bWidth - aWidth),
                y1: a.y1,
                y2: a.y2
            };
        case "se":
            return {
                x1: a.x1 + (bWidth - aWidth),
                x2: a.x2 + (bWidth - aWidth),
                y1: a.y1 + (bHeight - aHeight),
                y2: a.y2 + (bHeight - aHeight)
            };
        case "sw":
            return {
                x1: a.x1,
                x2: a.x2,
                y1: a.y1 + (bHeight - aHeight),
                y2: a.y2 + (bHeight - aHeight)
            };
        case "nw":
        default:
            return a;
    }

    return {}
}
856992
public int convertBoundaryToRelativePosition(int absolutePosition) {
        if (absolutePosition < lower || absolutePosition > upper)
            throw new IllegalArgumentException("Position outside this range (" + absolutePosition + ") this=" + this + ".");

        if (reversed)
            return upper - absolutePosition;
        else
            return absolutePosition - lower;
    }
1164359
function copy(rect) {
         return this.setShape(rect.pos.x, rect.pos.y, rect._width, rect._height);
       }
984023
def rect(self, x, y, width, height, color):
        
        self.context.set_source_rgb(*color)
        self.context.rectangle(self.tx(x), self.ty(y), self.tx(width), self.ty(height))
        self.context.fill()
1359972
function () {
        var self = this, style, rect;

        style = self.getEl().style;
        rect = self._layoutRect;

        style.left = rect.x + 'px';
        style.top = rect.y + 'px';
        style.zIndex = 0xFFFF + 0xFFFF;
      }
184616
function (dx, dy) {
        var self = this, rect = self.layoutRect();

        self.moveTo(rect.x + dx, rect.y + dy);

        return self;
      }
220582
function (renderer, layer, rect) {
            var tile;

            // get top-left and bottom-right tile position
            var startTile = this.pixelToTileCoords(
                rect.pos.x,
                rect.pos.y,
                me.pool.pull("me.Vector2d")
            );

            // Compensate for the layer position
            startTile.sub(layer.pos);

            // get top-left and bottom-right tile position
            var startPos = this.tileToPixelCoords(
                startTile.x + layer.pos.x,
                startTile.y + layer.pos.y,
                me.pool.pull("me.Vector2d")
            );

            var rowTile = startTile.clone();
            var rowPos = startPos.clone();

           /* Determine in which half of the tile the top-left corner of the area we
            * need to draw is. If we're in the upper half, we need to start one row
            * up due to those tiles being visible as well. How we go up one row
            * depends on whether we're in the left or right half of the tile.
            */
            var inUpperHalf = rect.pos.y - startPos.y < this.sideoffsety;
            var inLeftHalf = rect.pos.x - startPos.x < this.sideoffsetx;

            if (inUpperHalf) {
                startTile.y--;
            }
            if (inLeftHalf) {
                startTile.x--;
            }

            var endX = layer.cols;
            var endY = layer.rows;

            if (this.staggerX) {
                //ensure we are in the valid tile range
                startTile.x = Math.max(0, startTile.x);
                startTile.y = Math.max(0, startTile.y);

                startPos = this.tileToPixelCoords(
                    startTile.x + layer.pos.x,
                    startTile.y + layer.pos.y
                );

                var staggeredRow = this.doStaggerX(startTile.x + layer.pos.x);

                // main drawing loop
                for (; startPos.y < rect.bottom && startTile.y < endY; ) {
                    rowTile.setV(startTile);
                    rowPos.setV(startPos);

                    for (; rowPos.x < rect.right && rowTile.x < endX; rowTile.x+=2) {
                        tile = layer.layerData[rowTile.x][rowTile.y];
                        if (tile) {
                            // draw the tile
                            tile.tileset.drawTile(renderer, rowPos.x, rowPos.y, tile);
                        }
                        rowPos.x += this.tilewidth + this.sidelengthx;
                    }

                    if (staggeredRow) {
                        startTile.x -= 1;
                        startTile.y += 1;
                        startPos.x -= this.columnwidth;
                        staggeredRow = false;
                    } else {
                        startTile.x += 1;
                        startPos.x += this.columnwidth;
                        staggeredRow = true;
                    }

                    startPos.y += this.rowheight;
                }
                me.pool.push(rowTile);
                me.pool.push(rowPos);

            } else {
                //ensure we are in the valid tile range
                startTile.x = Math.max(0, startTile.x);
                startTile.y = Math.max(0, startTile.y);

                startPos = this.tileToPixelCoords(
                    startTile.x + layer.pos.x,
                    startTile.y + layer.pos.y
                );

                // Odd row shifting is applied in the rendering loop, so un-apply it here
                if (this.doStaggerY(startTile.y)) {
                    startPos.x -= this.columnwidth;
                }

                // main drawing loop
                for (; startPos.y < rect.bottom && startTile.y < endY; startTile.y++) {
                    rowTile.setV(startTile);
                    rowPos.setV(startPos);

                    if (this.doStaggerY(startTile.y)) {
                        rowPos.x += this.columnwidth;
                    }

                    for (; rowPos.x < rect.right && rowTile.x < endX; rowTile.x++) {
                        tile = layer.layerData[rowTile.x][rowTile.y];
                        if (tile) {
                            // draw the tile
                            tile.tileset.drawTile(renderer, rowPos.x, rowPos.y, tile);
                        }
                        rowPos.x += this.tilewidth + this.sidelengthx;
                    }
                    startPos.y += this.rowheight;
                }
                me.pool.push(rowTile);
                me.pool.push(rowPos);
            }

            me.pool.push(startTile);
            me.pool.push(startPos);
        }
770438
def __set_position(self):
        

        rectangle = hasattr(self.parent(), "viewport") and self.parent().viewport().rect() or self.parent().rect()
        if not rectangle:
            return

        self.adjustSize()

        if self.__anchor == 0:
            point_x = rectangle.width() / 2 - self.width() / 2
            point_y = self.__vertical_padding
        elif self.__anchor == 1:
            point_x = rectangle.width() - self.width() - self.__horizontal_padding
            point_y = self.__vertical_padding
        elif self.__anchor == 2:
            point_x = rectangle.width() - self.width() - self.__horizontal_padding
            point_y = rectangle.height() / 2 - self.height() / 2
        elif self.__anchor == 3:
            point_x = rectangle.width() - self.width() - self.__horizontal_padding
            point_y = rectangle.height() - self.height() - self.__vertical_padding
        elif self.__anchor == 4:
            point_x = rectangle.width() / 2 - self.width() / 2
            point_y = rectangle.height() - self.height() - self.__vertical_padding
        elif self.__anchor == 5:
            point_x = self.__horizontal_padding
            point_y = rectangle.height() - self.height() - self.__vertical_padding
        elif self.__anchor == 6:
            point_x = self.__horizontal_padding
            point_y = rectangle.height() / 2 - self.height() / 2
        elif self.__anchor == 7:
            point_x = self.__horizontal_padding
            point_y = self.__vertical_padding
        elif self.__anchor == 8:
            point_x = rectangle.width() / 2 - self.width() / 2
            point_y = rectangle.height() / 2 - self.height() / 2

        self.setGeometry(point_x + self.__horizontal_offset, point_y +
                                                             self.__vertical_offset, self.width(), self.height())
139496
public static void shiftToContain (Rectangle tainer, Rectangle tained)
    {
        if (tained.x < tainer.x) {
            tainer.x = tained.x;
        }
        if (tained.y < tainer.y) {
            tainer.y = tained.y;
        }
        if (tained.x + tained.width > tainer.x + tainer.width) {
            tainer.x = tained.x - (tainer.width - tained.width);
        }
        if (tained.y + tained.height > tainer.y + tainer.height) {
            tainer.y = tained.y - (tainer.height - tained.height);
        }
    }
349992
def rect(self):
        """"""
        CheckParent(self)

        val = _fitz.Link_rect(self)
        val = Rect(val)

        return val
524414
def fill_rect(framebuf, x, y, width, height, color):
        """"""
        # pylint: disable=too-many-arguments
        for _x in range(x, x+width):
            offset = 7 - _x & 0x07
            for _y in range(y, y+height):
                index = (_y * framebuf.stride + _x) // 8
                framebuf.buf[index] = (framebuf.buf[index] & ~(0x01 << offset)) \
                                      | ((color != 0) << offset)
558729
function(element) {
    var r = { x: element.offsetLeft, y: element.offsetTop };
    if (element.offsetParent) {
      var tmp = getAbsolutePosition(element.offsetParent);
      r.x += tmp.x;
      r.y += tmp.y;
    }
    return r;
  }