The shape of the Texture/RenderBuffer attached to this FrameBuffer
492487
def shape(self):
        
        if self.color_buffer is not None:
            return self.color_buffer.shape[:2]  # in case its a texture
        if self.depth_buffer is not None:
            return self.depth_buffer.shape[:2]
        if self.stencil_buffer is not None:
            return self.stencil_buffer.shape[:2]
        raise RuntimeError('FrameBuffer without buffers has undefined shape')
363589
function generateDebugBody( body ) {

		var frameUnit           = 2;// In pixels
		var debugBody           = Crafty.e( RenderingMode );
        var debugBodyBody       = Crafty.e( RenderingMode + ', Color' );
        var debugBodyTopFrame   = Crafty.e( RenderingMode + ', Color' );
		var debugBodyRightFrame = Crafty.e( RenderingMode + ', Color' );
        var debugBodyDownFrame  = Crafty.e( RenderingMode + ', Color' );
        var debugBodyLeftFrame  = Crafty.e( RenderingMode + ', Color' );

		debugBody.attach( debugBodyBody );
		debugBody.attach( debugBodyTopFrame );
		debugBody.attach( debugBodyRightFrame );
		debugBody.attach( debugBodyDownFrame );
		debugBody.attach( debugBodyLeftFrame );

		// TODO cleaner code.
		var attr = {
			x: body.vertices[ 0 ].x,
			y: body.vertices[ 0 ].y,
			w: body.vertices[ 0 ].x,
			h: body.vertices[ 0 ].y
		};

		//We iterate to have a square shape for circles and polygons/
		for ( var i = 1; i < body.vertices.length; i++ ) {
			if ( body.vertices[ i ].x < attr.x ) {
				attr.x = body.vertices[ i ].x;
			}

			if ( body.vertices[ i ].y < attr.y ) {
				attr.y = body.vertices[ i ].y;
			}

			if ( body.vertices[ i ].x > attr.w ) {
				attr.w = body.vertices[ i ].x;
			}

			if ( body.vertices[ i ].y > attr.h ) {
				attr.h = body.vertices[ i ].y;
			}
		}

		debugBody.attr( {
			x: attr.x,
			y: attr.y,
			w: Math.abs( attr.w - attr.x ),
			h: Math.abs( attr.h - attr.y )
		} );

		debugBody.origin( 'center' );

		debugBodyBody.color( 'blue' );
		debugBodyBody.alpha = 0.5;
		debugBodyBody.z = debugBody._z + 1;
		debugBodyBody.origin( 'center' );

		debugBodyTopFrame.color( 'blue' );
		debugBodyTopFrame.h = frameUnit;
		debugBodyTopFrame.z = debugBody._z + 1;
		debugBodyTopFrame.origin( 'center' );

		debugBodyRightFrame.color( 'blue' );
		debugBodyRightFrame.x = debugBodyBody._x + ( debugBodyBody._w - frameUnit );
		debugBodyRightFrame.w = frameUnit;
		debugBodyRightFrame.z = debugBody._z + 1;
		debugBodyRightFrame.origin( 'center' );

		debugBodyDownFrame.color( 'blue' );
		debugBodyDownFrame.y = debugBodyBody._y + ( debugBodyBody._h - frameUnit );
		debugBodyDownFrame.h = frameUnit;
		debugBodyDownFrame.z = debugBody._z + 1;
		debugBodyDownFrame.origin( 'center' );

		debugBodyLeftFrame.color( 'blue' );
		debugBodyLeftFrame.w = frameUnit;
		debugBodyLeftFrame.z = debugBody._z + 1;
		debugBodyLeftFrame.origin( 'center' );

		return debugBody;
	}
812030
def shape(self):
        """"""

        # Create C variables that will serve as out parameters for TCMPS.
        shape_ptr = _ctypes.POINTER(_ctypes.c_size_t)()  # size_t* shape_ptr
        dim = _ctypes.c_size_t()                         # size_t dim

        # Obtain pointer into memory owned by the C++ object self.handle.
        status_code = self._LIB.TCMPSGetFloatArrayShape(
            self.handle, _ctypes.byref(shape_ptr), _ctypes.byref(dim))
        assert status_code == 0, "Error calling TCMPSGetFloatArrayShape"

        return _shape_tuple_from_ctypes(shape_ptr, dim)
