Return the frame number of a contour
350770
def get_frame(self, idx):
        """"""
        cont = self.data[idx]
        frame = int(cont.strip().split(" ", 1)[0])
        return frame
155324
def frame(x):
    
    x = stypes.toDoubleVector(x)
    y = stypes.emptyDoubleVector(3)
    z = stypes.emptyDoubleVector(3)
    libspice.frame_c(x, y, z)
    return stypes.cVectorToPython(x), stypes.cVectorToPython(y), stypes.cVectorToPython(
            z)
458177
def get_capture_dimensions(capture):
    """"""
    width = int(capture.get(cv2.CAP_PROP_FRAME_WIDTH))
    height = int(capture.get(cv2.CAP_PROP_FRAME_HEIGHT))
    return width, height
134326
def num_rows(self):
        
        if self._is_vertex_frame():
            return self.__graph__.summary()['num_vertices']
        elif self._is_edge_frame():
            return self.__graph__.summary()['num_edges']
890497
def contour_mask(self, contour):
        
        # fill in new data
        new_data = np.zeros(self.data.shape)
        num_boundary = contour.boundary_pixels.shape[0]
        boundary_px_ij_swapped = np.zeros([num_boundary, 1, 2])
        boundary_px_ij_swapped[:, 0, 0] = contour.boundary_pixels[:, 1]
        boundary_px_ij_swapped[:, 0, 1] = contour.boundary_pixels[:, 0]
        cv2.fillPoly(
            new_data, pts=[
                boundary_px_ij_swapped.astype(
                    np.int32)], color=(
                BINARY_IM_MAX_VAL, BINARY_IM_MAX_VAL, BINARY_IM_MAX_VAL))
        orig_zeros = np.where(self.data == 0)
        new_data[orig_zeros[0], orig_zeros[1]] = 0
        return BinaryImage(new_data.astype(np.uint8), frame=self._frame)
449164
def get_dimension(self):
        """"""
        if self.strokes > 0:
            if self.pixel_env > 0:
                return (2 + (1 + 2*self.pixel_env)**2) \
                    * self.strokes * self.points_per_stroke
            else:
                return 2*self.strokes * self.points_per_stroke
        else:
            if self.pen_down:
                return 3*self.points_per_stroke
            else:
                return 2*self.points_per_stroke
619022
function getBarrelCurveConstants(width, height) {
  return {
    heightOffset: Math.min(15, 0.05 * height),
    widthOffset: Math.min(100, 0.25 * width),
    ctrlPtOffsetPct: 0.05
  };
}
469986
def text_frame(self):
        
        if len(self._text['frames']) == 1:
            if self._text_color:
                return colored_frame(self._text['frames'][0], self._text_color)

            # Return first frame (can't return original text because at this point it might be ellipsed)
            return self._text['frames'][0]

        frames = self._text['frames']
        frame = frames[self._text_index]

        self._text_index += 1
        self._text_index = self._text_index % len(frames)

        if self._text_color:
            return colored_frame(frame, self._text_color)

        return frame
1106676
def observation(self, frame):
    """"""
    if frame.shape == self.observation_space.shape:
      return frame
    else:
      extended_frame = np.zeros(self.observation_space.shape,
                                self.observation_space.dtype)
      assert self.HW_AXES == (0, 1)
      extended_frame[:frame.shape[0], :frame.shape[1]] = frame
      return extended_frame
97255
def get_sample_frame(self):
        """"""
        for frame in self.frames:
            return frame.open()

        for res in self.results.values():
            return res.open()

        return None
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')
1161309
def from_frame(cls, frame):
        """"""
        # TODO: Check length
        ipframe = cls(frame[2] * 256 + frame[3])
        ipframe.body = frame[6:]
        return ipframe
1011947
def getCameraFrameSize(self, nDeviceIndex, eFrameType):
        """"""

        fn = self.function_table.getCameraFrameSize
        pnWidth = c_uint32()
        pnHeight = c_uint32()
        pnFrameBufferSize = c_uint32()
        result = fn(nDeviceIndex, eFrameType, byref(pnWidth), byref(pnHeight), byref(pnFrameBufferSize))
        return result, pnWidth.value, pnHeight.value, pnFrameBufferSize.value
957393
def get_current_frame():
    
    if hasattr(sys, "_getframe"):
        # noinspection PyProtectedMember
        return sys._getframe(1)
    try:
        raise ZeroDivisionError
    except ZeroDivisionError:
        return sys.exc_info()[2].tb_frame.f_back
197945
public int getFrameLength()
	{
		int length = frameData.length + FRAME_HEAD_SIZE;

		if (grouped)
		{
			length++;
		}
		if (encrypted)
		{
			length++;
		}
		if (lengthIndicator)
		{
			length += 4;
		}

		return length;
	}
1367402
def _get_struct_fillstyle(self, shape_number):
        """"""
        obj = _make_object("FillStyle")
        obj.FillStyleType = style_type = unpack_ui8(self._src)

        if style_type == 0x00:
            if shape_number <= 2:
                obj.Color = self._get_struct_rgb()
            else:
                obj.Color = self._get_struct_rgba()

        if style_type in (0x10, 0x12, 0x13):
            obj.GradientMatrix = self._get_struct_matrix()

        if style_type in (0x10, 0x12):
            obj.Gradient = self._get_struct_gradient(shape_number)
        if style_type == 0x13:
            obj.Gradient = self._get_struct_focalgradient(shape_number)

        if style_type in (0x40, 0x41, 0x42, 0x43):
            obj.BitmapId = unpack_ui16(self._src)
            obj.BitmapMatrix = self._get_struct_matrix()
        return obj
1100517
def glyph_contour_count(font, name):
    
    contour_count = 0
    items = [font['glyf'][name]]

    while items:
        g = items.pop(0)
        if g.isComposite():
            for comp in g.components:
                if comp.glyphName != ".ttfautohint":
                    items.append(font['glyf'][comp.glyphName])
        if g.numberOfContours != -1:
            contour_count += g.numberOfContours
    return contour_count