Draws the PE Header to the structure image
544961
private void drawPEHeaders() {
		long msdosOffset = 0;
		long msdosSize = withMinLength(data.getMSDOSHeader().getHeaderSize());
		drawPixels(colorMap.get(MSDOS_HEADER), msdosOffset, msdosSize);

		long optOffset = data.getOptionalHeader().getOffset();
		long optSize = withMinLength(data.getOptionalHeader().getSize());
		drawPixels(colorMap.get(OPTIONAL_HEADER), optOffset, optSize);

		long coffOffset = data.getCOFFFileHeader().getOffset();
		long coffSize = withMinLength(COFFFileHeader.HEADER_SIZE);
		drawPixels(colorMap.get(COFF_FILE_HEADER), coffOffset, coffSize);

		long tableOffset = data.getSectionTable().getOffset();
		long tableSize = data.getSectionTable().getSize();
		if (tableSize != 0) {
			tableSize = withMinLength(tableSize);
			drawPixels(colorMap.get(SECTION_TABLE), tableOffset, tableSize);
		}
	}
806848
def draw(self):
        """"""
        if not self.visible:
            return

        self.window.blit(self.textImage, self.loc)
290501
function header(dimensions) {
  return divider(dimensions, 'top')
    + BORDER_VERT
    + BOLD + padEnd(' NAME', dimensions.name) + RESET
    + BORDER_VERT
    + BOLD + padEnd(' AVG', dimensions.avg) + RESET
    + BORDER_VERT
    + BOLD + padEnd(' MIN', dimensions.min) + RESET
    + BORDER_VERT
    + BOLD + padEnd(' MAX', dimensions.max) + RESET
    + BORDER_VERT
    + '\n'
    + divider(dimensions, 'header');
}
496789
function (_e) {
										_draw(_e[0], uip);
										_currentInstance.removeClass(_e[0], "jsplumb-dragged");
										_currentInstance.select({source: _e[0]}).removeClass(_currentInstance.elementDraggingClass + " " + _currentInstance.sourceElementDraggingClass, true);
										_currentInstance.select({target: _e[0]}).removeClass(_currentInstance.elementDraggingClass + " " + _currentInstance.targetElementDraggingClass, true);
										_currentInstance.getDragManager().dragEnded(_e[0]);
									}
255405
def _write_header(self, image, hdu):
        """"""
        hduhdr = hdu.header

        # Ginga image header object for the given extension only.
        # Cannot use get_header() because that might also return PRI hdr.
        ghdr = image.metadata['header']

        for key in ghdr:
            # Need this to avoid duplication because COMMENT is a weird field
            if key.upper() == 'COMMENT':
                continue

            bnch = ghdr.get_card(key)

            # Insert new keyword
            if key not in hduhdr:
                hduhdr[key] = (bnch.value, bnch.comment)

            # Update existing keyword
            elif hduhdr[key] != bnch.value:
                hduhdr[key] = bnch.value
496024
def draw(self):
        """"""
        if not self.visible:
            return

        self.window.blit(self.image, self.loc)
840514
function headers(buffer) {
    var head = {};
    if (buffer[0] === 0x89 && buffer[1] === 0x50 && buffer[2] === 0x4E &&
        buffer[3] === 0x47 && buffer[4] === 0x0D && buffer[5] === 0x0A &&
        buffer[6] === 0x1A && buffer[7] === 0x0A) {
        head['Content-Type'] = 'image/png';
    } else if (buffer[0] === 0xFF && buffer[1] === 0xD8 &&
        buffer[buffer.length - 2] === 0xFF && buffer[buffer.length - 1] === 0xD9) {
        head['Content-Type'] = 'image/jpeg';
    } else if (buffer[0] === 0x47 && buffer[1] === 0x49 && buffer[2] === 0x46 &&
        buffer[3] === 0x38 && (buffer[4] === 0x39 || buffer[4] === 0x37) &&
        buffer[5] === 0x61) {
        head['Content-Type'] = 'image/gif';
    } else if (buffer[0] === 0x52 && buffer[1] === 0x49 && buffer[2] === 0x46 && buffer[3] === 0x46 &&
        buffer[8] === 0x57 && buffer[9] === 0x45 && buffer[10] === 0x42 && buffer[11] === 0x50) {
        head['Content-Type'] = 'image/webp';
    // deflate: recklessly assumes contents are PBF.
    } else if (buffer[0] === 0x78 && buffer[1] === 0x9C) {
        head['Content-Type'] = 'application/x-protobuf';
        head['Content-Encoding'] = 'deflate';
    // gzip: recklessly assumes contents are PBF.
    } else if (buffer[0] === 0x1F && buffer[1] === 0x8B) {
        head['Content-Type'] = 'application/x-protobuf';
        head['Content-Encoding'] = 'gzip';
    }
    return head;
}
894574
function renderHeader(&$header) 
    {
        $hobj = new StdClass;
        $hobj->header = $header->toHtml();
        $this->_obj->sections[$this->_sectionCount] = $hobj;
        $this->_currentSection = $this->_sectionCount++;
    }
