Geometry and colors

Geometry

Transformations

class djvu.decode.AffineTransform((x0, y0, w0, h0), (x1, y1, w1, h1))

The object represents an affine coordinate transformation that maps points from rectangle (x0, y0, w0, h0) to rectangle (x1, y1, w1, h1).

rotate(n)
Rotate the output rectangle counter-clockwise by n degrees.
apply((x, y))
apply((x, y, w, h))
Apply the coordinate transform to a point or a rectangle.
inverse((x, y))
inverse((x, y, w, h))
Apply the inverse coordinate transform to a point or a rectangle.
mirror_x()
Reverse the X coordinates of the output rectangle.
mirror_y()
Reverse the Y coordinates of the output rectangle.

Pixel formats

class djvu.decode.PixelFormat

Abstract base for all pixel formats.

Inheritance diagram:

digraph inheritancee70f525da8 {
rankdir=LR;
size="8.0, 12.0";
  "PixelFormatRgb" [style="setlinewidth(0.5)",URL="#djvu.decode.PixelFormatRgb",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25,shape=box,fontsize=10];
  "PixelFormat" -> "PixelFormatRgb" [arrowsize=0.5,style="setlinewidth(0.5)"];
  "PixelFormat" [style="setlinewidth(0.5)",URL="#djvu.decode.PixelFormat",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25,shape=box,fontsize=10];
  "PixelFormatPalette" [style="setlinewidth(0.5)",URL="#djvu.decode.PixelFormatPalette",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25,shape=box,fontsize=10];
  "PixelFormat" -> "PixelFormatPalette" [arrowsize=0.5,style="setlinewidth(0.5)"];
  "PixelFormatRgbMask" [style="setlinewidth(0.5)",URL="#djvu.decode.PixelFormatRgbMask",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25,shape=box,fontsize=10];
  "PixelFormat" -> "PixelFormatRgbMask" [arrowsize=0.5,style="setlinewidth(0.5)"];
  "PixelFormatPackedBits" [style="setlinewidth(0.5)",URL="#djvu.decode.PixelFormatPackedBits",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25,shape=box,fontsize=10];
  "PixelFormat" -> "PixelFormatPackedBits" [arrowsize=0.5,style="setlinewidth(0.5)"];
  "PixelFormatGrey" [style="setlinewidth(0.5)",URL="#djvu.decode.PixelFormatGrey",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25,shape=box,fontsize=10];
  "PixelFormat" -> "PixelFormatGrey" [arrowsize=0.5,style="setlinewidth(0.5)"];
}

class djvu.decode.PixelFormatRgb([byteorder='RGB'])

24-bit pixel format, with:

  • RGB (byteorder = 'RGB') or
  • BGR (byteorder = 'BGR')

byte order.

class djvu.decode.PixelFormatRgbMask(red_mask, green_mask, blue_mask[, xor_value], bpp=16)
class djvu.decode.PixelFormatRgbMask(red_mask, green_mask, blue_mask[, xor_value], bpp=32)

red_mask, green_mask and blue_mask are bit masks for color components for each pixel. The resulting color is then xored with the xor_value.

For example, PixelFormatRgbMask(0xf800, 0x07e0, 0x001f, bpp=16) is a highcolor format with:

  • 5 (most significant) bits for red,
  • 6 bits for green,
  • 5 (least significant) bits for blue.
class djvu.decode.PixelFormatGrey
8-bit, grey pixel format.
class djvu.decode.PixelFormatPalette(palette)

Palette pixel format.

palette must be a dictionary which contains 216 (6 x 6 x 6) entries of a web color cube, such that:

  • for each key (r, g, b): r in range(0, 6), g in range(0, 6) etc.;
  • for each value v: v in range(0, 0x100).
class djvu.decode.PixelFormatPackedBits(endianness)

Bitonal, 1 bit per pixel format with:

  • most significant bits on the left (endianness = '>') or
  • least significant bits on the left (endianness = '<').

Render modes

djvu.decode.RENDER_COLOR
Render color page or stencil.
djvu.decode.RENDER_BLACK
Render stencil or color page.
djvu.decode.RENDER_COLOR_ONLY
Render color page or fail.
djvu.decode.RENDER_MASK_ONLY
Render stencil or fail.
djvu.decode.RENDER_BACKGROUND
Render color background layer.
djvu.decode.RENDER_FOREGROUND
Render foreground background layer

Table Of Contents

Previous topic

Document pages

Next topic

Document files

This Page