/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
* Copyright (C) 2002-2004 Sven Neumann
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* @image: the #GimpImage the layer should belong to
* @text: a #GimpText object
* Creates a new text layer.
* Return value: a new #GimpTextLayer or %NULL in case of a problem
gimp_text_layer_new (GimpImage *image,
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (GIMP_IS_TEXT (text), NULL);
if (! text->text)
layer = g_object_new (GIMP_TYPE_TEXT_LAYER, NULL);
gimp_drawable_configure (GIMP_DRAWABLE (layer),
0, 0, 1, 1,
gimp_text_layer_set_text (layer, text);
if (! gimp_text_layer_render (layer))
return GIMP_LAYER (layer);