1247909
def shade(renderbuffer, bufferbbox, img3d, bbox):
  """"""

  if not Bbox.intersects(bufferbbox, bbox):
    return

  spt = max2(bbox.minpt, bufferbbox.minpt)
  ept = min2(bbox.maxpt, bufferbbox.maxpt)

  ZERO3 = Vec(0,0,0)

  istart = max2(spt - bbox.minpt, ZERO3)
  iend = min2(ept - bbox.maxpt, ZERO3) + img3d.shape[:3]

  rbox = Bbox(spt, ept) - bufferbbox.minpt
  if len(img3d.shape) == 3:
    img3d = img3d[ :, :, :, np.newaxis]
  
  renderbuffer[ rbox.to_slices() ] = img3d[ istart.x:iend.x, istart.y:iend.y, istart.z:iend.z, : ]
1220752
function createFBO(renderState) {
    m_handle = renderState.m_context.createFramebuffer();
    renderState.m_context.bindFramebuffer(vgl.GL.FRAMEBUFFER, m_handle);

    var colorBufferHandle, depthBufferHandle,
        colorTexture = m_fboAttachmentMap[vgl.GL.COLOR_ATTACHMENT0],
        depthTexture = m_fboAttachmentMap[vgl.GL.DEPTH_ATTACHMENT];

    if (!colorTexture) {
      colorBufferHandle = renderState.m_context.createRenderbuffer();
      renderState.m_context.bindRenderbuffer(vgl.GL.RENDERBUFFER, colorBufferHandle);
      renderState.m_context.renderbufferStorage(vgl.GL.RENDERBUFFER,
        vgl.GL.RGB565, m_width, m_height);
      renderState.m_context.framebufferRenderbuffer(vgl.GL.FRAMEBUFFER,
        vgl.GL.COLOR_ATTACHMENT0, vgl.GL.RENDERBUFFER, colorBufferHandle);
      m_fboAttachmentMap[vgl.COLOR_ATTACHMENT0] = colorBufferHandle;
    } else {
      updateTexture(colorTexture, renderState);
      colorTexture.bind(renderState);
      renderState.m_context.framebufferTexture2D(vgl.GL.FRAMEBUFFER,
        vgl.GL.COLOR_ATTACHMENT0, vgl.GL.TEXTURE_2D,
        colorTexture.textureHandle(), 0);
    }

    if (!depthTexture) {
      depthBufferHandle = vgl.GL.createRenderbuffer();
      renderState.m_context.bindRenderbuffer(vgl.GL.RENDERBUFFER, depthBufferHandle);
      renderState.m_context.renderbufferStorage(vgl.GL.RENDERBUFFER,
        vgl.GL.DEPTH_COMPONENT16, m_width, m_height);
      renderState.m_context.framebufferRenderbuffer(vgl.GL.FRAMEBUFFER,
        vgl.GL.DEPTH_ATTACHMENT, vgl.GL.RENDERBUFFER, depthBufferHandle);
      m_fboAttachmentMap[vgl.DEPTH_ATTACHMENT] = depthBufferHandle;
    } else {
      updateTexture(depthTexture, renderState);
      depthTexture.bind(renderState);
      renderState.m_context.framebufferTexture2D(vgl.GL.FRAMEBUFFER,
        vgl.GL.DEPTH_ATTACHMENT, vgl.GL.TEXTURE_2D,
        depthTexture.textureHandle(), 0);
    }

    m_fboCreationTime.modified();
  }
297099
function updateRenderbuffer(ctx, renderbuffer, opts) {
  Object.assign(renderbuffer, opts)

  const gl = ctx.gl

  assert(
    renderbuffer.pixelFormat === ctx.PixelFormat.Depth16,
    'Only PixelFormat.Depth16 is supported for renderbuffers'
  )
  renderbuffer.format = gl.DEPTH_COMPONENT16

  gl.bindRenderbuffer(renderbuffer.target, renderbuffer.handle)
  gl.renderbufferStorage(
    renderbuffer.target,
    renderbuffer.format,
    renderbuffer.width,
    renderbuffer.height
  )
  gl.bindRenderbuffer(renderbuffer.target, null)
}
210845
function setupDepthRenderbuffer( renderTarget ) {

		var renderTargetProperties = properties.get( renderTarget );

		var isCube = ( renderTarget instanceof THREE.WebGLRenderTargetCube );

		if ( renderTarget.depthTexture ) {

			if ( isCube ) throw new Error('target.depthTexture not supported in Cube render targets');

			setupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget );

		} else {

			if ( isCube ) {

				renderTargetProperties.__webglDepthbuffer = [];

				for ( var i = 0; i < 6; i ++ ) {

					_gl.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ i ] );
					renderTargetProperties.__webglDepthbuffer[ i ] = _gl.createRenderbuffer();
					setupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer[ i ], renderTarget );

				}

			} else {

				_gl.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
				renderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer();
				setupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer, renderTarget );

			}

		}

		_gl.bindFramebuffer( _gl.FRAMEBUFFER, null );

	}
