Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | List of all members
pip._vendor.pygments.formatters.img.ImageFormatter Class Reference
Inheritance diagram for pip._vendor.pygments.formatters.img.ImageFormatter:
Inheritance graph
[legend]
Collaboration diagram for pip._vendor.pygments.formatters.img.ImageFormatter:
Collaboration graph
[legend]

Public Member Functions

 __init__ (self, **options)
 
 get_style_defs (self, arg='')
 
 format (self, tokensource, outfile)
 

Public Attributes

 encoding
 
 styles
 
 background_color
 
 image_format
 
 default_image_format
 
 image_pad
 
 line_pad
 
 fonts
 
 fontw
 
 fonth
 
 line_number_fg
 
 line_number_bg
 
 line_number_chars
 
 line_number_bold
 
 line_number_italic
 
 line_number_pad
 
 line_numbers
 
 line_number_separator
 
 line_number_step
 
 line_number_start
 
 line_number_width
 
 hl_lines
 
 hl_color
 
 drawables
 
 maxlinelength
 
 maxcharno
 
 maxlineno
 
- Public Attributes inherited from pip._vendor.pygments.formatter.Formatter
 style
 
 full
 
 title
 
 encoding
 
 options
 

Static Public Attributes

str name = 'img'
 
list aliases = ['img', 'IMG', 'png']
 
list filenames = ['*.png']
 
bool unicodeoutput = False
 
str default_image_format = 'png'
 
- Static Public Attributes inherited from pip._vendor.pygments.formatter.Formatter
 name = None
 
list aliases = []
 
list filenames = []
 
bool unicodeoutput = True
 

Protected Member Functions

 _get_line_height (self)
 
 _get_line_y (self, lineno)
 
 _get_char_width (self)
 
 _get_char_x (self, linelength)
 
 _get_text_pos (self, linelength, lineno)
 
 _get_linenumber_pos (self, lineno)
 
 _get_text_color (self, style)
 
 _get_text_bg_color (self, style)
 
 _get_style_font (self, style)
 
 _get_image_size (self, maxlinelength, maxlineno)
 
 _draw_linenumber (self, posno, lineno)
 
 _draw_text (self, pos, text, font, text_fg, text_bg)
 
 _create_drawables (self, tokensource)
 
 _draw_line_numbers (self)
 
 _paint_line_number_bg (self, im)
 

Detailed Description

Create a PNG image from source code. This uses the Python Imaging Library to
generate a pixmap from the source code.

.. versionadded:: 0.10

Additional options accepted:

`image_format`
    An image format to output to that is recognised by PIL, these include:

    * "PNG" (default)
    * "JPEG"
    * "BMP"
    * "GIF"

`line_pad`
    The extra spacing (in pixels) between each line of text.

    Default: 2

`font_name`
    The font name to be used as the base font from which others, such as
    bold and italic fonts will be generated.  This really should be a
    monospace font to look sane.

    Default: "Courier New" on Windows, "Menlo" on Mac OS, and
             "DejaVu Sans Mono" on \\*nix

`font_size`
    The font size in points to be used.

    Default: 14

`image_pad`
    The padding, in pixels to be used at each edge of the resulting image.

    Default: 10

`line_numbers`
    Whether line numbers should be shown: True/False

    Default: True

`line_number_start`
    The line number of the first line.

    Default: 1

`line_number_step`
    The step used when printing line numbers.

    Default: 1

`line_number_bg`
    The background colour (in "#123456" format) of the line number bar, or
    None to use the style background color.

    Default: "#eed"

`line_number_fg`
    The text color of the line numbers (in "#123456"-like format).

    Default: "#886"

`line_number_chars`
    The number of columns of line numbers allowable in the line number
    margin.

    Default: 2

`line_number_bold`
    Whether line numbers will be bold: True/False

    Default: False

`line_number_italic`
    Whether line numbers will be italicized: True/False

    Default: False

`line_number_separator`
    Whether a line will be drawn between the line number area and the
    source code area: True/False

    Default: True

`line_number_pad`
    The horizontal padding (in pixels) between the line number margin, and
    the source code area.

    Default: 6

`hl_lines`
    Specify a list of lines to be highlighted.

    .. versionadded:: 1.2

    Default: empty list

