gradient-context.cpp revision c5424ab93868fb819e42ef2daa8f5031cf43d130
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Gradient drawing and editing tool
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * bulia byak <buliabyak@users.sf.net>
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Abhishek Sharma
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Copyright (C) 2007 Johan Engelen
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Copyright (C) 2005 Authors
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Released under GNU GPL, read the file 'COPYING' for more information
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#include "pixmaps/cursor-gradient-add.xpm"
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosińskistatic void sp_gradient_drag(SPGradientContext &rc, Geom::Point const pt, guint state, guint32 etime);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński SPEventContext* createGradientContext() {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński bool gradientContextRegistered = ToolFactory::instance().registerObject("/tools/gradient", createGradientContext);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosińskiconst std::string& SPGradientContext::getPrefsPath() {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosińskiconst std::string SPGradientContext::prefsPath = "/tools/gradient";
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof KosińskiSPGradientContext::SPGradientContext() : SPEventContext() {
827bc501341bcc5c344c0422f13422bc368151b4Krzysztof Kosiński this->cursor_shape = cursor_gradient_xpm;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński N_("Linear gradient <b>start</b>"), //POINT_LG_BEGIN
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński N_("Radial gradient <b>focus</b>"), // POINT_RG_FOCUS
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosińskivoid SPGradientContext::selection_changed(Inkscape::Selection*) {
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński SPGradientContext *rc = (SPGradientContext *) this;
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosiński Inkscape::Selection *selection = sp_desktop_selection(SP_EVENT_CONTEXT(rc)->desktop);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński guint n_obj = g_slist_length((GSList *) selection->itemList());
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (!drag->isNonEmpty() || selection->isEmpty())
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //The use of ngettext in the following code is intentional even if the English singular form would never be used
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (drag->singleSelectedDraggerNumDraggables() == 1) {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //TRANSLATORS: %s will be substituted with the point name (see previous messages); This is part of a compound message
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński _("%s selected"),
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //TRANSLATORS: Mind the space in front. This is part of a compound message
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński ngettext(" out of %d gradient handle"," out of %d gradient handles",n_tot),
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński ngettext(" on %d selected object"," on %d selected objects",n_obj),NULL);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński rc->_message_context->setF(Inkscape::NORMAL_MESSAGE,
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński message,_(gr_handle_descr[drag->singleSelectedDraggerSingleDraggableType()]), n_tot, n_obj);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //TRANSLATORS: This is a part of a compound message (out of two more indicating: grandint handle count & object count)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński ngettext("One handle merging %d stop (drag with <b>Shift</b> to separate) selected",
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński "One handle merging %d stops (drag with <b>Shift</b> to separate) selected",drag->singleSelectedDraggerNumDraggables()),
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński ngettext(" out of %d gradient handle"," out of %d gradient handles",n_tot),
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński ngettext(" on %d selected object"," on %d selected objects",n_obj),NULL);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński rc->_message_context->setF(Inkscape::NORMAL_MESSAGE,message,drag->singleSelectedDraggerNumDraggables(), n_tot, n_obj);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //TRANSLATORS: The plural refers to number of selected gradient handles. This is part of a compound message (part two indicates selected object count)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński gchar * message = g_strconcat(ngettext("<b>%d</b> gradient handle selected out of %d","<b>%d</b> gradient handles selected out of %d",n_sel),
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //TRANSLATORS: Mind the space in front. (Refers to gradient handles selected). This is part of a compound message
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński ngettext(" on %d selected object"," on %d selected objects",n_obj),NULL);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński rc->_message_context->setF(Inkscape::NORMAL_MESSAGE,message, n_sel, n_tot, n_obj);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński } else if (n_sel == 0) {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński rc->_message_context->setF(Inkscape::NORMAL_MESSAGE,
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //TRANSLATORS: The plural refers to number of selected objects
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński ngettext("<b>No</b> gradient handles selected out of %d on %d selected object",
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński "<b>No</b> gradient handles selected out of %d on %d selected objects",n_obj), n_tot, n_obj);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Inkscape::Preferences *prefs = Inkscape::Preferences::get();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (prefs->getBool("/tools/gradient/selcue", true)) {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Inkscape::Selection *selection = sp_desktop_selection(this->desktop);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński this->_message_context = new Inkscape::MessageContext(sp_desktop_message_stack(this->desktop));
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński this->selcon = new sigc::connection(selection->connectChanged(
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński sigc::mem_fun(this, &SPGradientContext::selection_changed)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński this->subselcon = new sigc::connection(this->desktop->connectToolSubselectionChanged(
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński sigc::mem_fun(this, &SPGradientContext::selection_changed),
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosińskisp_gradient_context_select_next (SPEventContext *event_context)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński event_context->desktop->scroll_to_point(d->point, 1.0);
ef494f75ca77f36881ad59e94263a07c146c3649Krzysztof Kosińskisp_gradient_context_select_prev (SPEventContext *event_context)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński event_context->desktop->scroll_to_point(d->point, 1.0);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosińskisp_gradient_context_is_over_line (SPGradientContext *rc, SPItem *item, Geom::Point event_p)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński SPDesktop *desktop = SP_EVENT_CONTEXT (rc)->desktop;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński //Translate mouse point into proper coord system
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński rc->mousepoint_doc = desktop->w2d(event_p);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Geom::Point nearest = ls.pointAt(ls.nearestPoint(rc->mousepoint_doc));
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński double dist_screen = Geom::L2 (rc->mousepoint_doc - nearest) * desktop->current_zoom();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński double tolerance = (double) SP_EVENT_CONTEXT(rc)->tolerance;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosińskisp_gradient_context_get_stop_intervals (GrDrag *drag, GSList **these_stops, GSList **next_stops)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński // for all selected draggers
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński for (GList *i = drag->selected; i != NULL; i = i->next) {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński GrDragger *dragger = (GrDragger *) i->data;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński // remember the coord of the dragger to reselect it later
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński // for all draggables of dragger
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński for (GSList const* j = dragger->draggables; j != NULL; j = j->next) {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński GrDraggable *d = (GrDraggable *) j->data;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński // find the gradient
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński SPGradient *gradient = getGradient(d->item, d->fill_or_stroke);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński SPGradient *vector = sp_gradient_get_forked_vector_if_necessary (gradient, false);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński // these draggable types cannot have a next draggabe to insert a stop between them
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński // from draggables to stops
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński SPStop *this_stop = sp_get_stop_i (vector, d->point_i);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński SPStop *next_stop = this_stop->getNextStop();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński SPStop *last_stop = sp_last_stop (vector);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński Inkscape::PaintTarget fs = d->fill_or_stroke;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński // if there's a next stop,
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński // find its dragger
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński // (complex because it may have different types, and because in radial,
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński // more than one dragger may correspond to a stop, so we must distinguish)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (type == POINT_LG_BEGIN || type == POINT_LG_MID) {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński dnext = drag->getDraggerFor(item, POINT_LG_END, p_i+1, fs);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński dnext = drag->getDraggerFor(item, POINT_LG_MID, p_i+1, fs);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński } else { // radial
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (type == POINT_RG_CENTER || type == POINT_RG_MID1) {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński dnext = drag->getDraggerFor(item, POINT_RG_R1, p_i+1, fs);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński dnext = drag->getDraggerFor(item, POINT_RG_MID1, p_i+1, fs);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński (type == POINT_RG_CENTER && dnext && !dnext->isSelected())) {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński dnext = drag->getDraggerFor(item, POINT_RG_R2, p_i+1, fs);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński dnext = drag->getDraggerFor(item, POINT_RG_MID2, p_i+1, fs);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński // if both adjacent draggers selected,
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (!g_slist_find(*these_stops, this_stop) && dnext && dnext->isSelected()) {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński // remember the coords of the future dragger to select it
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński coords.push_back(0.5*(dragger->point + dnext->point));
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński // do not insert a stop now, it will confuse the loop;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński // just remember the stops
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński *these_stops = g_slist_prepend (*these_stops, this_stop);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński *next_stops = g_slist_prepend (*next_stops, next_stop);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosińskisp_gradient_context_add_stops_between_selected_stops (SPGradientContext *rc)
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński std::vector<Geom::Point> coords = sp_gradient_context_get_stop_intervals (drag, &these_stops, &next_stops);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (g_slist_length(these_stops) == 0 && drag->numSelected() == 1) {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński // if a single stop is selected, add between that stop and the next one
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński GrDragger *dragger = (GrDragger *) drag->selected->data;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński for (GSList const* j = dragger->draggables; j != NULL; j = j->next) {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński GrDraggable *d = (GrDraggable *) j->data;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * There are 2 draggables at the center (start) of a radial gradient
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * To avoid creating 2 seperate stops, ignore this draggable point type
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński SPGradient *gradient = getGradient(d->item, d->fill_or_stroke);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński SPGradient *vector = sp_gradient_get_forked_vector_if_necessary (gradient, false);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński SPStop *this_stop = sp_get_stop_i (vector, d->point_i);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński SPStop *next_stop = this_stop->getNextStop();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński these_stops = g_slist_prepend (these_stops, this_stop);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński next_stops = g_slist_prepend (next_stops, next_stop);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński // now actually create the new stops
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński for (; i != NULL && j != NULL; i = i->next, j = j->next) {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński gfloat offset = 0.5*(this_stop->offset + next_stop->offset);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński SPStop *new_stop = sp_vector_add_stop (SP_GRADIENT (parent), this_stop, next_stop, offset);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński new_stops = g_slist_prepend (new_stops, new_stop);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński if (g_slist_length(these_stops) > 0 && doc) {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński DocumentUndo::done(doc, SP_VERB_CONTEXT_GRADIENT, _("Add gradient stop"));
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński // so that it does not automatically update draggers in idle loop, as this would deselect
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński // select the newly created stops
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński for (GSList *s = new_stops; s != NULL; s = s->next) {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosińskistatic double sqr(double x) {return x*x;}
std::vector<Geom::Point> coords = sp_gradient_context_get_stop_intervals (drag, &these_stops, &next_stops);
if (next_next) {
double diff =
sp_gradient_context_add_stop_near_point (SPGradientContext *rc, SPItem *item, Geom::Point mouse_p, guint32 /*etime*/)
SPStop *newstop = ec->get_drag()->addStopNearPoint (item, mouse_p, tolerance/desktop->current_zoom());
static bool dragging;
double const nudge = prefs->getDoubleLimited("/options/nudgedistance/value", 2, 0, 1000, "px"); // in px
case GDK_2BUTTON_PRESS:
bool over_line = false;
over_line |= sp_gradient_context_is_over_line (this, (SPItem*) line, Geom::Point(event->motion.x, event->motion.y));
if (over_line) {
sp_gradient_context_add_stop_near_point(this, SP_ITEM(selection->itemList()->data), this->mousepoint_doc, event->button.time);
SPGradientType new_type = (SPGradientType) prefs->getInt("/tools/gradient/newgradient", SP_GRADIENT_TYPE_LINEAR);
Inkscape::PaintTarget fsmode = (prefs->getInt("/tools/gradient/newfillorstroke", 1) != 0) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE;
SPGradient *vector = sp_gradient_vector_for_object(sp_desktop_document(desktop), desktop, item, fsmode);
case GDK_BUTTON_PRESS:
this->within_tolerance = true;
dragging = true;
this->item_to_select = sp_event_context_find_item (desktop, button_w, event->button.state & GDK_MOD1_MASK, TRUE);
m.unSetup();
case GDK_MOTION_NOTIFY:
if ( this->within_tolerance
this->within_tolerance = false;
this->defaultMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Draw around</b> handles to select them"));
m.unSetup();
bool over_line = false;
over_line |= sp_gradient_context_is_over_line (this, (SPItem*) l->data, Geom::Point(event->motion.x, event->motion.y));
this->sp_event_context_update_cursor();
this->cursor_addnode = false;
this->sp_event_context_update_cursor();
this->cursor_addnode = true;
case GDK_BUTTON_RELEASE:
bool over_line = false;
over_line = sp_gradient_context_is_over_line (this, (SPItem*) line, Geom::Point(event->motion.x, event->motion.y));
if (over_line)
dragging = false;
if (!this->within_tolerance) {
} else if (this->item_to_select) {
case GDK_KEY_PRESS:
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
case GDK_KEY_Control_R:
case GDK_KEY_Shift_L:
case GDK_KEY_Shift_R:
case GDK_KEY_Meta_R:
NULL);
case GDK_KEY_x:
case GDK_KEY_X:
case GDK_KEY_A:
case GDK_KEY_a:
case GDK_KEY_L:
case GDK_KEY_l:
case GDK_KEY_Escape:
case GDK_KEY_KP_Left:
case GDK_KEY_KP_4:
case GDK_KEY_KP_Up:
case GDK_KEY_KP_8:
case GDK_KEY_KP_Right:
case GDK_KEY_KP_6:
case GDK_KEY_KP_Down:
case GDK_KEY_KP_2:
case GDK_KEY_r:
case GDK_KEY_R:
case GDK_KEY_Insert:
case GDK_KEY_KP_Insert:
case GDK_KEY_Delete:
case GDK_KEY_KP_Delete:
case GDK_KEY_BackSpace:
case GDK_KEY_RELEASE:
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
case GDK_KEY_Control_R:
case GDK_KEY_Shift_L:
case GDK_KEY_Shift_R:
case GDK_KEY_Meta_R:
if (!ret) {
return ret;
static void sp_gradient_drag(SPGradientContext &rc, Geom::Point const pt, guint /*state*/, guint32 etime)
Inkscape::PaintTarget fill_or_stroke = (prefs->getInt("/tools/gradient/newfillorstroke", 1) != 0) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE;
vector = sp_gradient_vector_for_object(document, desktop, SP_ITEM(g_slist_last(items)->data), fill_or_stroke);
// HACK: reset fill-opacity - that 0.75 is annoying; BUT remove this when we have an opacity slider for all tabs
sp_item_gradient_set_coords (SP_ITEM(i->data), POINT_LG_BEGIN, 0, rc.origin, fill_or_stroke, true, false);
sp_item_gradient_set_coords (SP_ITEM(i->data), POINT_RG_CENTER, 0, rc.origin, fill_or_stroke, true, false);
sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select <b>objects</b> on which to create gradient."));