Get viewport orientation from given width and height.

    :type width: int
    :type height: int
    :return: viewport orientation enum
    :rtype: Orientation
328668
def get_orientation(width, height):
    # type: (int, int) -> Orientation
    
    if width > height:
        return Orientation.LANDSCAPE
    elif width < height:
        return Orientation.PORTRAIT
    else:
        return Orientation.EQUAL
995744
public Rectangle getViewport() {
		@SuppressWarnings("unchecked")
		Map<String, Number> result = (Map<String, Number>) executeScript(JS_GET_VIEWPORT);
		int width = result.get("width").intValue();
		int height = result.get("height").intValue();
		Rectangle viewport = new Rectangle(0, 0, height, width, width, height);
		LOGGER.info("Viewport rectangle: {}", viewport);
		return viewport;
	}
685406
def on_resize(width, height):
	""""""
	glViewport(0, 0, width, height)
	glMatrixMode(GL_PROJECTION)
	glLoadIdentity()
	gluPerspective(30, 1.0*width/height, 0.1, 1000.0)
	glMatrixMode(GL_MODELVIEW)
	glLoadIdentity()
386634
function pageViewPortSize(options) {
        return {
            width: def(options.width, DEF_WIDTH),
            height: def(options.height, DEF_HEIGHT)
        };
    }
997016
def _get_windows_console_width() -> int:
    
    from ctypes import byref, windll
    import pyreadline

    out = windll.kernel32.GetStdHandle(-11)
    info = pyreadline.console.CONSOLE_SCREEN_BUFFER_INFO()
    windll.kernel32.GetConsoleScreenBufferInfo(out, byref(info))
    return info.dwSize.X
43722
def getPositionAndSize(self):
        '''
        
        '''

        (x, y) = self.getXY();
        w = self.getWidth()
        h = self.getHeight()
        return (x, y, w, h)
311189
def resize(self, width, height):
        
        self.width = width
        self.height = height
        self.buffer_width, self.buffer_height = self.width, self.height
        self.set_default_viewport()

        super().resize(self.buffer_width, self.buffer_height)
353678
def getWidth(self):
        
        width = 0
        if self.__width:
            width = sum( abs(x) for x in self.__width )
            width = width + len(self.__width) * len(self.__sep) + 1
        return width
502553
def get_width():
    """"""
    # Get terminal size
    ws = struct.pack("HHHH", 0, 0, 0, 0)
    ws = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, ws)
    lines, columns, x, y = struct.unpack("HHHH", ws)
    width = min(columns * 39 // 40, columns - 2)
    return width
1182592
def getTopRight(self):
        
        return (float(self.get_x()) + float(self.get_width()), float(self.get_y()) + float(self.get_height()))
367863
def get_width(self):
        
        areas = self._get_areas()
        widths = numpy.array([surf.get_width() for surf in self.surfaces])

        return numpy.sum(areas * widths) / numpy.sum(areas)
1371018
def get_screen_resolution(self):
        """"""
        widget = QDesktopWidget()
        geometry = widget.availableGeometry(widget.primaryScreen())
        return geometry.width(), geometry.height()
256626
def get_console_width():
    

    if os.name == 'nt':
        STD_INPUT_HANDLE = -10
        STD_OUTPUT_HANDLE = -11
        STD_ERROR_HANDLE = -12

        # get console handle
        from ctypes import windll, Structure, byref
        try:
            from ctypes.wintypes import SHORT, WORD, DWORD
        except ImportError:
            # workaround for missing types in Python 2.5
            from ctypes import (
                c_short as SHORT, c_ushort as WORD, c_ulong as DWORD)
        console_handle = windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE)

        # CONSOLE_SCREEN_BUFFER_INFO Structure
        class COORD(Structure):
            _fields_ = [("X", SHORT), ("Y", SHORT)]

        class SMALL_RECT(Structure):
            _fields_ = [("Left", SHORT), ("Top", SHORT),
                        ("Right", SHORT), ("Bottom", SHORT)]

        class CONSOLE_SCREEN_BUFFER_INFO(Structure):
            _fields_ = [("dwSize", COORD),
                        ("dwCursorPosition", COORD),
                        ("wAttributes", WORD),
                        ("srWindow", SMALL_RECT),
                        ("dwMaximumWindowSize", DWORD)]

        sbi = CONSOLE_SCREEN_BUFFER_INFO()
        ret = windll.kernel32.GetConsoleScreenBufferInfo(
            console_handle, byref(sbi))
        if ret == 0:
            return 0
        return sbi.srWindow.Right + 1

    elif os.name == 'posix':
        from fcntl import ioctl
        from termios import TIOCGWINSZ
        from array import array

        winsize = array("H", [0] * 4)
        try:
            ioctl(sys.stdout.fileno(), TIOCGWINSZ, winsize)
        except IOError:
            pass
        return (winsize[1], winsize[0])[0]

    return 80
1328483
def viewbox(self):
        
        return self.left, self.top, self.right, self.bottom
599025
def _get_rightMargin(self):
        
        bounds = self.bounds
        if bounds is None:
            return None
        xMin, yMin, xMax, yMax = bounds
        return self.width - xMax
1190813
function (width, height) {
                /** @type {?} */
                var ratio = width / height;
                /** @type {?} */
                var maxWidth = this.screenDimensions.width > this.maxPreviewWidth ?
                    this.maxPreviewWidth : this.screenDimensions.width - 40;
                /** @type {?} */
                var maxHeight = this.screenDimensions.height - 240;
                /** @type {?} */
                var calculated = {
                    width: maxWidth,
                    height: Math.round(maxWidth / ratio),
                    ratio: ratio
                };
                if (calculated.height > maxHeight) {
                    calculated.height = maxHeight;
                    calculated.width = Math.round(maxHeight * ratio);
                }
                return calculated;
            }
1216398
function (element, orientation) {
            if (element.style && element.color) {
                if (orientation == "V") {
                    return element.leftWidth + element.rightWidth;
                } else if (orientation == "H") {
                    return element.topWidth + element.bottomWidth;
                }
            }
            return 0;
        }