1322796
def render(self):
        """"""
        return FRAME_HTML % {
            'id': self.id,
            'filename': escape(self.filename),
            'lineno': self.lineno,
            'function_name': escape(self.function_name),
            'current_line': escape(self.current_line.strip())
        }
845999
function getOrientation(arrayBuffer) {
  var dataView = new DataView(arrayBuffer);
  var length = dataView.byteLength;
  var orientation;
  var exifIDCode;
  var tiffOffset;
  var firstIFDOffset;
  var littleEndian;
  var endianness;
  var app1Start;
  var ifdStart;
  var offset;
  var i;
  // Only handle JPEG image (start by 0xFFD8)
  if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) {
    offset = 2;
    while (offset < length) {
      if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) {
        app1Start = offset;
        break;
      }
      offset++;
    }
  }
  if (app1Start) {
    exifIDCode = app1Start + 4;
    tiffOffset = app1Start + 10;
    if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') {
      endianness = dataView.getUint16(tiffOffset);
      littleEndian = endianness === 0x4949;

      if (littleEndian || endianness === 0x4D4D /* bigEndian */) {
        if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) {
          firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian);

          if (firstIFDOffset >= 0x00000008) {
            ifdStart = tiffOffset + firstIFDOffset;
          }
        }
      }
    }
  }
  if (ifdStart) {
    length = dataView.getUint16(ifdStart, littleEndian);

    for (i = 0; i < length; i++) {
      offset = ifdStart + i * 12 + 2;
      if (dataView.getUint16(offset, littleEndian) === 0x0112 /* Orientation */) {

        // 8 is the offset of the current tag's value
        offset += 8;

        // Get the original orientation value
        orientation = dataView.getUint16(offset, littleEndian);

        // Override the orientation with its default value for Safari (#120)
        // if (IS_SAFARI_OR_UIWEBVIEW) {
        //   dataView.setUint16(offset, 1, littleEndian);
        // }
        break;
      }
    }
  }
  return orientation;
}
632272
function getPixels(texture, opts) {
    var gl = texture.gl
    if (!gl)
        throw new Error("must provide gl-texture2d object with a valid 'gl' context")
    
    if (!fbo) {
        var handle = gl.createFramebuffer()
        fbo = {
            handle: handle,
            dispose: dispose,
            gl: gl
        }
    } 

    // make this the current frame buffer
    gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.handle)

    // attach the texture to the framebuffer.
    gl.framebufferTexture2D(
        gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0,
        gl.TEXTURE_2D, texture.handle, 0)

    // check if you can read from this type of texture.
    var status = gl.checkFramebufferStatus(gl.FRAMEBUFFER)
    if (status !== gl.FRAMEBUFFER_COMPLETE) 
        throw new Error("cannot read GL framebuffer: " + status)
    
    opts = opts||{}
    opts.x = opts.x|0
    opts.y = opts.y|0
    opts.width = typeof opts.width === 'number' ? opts.width : (texture.shape[0]|0)
    opts.height = typeof opts.height === 'number' ? opts.height : (texture.shape[1]|0)

    var array = new Uint8Array(opts.width * opts.height * 4)
    gl.readPixels(opts.x, opts.y, opts.width, opts.height, gl.RGBA, gl.UNSIGNED_BYTE, array)
    gl.bindFramebuffer(gl.FRAMEBUFFER, null)
    return array
}
394611
private void renderData() {
		QrCodeMaskPattern mask = qr.mask;
		int count = 0;

		int length = bitLocations.size() - bitLocations.size()%8;
		while( count < length ) {
			int bits = qr.rawbits[count/8]&0xFF;

			int N = Math.min(8,bitLocations.size()-count);

			for (int i = 0; i < N; i++) {
				Point2D_I32 coor = bitLocations.get(count+i);
				int value = mask.apply(coor.y,coor.x, ((bits >> i ) & 0x01));
//				int value = ((bits >> i ) & 0x01);
				if( value > 0 ) {
					square(coor.y,coor.x);
				}
			}
			count += 8;
		}

	}
