Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Static Public Attributes
MoinMoin.support.pygments.formatters.img.GifImageFormatter Class Reference
Inheritance diagram for MoinMoin.support.pygments.formatters.img.GifImageFormatter:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.support.pygments.formatters.img.GifImageFormatter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def get_style_defs
def format

Public Attributes

 styles
 background_color
 image_format
 image_pad
 line_pad
 fonts
 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_width
 drawables
 maxcharno
 maxlineno

Static Public Attributes

string name = 'img_gif'
list aliases = ['gif']
list filenames = ['*.gif']
string default_image_format = 'gif'
 unicodeoutput = False

Detailed Description

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

*New in Pygments 1.0.* (You could create GIF images before by passing a
suitable `image_format` option to the `ImageFormatter`.)

Definition at line 475 of file img.py.


Member Function Documentation

def MoinMoin.support.pygments.formatters.img.ImageFormatter.format (   self,
  tokensource,
  outfile 
) [inherited]
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.

Definition at line 450 of file img.py.

00450 
00451     def format(self, tokensource, outfile):
00452         """
00453         Format ``tokensource``, an iterable of ``(tokentype, tokenstring)``
00454         tuples and write it into ``outfile``.
00455 
00456         This implementation calculates where it should draw each token on the
00457         pixmap, then calculates the required pixmap size and draws the items.
00458         """
00459         self._create_drawables(tokensource)
00460         self._draw_line_numbers()
00461         im = Image.new(
00462             'RGB',
00463             self._get_image_size(self.maxcharno, self.maxlineno),
00464             self.background_color
00465         )
00466         self._paint_line_number_bg(im)
00467         draw = ImageDraw.Draw(im)
00468         for pos, value, font, kw in self.drawables:
00469             draw.text(pos, value, font=font, **kw)
00470         im.save(outfile, self.image_format.upper())
00471 
00472 
00473 # Add one formatter per format, so that the "-f gif" option gives the correct result
00474 # when used in pygmentize.

Here is the call graph for this function:

Definition at line 309 of file img.py.

00309 
00310     def get_style_defs(self, arg=''):
00311         raise NotImplementedError('The -S option is meaningless for the image '
00312                                   'formatter. Use -O style=<stylename> instead.')

Here is the caller graph for this function:


Member Data Documentation

Reimplemented from MoinMoin.support.pygments.formatters.img.ImageFormatter.

Definition at line 485 of file img.py.

Definition at line 275 of file img.py.

Reimplemented from MoinMoin.support.pygments.formatters.img.ImageFormatter.

Definition at line 487 of file img.py.

Definition at line 307 of file img.py.

Reimplemented from MoinMoin.support.pygments.formatters.img.ImageFormatter.

Definition at line 486 of file img.py.

Definition at line 287 of file img.py.

Definition at line 286 of file img.py.

Definition at line 279 of file img.py.

Definition at line 282 of file img.py.

Definition at line 290 of file img.py.

Definition at line 293 of file img.py.

Definition at line 291 of file img.py.

Definition at line 289 of file img.py.

Definition at line 295 of file img.py.

Definition at line 297 of file img.py.

Definition at line 299 of file img.py.

Definition at line 301 of file img.py.

Definition at line 303 of file img.py.

Definition at line 298 of file img.py.

Definition at line 283 of file img.py.

Definition at line 420 of file img.py.

Definition at line 421 of file img.py.

Reimplemented from MoinMoin.support.pygments.formatters.img.ImageFormatter.

Definition at line 484 of file img.py.

Definition at line 273 of file img.py.

Definition at line 260 of file img.py.


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