`hl_color`
    Specify the color for highlighting lines.

    .. versionadded:: 1.2

    Default: highlight color of the selected style

Constructor & Destructor Documentation

◆ __init__()

pip._vendor.pygments.formatters.img.ImageFormatter.__init__ (   self,
**  options 
)
See the class docstring for explanation of options.

Reimplemented from pip._vendor.pygments.formatter.Formatter.

Member Function Documentation

◆ _create_drawables()

pip._vendor.pygments.formatters.img.ImageFormatter._create_drawables (   self,
  tokensource 
)
protected
Create drawables for the token content.

◆ _draw_line_numbers()

pip._vendor.pygments.formatters.img.ImageFormatter._draw_line_numbers (   self)
protected
Create drawables for the line numbers.

◆ _draw_linenumber()

pip._vendor.pygments.formatters.img.ImageFormatter._draw_linenumber (   self,
  posno,
  lineno 
)
protected
Remember a line number drawable to paint later.

◆ _draw_text()

pip._vendor.pygments.formatters.img.ImageFormatter._draw_text (   self,
  pos,
  text,
  font,
  text_fg,
  text_bg 
)
protected
Remember a single drawable tuple to paint later.

◆ _get_char_width()

pip._vendor.pygments.formatters.img.ImageFormatter._get_char_width (   self)
protected
Get the width of a character.

◆ _get_char_x()

pip._vendor.pygments.formatters.img.ImageFormatter._get_char_x (   self,
  linelength 
)
protected
Get the X coordinate of a character position.

◆ _get_image_size()

pip._vendor.pygments.formatters.img.ImageFormatter._get_image_size (   self,
  maxlinelength,
  maxlineno 
)
protected
Get the required image size.

◆ _get_line_height()

pip._vendor.pygments.formatters.img.ImageFormatter._get_line_height (   self)
protected
Get the height of a line.

◆ _get_line_y()

pip._vendor.pygments.formatters.img.ImageFormatter._get_line_y (   self,
  lineno 
)
protected
Get the Y coordinate of a line number.

◆ _get_linenumber_pos()

pip._vendor.pygments.formatters.img.ImageFormatter._get_linenumber_pos (   self,
  lineno 
)
protected
Get the actual position for the start of a line number.

◆ _get_style_font()

pip._vendor.pygments.formatters.img.ImageFormatter._get_style_font (   self,
  style 
)
protected
Get the correct font for the style.

◆ _get_text_bg_color()

pip._vendor.pygments.formatters.img.ImageFormatter._get_text_bg_color (   self,
  style 
)
protected
Get the correct background color for the token from the style.

◆ _get_text_color()

pip._vendor.pygments.formatters.img.ImageFormatter._get_text_color (   self,
  style 
)
protected
Get the correct color for the token from the style.

◆ _get_text_pos()

pip._vendor.pygments.formatters.img.ImageFormatter._get_text_pos (   self,
  linelength,
  lineno 
)
protected
Get the actual position for a character and line position.

◆ _paint_line_number_bg()

pip._vendor.pygments.formatters.img.ImageFormatter._paint_line_number_bg (   self,
  im 
)
protected
Paint the line number background on the image.

◆ format()

pip._vendor.pygments.formatters.img.ImageFormatter.format (   self,
  tokensource,
  outfile 
)
Format ``tokensource``, an iterable of ``(tokentype, tokenstring)``
tuples and write it into ``outfile``.

This implementation calculates where it should draw each token on the
pixmap, then calculates the required pixmap size and draws the items.

Reimplemented from pip._vendor.pygments.formatter.Formatter.

◆ get_style_defs()

pip._vendor.pygments.formatters.img.ImageFormatter.get_style_defs (   self,
  arg = '' 
)
This method must return statements or declarations suitable to define
the current style for subsequent highlighted text (e.g. CSS classes
in the `HTMLFormatter`).

The optional argument `arg` can be used to modify the generation and
is formatter dependent (it is standardized because it can be given on
the command line).

This method is called by the ``-S`` :doc:`command-line option <cmdline>`,
the `arg` is then given by the ``-a`` option.

Reimplemented from pip._vendor.pygments.formatter.Formatter.


The documentation for this class was generated from the following file: