Graphics Reference
==================

Graphics elements are the way you have to draw images ad shapes on the band
canvas.

They can be useful also to make customized borders in bands.

Graphic
-------

This is the basic graphic class. You should use it only when inheriting to
create your own graphic class, never use it directly.

Its rect area is based on **left-width-top-height** dimensions.

Path: **geraldo.graphics.Graphic**

**Attributes**

- **name** - Default: None
- **visible** - Default: True

    Set False if you want to make it not visible.

- **stroke** - Default: True
- **stroke_color** - Default: reportlab.lib.colors.black
- **stroke_width** - Default: 1
- **fill** - Default: False
- **fill_color** - Default: reportlab.lib.colors.black

**Rendering attributes**

They are read-only attributes you can use in render time.

- **instance** - current object being rendered
- **generator** - generator instance
- **report** - report instance this element is in
- **band** - band this element is in
- **page** - current page

**Methods**

- **set_rect(**kwargs)**

    Used to generator set the hard rectangle when rendering pages. Override it
    to set your own rule if you need.

Fixed
-----

Path: **geraldo.graphics.Fixed**

In the same way of Graphic class, you should use this just to inhert and create
your own graphic. This is a graphic with rect with **left-right-top-bottom**
dimensioning.

Rect
----

Path: **geraldo.Rect**

A rectangle with square borders on the canvas.

**Example of use**

    >>> Rect(left=1*cm, top=0.5*cm, width=10*cm, height=0.5*cm, fill=True, fill_color=yellow)

**Attributes**

- **left** - Required
- **width** - Required
- **top** - Required
- **height** - Required

RoundRect
---------

Path: **geraldo.RoundRect**

A rectangle with rounded borders on the canvas.

**Example of use**

    >>> RoundRect(left=1*cm, top=0.5*cm, width=10*cm, height=0.5*cm, stroke=True, stroke_width=3, stroke_color=blue)

**Attributes**

- **left** - Required
- **width** - Required
- **top** - Required
- **height** - Required
- **radius** - Required

    Inform the radius number for the round corners.

Line
----

Path: **geraldo.Line**

**Example of use**

    >>> Line(left=1*cm, top=0.5*cm, right=10*cm, bottom=0.5*cm)

**Attributes**

- **left** - Required
- **width** - Required
- **right** - Required
- **bottom** - Required

Circle
------

Path: **geraldo.Circle**

**Example of use**

    >>> Circle(left_center=6*cm, top_center=3.5*cm, radius=3*cm)

**Attributes**

- **left_center** - Required
- **top_center** - Required
- **radius** - Required

Arc
---

Path: **geraldo.Arc**

**Example of use**

    >>> Arc(left=1*cm, top=0.5*cm, right=10*cm, bottom=0.5*cm, extent=50, start_angle=5)

**Attributes**

- **left** - Required
- **width** - Required
- **right** - Required
- **bottom** - Required
- **start_angle** - Default: 0
- **extent** - Default: 90

Ellipse
-------

Path: **geraldo.Ellipse**

**Example of use**

    >>> Ellipse(left=1*cm, top=0.5*cm, right=10*cm, bottom=0.5*cm)

**Attributes**

- **left** - Required
- **width** - Required
- **right** - Required
- **bottom** - Required

Image
-----

Path: **geraldo.Image**

**Example of use**

    >>> Image(left=1*cm, top=0.5*cm, right=10*cm, bottom=0.5*cm, filename='path/to/file.jpg')

**Attributes**

- **left** - Required
- **width** - Required
- **top** - Required
- **height** - Required
- **filename** - Required

    You can inform a filename path or a Python Imaging Library Image instance.
    Then you have to have this library installed.

- **get_image** - Default: None

    You should inform a function or lambda object to this attribute when you
    want to work with Images or Charts based on object values or logic.