960072
private function drawCapatchaImageText()
	{
		
		#	Create Image Text
	
		# here we will first create background text, then front text
		# we will set x- position
		# initial front text position 'initial_x'
		# current position 'current_x'
		
		$this->_front_text['initial_x'] = $this->_front_text['x'] = rand( 10, 25 );
		
		# Background Text
		# X, Y positions
		
		$this->_background_text['x'] = $this->_front_text['x'] / 2;
		$this->_background_text['y'] = ( $this->_calculated_text_box['dimensions']['height'] ) + ( $this->_calculated_text_box['additional_height'] / 2 );

		// Developing::preview( $this->_calculated_text_box['additional_height'], $this->_image_info['height'] - $this->_calculated_text_box['dimensions']['height'] );
		
		$characters = str_split( $this->_code, 1 );
		
		# Generating background text By Drawing letter by letter
		foreach( $characters as $char )
		{
			# character rotation angle
			$rotation_angle = rand( 0 - $this->_rotation_angle, $this->_rotation_angle );

			# get color rgb values
			$rgb = $this->getRGBFromRange(
				$this->_background_text['color'][0],
				$this->_background_text['color'][1],
				$this->_background_text['color'][2],
				$this->_background_text['color']['range']
				);
			
			$character_color = imagecolorallocatealpha(
				$this->_image_resource,
				$rgb[0],
				$rgb[1],
				$rgb[2],
				$this->_background_text['color'][3]
				);

			# check to add the blocks seperation distance
			if( $char === ' ' )
				$this->_background_text['x'] += $this->_blocks_seperation;
			
			# Draw Character to the image
			imagettftext(
				$this->_image_resource,					# Image resource
				$this->_background_text['size'],		# Font Size
				$rotation_angle,						# Text Angle
				$this->_background_text['x'],			# X Position
				$this->_background_text['y'],			# Y Position
				$character_color,						# Color
				$this->_background_text['font'],		# Font
				$char 									# Text
				);
			
			# move x to the next position			
			// $this->_background_text['x'] += $this->getTextBoxDimensions(
			// 	$this->_background_text['size'],
			// 	$rotation_angle,
			// 	$this->_background_text['font'],
			// 	$char
			// 	)['width'];

			$box_dimension = $this->getTextBoxDimensions(
				$this->_background_text['size'],
				$rotation_angle,
				$this->_background_text['font'],
				$char
				);

			$this->_background_text['x'] += $box_dimension['width'];
			

			# Method End
		}
		
		
		# space between characters equal 1/4  average character width
		$space_between_chars = $this->_calculated_text_box['char_width'] / 4;

		# final character index
		$final_character_index = $this->_code_length - 1;
		
		
		# Front Text
		foreach( $characters as $index => $char )
		{
			
			# the same as background text
			
			$rotation_angle = rand( 0 - $this->_rotation_angle, $this->_rotation_angle );
			
			# get color rgb values
			$rgb = $this->getRGBFromRange(
				$this->_front_text['color'][0],
				$this->_front_text['color'][1],
				$this->_front_text['color'][2],
				$this->_front_text['color']['range']
				);

			$character_color = imagecolorallocatealpha(
				$this->_image_resource,
				$rgb[0],
				$rgb[1],
				$rgb[2],
				$this->_front_text['color'][3]
				);

			# Calculate Character Dimensions
			$character_box = $this->getTextBoxDimensions(
				$this->_front_text['size'],
				$rotation_angle,
				$this->_front_text['font'],
				$char
				);

			# # calculate y position
			// $this->_front_text['y'] = ( $character_box['height'] - abs( $character_box['points'][1] ) ) + ( ( $this->_image_info['height'] - $character_box['height'] ) / 2 );
			// Developing::preview( 'index' . $index . ': ' . ( $character_box['height'] - abs( $character_box['points'][1] ) ), 'index' . $index . ': ' . $character_box['points'][5] );
			// exit;
			
			$this->_front_text['y'] = abs( $character_box['height'] ) + ( ( $this->_image_info['height'] - $character_box['height'] ) / 2 ) ; 
			
			# check to add the blocks seperation distance
			if( $char === ' ' )
				$this->_front_text['x'] += $this->_blocks_seperation;
			
			
			# Draw Character To Image
			imagettftext(
						 $this->_image_resource,
						 $this->_front_text['size'],
						 $rotation_angle,
						 $this->_front_text['x'],
						 $this->_front_text['y'],
						 $character_color,
						 $this->_front_text['font'],
						 $char
						);
			
			$this->_front_text['x'] += $character_box['width'];
			
			$this->_front_text['x'] += ( $index !== $final_character_index ) ? $space_between_chars : null;
		
		}

		# Method End	
	}
