PgmViewportFactory

## PgmViewportFactory PgmViewportFactory — A factory creating viewports. |

## Synopsis

    #include <pgm/pgm.h>

                        PgmViewportFactory;
    PgmViewportFactory * pgm_viewport_factory_new           (const gchar *name);
    PgmError            pgm_viewport_factory_get_description
                                                            (PgmViewportFactory *factory,
                                                             gchar **description);
    PgmError            pgm_viewport_factory_get_license    (PgmViewportFactory *factory,
                                                             gchar **license);
    PgmError            pgm_viewport_factory_get_origin     (PgmViewportFactory *factory,
                                                             gchar **origin);
    PgmError            pgm_viewport_factory_get_author     (PgmViewportFactory *factory,
                                                             gchar **author);
    PgmError            pgm_viewport_factory_create         (PgmViewportFactory *factory,
                                                             PgmViewport **viewport);
    PgmError            pgm_viewport_factory_make           (const gchar *name,
                                                             PgmViewport **viewport);

## Object Hierarchy

      GObject
       +----GstObject
             +----PgmViewportFactory

## Description

PgmViewportFactory is used to create instances of PgmViewport.

Use the `pgm_viewport_factory_new()` and `pgm_viewport_factory_create()` functions to create viewport instances or use `pgm_viewport_factory_make()` as a convenient shortcut.

The following code example shows you how to create an OpenGL based viewport.

Example 5. Using a viewport factory

    PgmViewportFactory *factory;
    PgmViewport *viewport;

    pgm_init (&argc, &argv);

    factory = pgm_viewport_factory_new ("opengl");
    pgm_viewport_factory_create (factory, &viewport);

Last reviewed on 2007-04-12 (0.1.5)

## Details

### PgmViewportFactory

    typedef struct _PgmViewportFactory PgmViewportFactory;

The PgmViewportFactory opaque structure.

### pgm_viewport_factory_new ()

    PgmViewportFactory * pgm_viewport_factory_new           (const gchar *name);

Creates a new PgmViewportFactory instance of the given `name`. PgmViewportFactory is a singleton, if a factory of the given name has already been created, this constructor returns that one with a incremented refcount. This function does not detect if the name passed as argument is an invalid name (i.e. if there is no plugin of that name). Such an error will only be detected when trying to use the factory (e.g. with `pgm_viewport_factory_create()` or with one of the pgm_viewport_factory_get*() functions.

MT safe.

`name` : | the name of the factory to create.
Returns : | a PgmViewportFactory instance or NULL if an error occurred.

### pgm_viewport_factory_get_description ()

    PgmError            pgm_viewport_factory_get_description
                                                            (PgmViewportFactory *factory,
                                                             gchar **description);

Retrieves the description of the viewports managed by `factory` in `description`.

MT safe.

`factory` : | a PgmViewportFactory object.
`description` : | a pointer to a pointer to a gchar where the description string is going to be be stored. `g_free()` after use.
Returns : | a PgmError indicating success/failure.

### pgm_viewport_factory_get_license ()

    PgmError            pgm_viewport_factory_get_license    (PgmViewportFactory *factory,
                                                             gchar **license);

Retrieves the license of the viewports managed by `factory` in `license`.

MT safe.

`factory` : | a PgmViewportFactory object.
`license` : | a pointer to a pointer to a gchar where the license string is going to be be stored. `g_free()` after use.
Returns : | a PgmError indicating success/failure.

### pgm_viewport_factory_get_origin ()

    PgmError            pgm_viewport_factory_get_origin     (PgmViewportFactory *factory,
                                                             gchar **origin);

Retrieves the origin of the viewports managed by `factory` in `origin`.

MT safe.

`factory` : | a PgmViewportFactory object.
`origin` : | a pointer to a pointer to a gchar where the origin string is going to be be stored. `g_free()` after use.
Returns : | a PgmError indicating success/failure.

### pgm_viewport_factory_get_author ()

    PgmError            pgm_viewport_factory_get_author     (PgmViewportFactory *factory,
                                                             gchar **author);

Retrieves the author of the viewports managed by `factory` in `author`.

MT safe.

`factory` : | a PgmViewportFactory object.
`author` : | a pointer to a pointer to a gchar where the author string is going to be be stored. `g_free()` after use.
Returns : | a PgmError indicating success/failure.

### pgm_viewport_factory_create ()

    PgmError            pgm_viewport_factory_create         (PgmViewportFactory *factory,
                                                             PgmViewport **viewport);

Creates a new viewport of the type defined by `factory` in `viewport`.

MT safe.

`factory` : | a PgmViewportFactory object.
`viewport` : | a pointer to a PgmViewport's pointer where the created viewport is going to be be stored.
Returns : | a PgmError indicating success/failure.

### pgm_viewport_factory_make ()

    PgmError            pgm_viewport_factory_make           (const gchar *name,
                                                             PgmViewport **viewport);

Creates a new viewport of the given `name` in `viewport`.

MT safe.

`name` : | the name of the viewport to make.
`viewport` : | a pointer to a PgmViewport's pointer where the created viewport is going to be be stored.
Returns : | a PgmError indicating success/failure.

## See Also

#PgmViewport.