GwyShader: Gwyddion Widgets Library Reference Manual

## GwyShader GwyShader — Spherical angle selector |

## Functions

GtkWidget * | gwy_shader_new ()
gdouble | gwy_shader_get_theta ()
gdouble | gwy_shader_get_phi ()
void | gwy_shader_set_theta ()
void | gwy_shader_set_phi ()
void | gwy_shader_set_angle ()
GwyGradient * | gwy_shader_get_gradient ()
void | gwy_shader_set_gradient ()

## Properties

GwyGradient * | gradient | Read / Write

## Signals

void | angle-changed | Run First

## Types and Values

struct | GwyShader
struct | GwyShaderClass

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GwyShader

## Implemented Interfaces

GwyShader implements AtkImplementorIface and GtkBuildable.

## Includes

    #include <libgwyui/gwyui.h>

## Description

GwyShader is a spherical angle selector that allows user to change angle by simply moving the north pole of a sphere around with mouse. It can display the sphere colored with a GwyGradient.

## Functions

### gwy_shader_new()

    GtkWidget *
    gwy_shader_new (void);

Creates a new spherical shader.

The widget takes up all the space allocated for it.

#### Returns

The new shader widget.

### gwy_shader_get_theta()

    gdouble
    gwy_shader_get_theta (GwyShader *shader);

Returns the theta coordinate of a shaded spherical angle selector.

#### Parameters

shader | A shaded spherical angle selector. |

#### Returns

The theta coordinate, in radians. Theta coordinate is angle from sphere's north pole.

### gwy_shader_get_phi()

    gdouble
    gwy_shader_get_phi (GwyShader *shader);

Returns the phi coordinate of a shaded spherical angle selector.

#### Parameters

shader | A shaded spherical angle selector. |

#### Returns

The phi coordinate, in radians. Phi coordinate is orientation in horizontal plane, measured from `x` axis, counterclockwise.

### gwy_shader_set_theta()

    void
    gwy_shader_set_theta (GwyShader *shader,
                          gdouble theta);

Sets the theta coordinate of a shaded spherical angle selector.

#### Parameters

shader | A shaded spherical angle selector. |
theta | The theta coordinate to set. See `gwy_shader_get_theta()` for description. |

### gwy_shader_set_phi()

    void
    gwy_shader_set_phi (GwyShader *shader,
                        gdouble phi);

Sets the phi coordinate of a shaded spherical angle selector.

#### Parameters

shader | A shaded spherical angle selector. |
phi | The phi coordinate to set. See `gwy_shader_get_phi()` for a description. |

### gwy_shader_set_angle()

    void
    gwy_shader_set_angle (GwyShader *shader,
                          gdouble theta,
                          gdouble phi);

Sets both spherical angles of a shaded spherical angle selector.

#### Parameters

shader | A shaded spherical angle selector. |
theta | The theta coordinate to set. See `gwy_shader_get_theta()` for a description. |
phi | The phi coordinate to set. See `gwy_shader_get_phi()` for a description. |

### gwy_shader_get_gradient()

    GwyGradient *
    gwy_shader_get_gradient (GwyShader *shader);

Returns the color gradient a shaded spherical angle selector uses.

If no specific gradient has been set and the default one is used, the function returns `NULL`. This is consistent with getting the corresponding property. If you still need the GwyGradient object in such case, use `gwy_gradients_get_gradient()` with `NULL` argument.

#### Parameters

shader | A shaded spherical angle selector. |

#### Returns

The current colour gradient, possibly `NULL`.

[transfer none][nullable]

### gwy_shader_set_gradient()

    void
    gwy_shader_set_gradient (GwyShader *shader,
                             GwyGradient *gradient);

Sets the gradient a shaded spherical angle selector uses.

#### Parameters

shader | A shaded spherical angle selector. |
gradient | Colour gradient shader sperical angle selector should use. | [transfer none][nullable]

## Types and Values

### struct GwyShader

    struct GwyShader;

### struct GwyShaderClass

    struct GwyShaderClass {
        GtkWidgetClass parent_class;

        void (*angle_changed)(GwyShader *shader);
    };

## Property Details

### The `“gradient”` property

      “gradient”                 GwyGradient *

Gradient to use for rendering.

Owner: GwyShader

Flags: Read / Write

## Signal Details

### The `“angle-changed”` signal

    void
    user_function (GwyShader *gwyshader,
                   gpointer   user_data)

The ::angle-changed signal is emitted when the spherical angle changes.

#### Parameters

gwyshader | The GwyShader which received the signal. |
user_data | user data set when the signal handler was connected. |

Flags: Run First