1345188
function () {
		var bounds = this._renderer._bounds;

		this._parts = [];
		if (!this._pxBounds || !this._pxBounds.intersects(bounds)) {
			return;
		}

		if (this.options.noClip) {
			this._parts = this._rings;
			return;
		}

		var parts = this._parts,
		    i, j, k, len, len2, segment, points;

		for (i = 0, k = 0, len = this._rings.length; i < len; i++) {
			points = this._rings[i];

			for (j = 0, len2 = points.length; j < len2 - 1; j++) {
				segment = L.LineUtil.clipSegment(points[j], points[j + 1], bounds, j, true);

				if (!segment) { continue; }

				parts[k] = parts[k] || [];
				parts[k].push(segment[0]);

				// if segment goes out of screen, or it's the last one, it's the end of the line part
				if ((segment[1] !== points[j + 1]) || (j === len2 - 2)) {
					parts[k].push(segment[1]);
					k++;
				}
			}
		}
	}
698069
def attach_to_fbo(self):
        """"""
        gl.glFramebufferTexture2DEXT(gl.GL_FRAMEBUFFER_EXT, self.attachment_point, self.target0, self.id, 0)
876129
def texture_from_image(renderer, image_name):
    """"""
    soft_surface = ext.load_image(image_name)
    texture = SDL_CreateTextureFromSurface(renderer.renderer, soft_surface)
    SDL_FreeSurface(soft_surface)
    return texture
1167966
function setupDepthTexture( framebuffer, renderTarget ) {

		var isCube = ( renderTarget && renderTarget.isWebGLRenderTargetCube );
		if ( isCube ) throw new Error( 'Depth Texture with cube render targets is not supported' );

		_gl.bindFramebuffer( 36160, framebuffer );

		if ( ! ( renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture ) ) {

			throw new Error( 'renderTarget.depthTexture must be an instance of THREE.DepthTexture' );

		}

		// upload an empty depth texture with framebuffer size
		if ( ! properties.get( renderTarget.depthTexture ).__webglTexture ||
				renderTarget.depthTexture.image.width !== renderTarget.width ||
				renderTarget.depthTexture.image.height !== renderTarget.height ) {

			renderTarget.depthTexture.image.width = renderTarget.width;
			renderTarget.depthTexture.image.height = renderTarget.height;
			renderTarget.depthTexture.needsUpdate = true;

		}

		setTexture2D( renderTarget.depthTexture, 0 );

		var webglDepthTexture = properties.get( renderTarget.depthTexture ).__webglTexture;

		if ( renderTarget.depthTexture.format === DepthFormat ) {

			_gl.framebufferTexture2D( 36160, 36096, 3553, webglDepthTexture, 0 );

		} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {

			_gl.framebufferTexture2D( 36160, 33306, 3553, webglDepthTexture, 0 );

		} else {

			throw new Error( 'Unknown depthTexture format' );

		}

	}
726871
function setupDepthTexture ( framebuffer, renderTarget ) {

		var isCube = ( renderTarget instanceof THREE.WebGLRenderTargetCube );
		if ( isCube ) throw new Error('Depth Texture with cube render targets is not supported!');

		_gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );

		if ( !( renderTarget.depthTexture instanceof THREE.DepthTexture ) ) {

			throw new Error('renderTarget.depthTexture must be an instance of THREE.DepthTexture');

		}

		// upload an empty depth texture with framebuffer size
		if ( !properties.get( renderTarget.depthTexture ).__webglTexture ||
				renderTarget.depthTexture.image.width !== renderTarget.width ||
				renderTarget.depthTexture.image.height !== renderTarget.height ) {
			renderTarget.depthTexture.image.width = renderTarget.width;
			renderTarget.depthTexture.image.height = renderTarget.height;
			renderTarget.depthTexture.needsUpdate = true;
		}

		setTexture2D( renderTarget.depthTexture, 0 );

		var webglDepthTexture = properties.get( renderTarget.depthTexture ).__webglTexture;
		_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );

	}
14681
def shape(self, pixelbuffer=0):
        
        # apply pixelbuffers
        height = self._base_shape.height + 2 * pixelbuffer
        width = self._base_shape.width + 2 * pixelbuffer
        if pixelbuffer and self.tp.grid.is_global:
            # on first and last row, remove pixelbuffer on top or bottom
            matrix_height = self.tile_pyramid.matrix_height(self.zoom)
            if matrix_height == 1:
                height = self._base_shape.height
            elif self.row in [0, matrix_height - 1]:
                height = self._base_shape.height + pixelbuffer
        return Shape(height=height, width=width)