1184947
private JPanel buildHeader(JLabel label, JToolBar bar) {
        gradientPanel = new GradientPanel(new BorderLayout(), getHeaderBackground());
        label.setOpaque(false);

        gradientPanel.add(label, BorderLayout.WEST);
        gradientPanel.setBorder(BorderFactory.createEmptyBorder(3, 4, 3, 1));

        headerPanel = new JPanel(new BorderLayout());
        headerPanel.add(gradientPanel, BorderLayout.CENTER);
        setToolBar(bar);
        headerPanel.setBorder(new RaisedHeaderBorder());
        headerPanel.setOpaque(false);
        return headerPanel;
    }
687886
def drawColHeader(self, scr, y, vcolidx):
        ''
        col = self.visibleCols[vcolidx]

        # hdrattr highlights whole column header
        # sepattr is for header separators and indicators
        sepattr = colors.color_column_sep

        hdrattr = self.colorize(col, None)
        if vcolidx == self.cursorVisibleColIndex:
            hdrattr = hdrattr.update_attr(colors.color_current_hdr, 2)

        C = options.disp_column_sep
        if (self.keyCols and col is self.keyCols[-1]) or vcolidx == self.rightVisibleColIndex:
            C = options.disp_keycol_sep

        x, colwidth = self.visibleColLayout[vcolidx]

        # ANameTC
        T = getType(col.type).icon
        if T is None:  # still allow icon to be explicitly non-displayed ''
            T = '?'
        N = ' ' + col.name  # save room at front for LeftMore
        if len(N) > colwidth-1:
            N = N[:colwidth-len(options.disp_truncator)] + options.disp_truncator
        clipdraw(scr, y, x, N, hdrattr.attr, colwidth)
        clipdraw(scr, y, x+colwidth-len(T), T, hdrattr.attr, len(T))
        vd.onMouse(scr, y, x, 1, colwidth, BUTTON3_RELEASED='rename-col')

        if vcolidx == self.leftVisibleColIndex and col not in self.keyCols and self.nonKeyVisibleCols.index(col) > 0:
            A = options.disp_more_left
            scr.addstr(y, x, A, sepattr)

        if C and x+colwidth+len(C) < self.vd.windowWidth:
            scr.addstr(y, x+colwidth, C, sepattr)
754243
def display_boxes(self, tree, html_path, filename_prefix, alternate_colors=False):
        
        imgs = []
        colors = {
            "section_header": Color("blue"),
            "figure": Color("green"),
            "figure_caption": Color("green"),
            "table_caption": Color("red"),
            "list": Color("yellow"),
            "paragraph": Color("gray"),
            "table": Color("red"),
            "header": Color("brown"),
        }
        for i, page_num in enumerate(tree.keys()):
            img = self.pdf_to_img(page_num)
            draw = Drawing()
            draw.fill_color = Color("rgba(0, 0, 0, 0.0)")
            for clust in tree[page_num]:
                for (pnum, pwidth, pheight, top, left, bottom, right) in tree[page_num][
                    clust
                ]:
                    draw.stroke_color = colors[clust]
                    draw.rectangle(left=left, top=top, right=right, bottom=bottom)
                    draw.push()
                    draw.font_size = 20
                    draw.font_weight = 10
                    draw.fill_color = colors[clust]
                    if int(left) > 0 and int(top) > 0:
                        draw.text(x=int(left), y=int(top), body=clust)
                    draw.pop()
            draw(img)
            img.save(filename=html_path + filename_prefix + "_page_" + str(i) + ".png")
            imgs.append(img)
        return imgs
713561
def process_png(data)
      type   = 'png'
      width  = 0
      height = 0
      x_dpi  = 96
      y_dpi  = 96

      offset = 8
      data_length = data.size

      # Search through the image data to read the height and width in th the
      # IHDR element. Also read the DPI in the pHYs element.
      while offset < data_length

        length = data[offset + 0, 4].unpack("N")[0]
        png_type   = data[offset + 4, 4].unpack("A4")[0]

        case png_type
        when "IHDR"
          width  = data[offset +  8, 4].unpack("N")[0]
          height = data[offset + 12, 4].unpack("N")[0]
        when "pHYs"
          x_ppu = data[offset +  8, 4].unpack("N")[0]
          y_ppu = data[offset + 12, 4].unpack("N")[0]
          units = data[offset + 16, 1].unpack("C")[0]

          if units == 1
            x_dpi = x_ppu * 0.0254
            y_dpi = y_ppu * 0.0254
          end
        end

        offset = offset + length + 12

        break if png_type == "IEND"
      end
      raise "#{filename}: no size data found in png image.\n" unless height

      [type, width, height, x_dpi, y_dpi]
    end
400641
def make_header(self):
        
        cards = [fits.Card("TELESCOP", "GLAST"),
                 fits.Card("INSTRUME", "LAT"),
                 fits.Card(self._conv.coordsys, self._coordsys),
                 fits.Card("PIXTYPE", "HEALPIX"),
                 fits.Card("ORDERING", self.ordering),
                 fits.Card("ORDER", self._order),
                 fits.Card("NSIDE", self._nside),
                 fits.Card("FIRSTPIX", 0),
                 fits.Card("LASTPIX", self._maxpix - 1),
                 fits.Card("HPX_CONV", self._conv.convname)]

        if self._coordsys == "CEL":
            cards.append(fits.Card("EQUINOX", 2000.0,
                                   "Equinox of RA & DEC specifications"))

        if self._region is not None:
            cards.append(fits.Card("HPX_REG", self._region))
            cards.append(fits.Card("INDXSCHM", "PARTIAL"))
        elif self._ipix is not None:
            cards.append(fits.Card("INDXSCHM", "EXPLICIT"))        
        else:
            if self._conv.convname in ['FGST_SRCMAP_SPARSE']:
                cards.append(fits.Card("INDXSCHM", "SPARSE"))
            else:
                cards.append(fits.Card("INDXSCHM", "IMPLICIT"))

        header = fits.Header(cards)
        return header
957811
public function draw() {
        ob_start();
        imagepng($this->im);
        $bin = ob_get_contents();
        ob_end_clean();

        $this->setInternalProperties($bin);

        if (empty($this->filename)) {
            echo $bin;
        } else {
            file_put_contents($this->filename, $bin);
        }
    }
355426
def process_draw_image( element, output_node )
      pic_name = element.attribute("#{@xlink_ns}:href").value
      if (@image_dir != nil) then
        img = emit_element( output_node, "img" )
        img.attributes["alt"] = pic_name

        # Get rid of everything before the last / in the filename
        base_name = pic_name;
        if ((pos = base_name.rindex('/')) != nil) then
          base_name = base_name[pos + 1 .. -1]
        end
        copy_image_file( pic_name, @image_dir, base_name )
        img.attributes["src"] = "#{@image_dir}/#{base_name}"
        width = element.parent.attribute("#{@svg_ns}:width")
        height= element.parent.attribute("#{@svg_ns}:height")
        if (width != nil && height != nil) then
          img.attributes["style"] = "width:#{width.value}; " +
            "height:#{height.value}"
        end
      else
        div = emit_element( output_node, "div" )
        div.add_text( pic_name )
      end
    end
1078658
def draw(self):
        """"""
        from onshapepy import Part
        CAD = Part(
            'https://cad.onshape.com/documents/b4cfd328713460beeb3125ac/w/3928b5c91bb0a0be7858d99e/e/6f2eeada21e494cebb49515f'
        )
        CAD.params = {
            'channel_L': self.channel_L,
            'channel_W': self.channel_W,
            'channel_H': self.downstream_H,
            'channel_pairs': self.channel_n/2,
            'baffle_S': self.baffle_S,
        }