/* Copyright (C) 2020 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 */

#include <gdkmm/texture.h>
#include <glibmm/bytes.h>
#include <gdk/gdk.h> // For GDK_MEMORY_DEFAULT

_DEFS(gdkmm,gdk)
_PINCLUDE(gdkmm/private/texture_p.h)

namespace Gdk
{
/** A Gdk::Texture representing image data in memory.
 *
 * @newin{3,98}
 */
class GDKMM_API MemoryTexture : public Gdk::Texture
{
  _CLASS_GOBJECT(MemoryTexture, GdkMemoryTexture, GDK_MEMORY_TEXTURE, Gdk::Texture, GdkTexture, , , GDKMM_API)

protected:
  _CTOR_DEFAULT()

public:
  _WRAP_ENUM(Format, GdkMemoryFormat, decl_prefix GDKMM_API)

  /** Default memory format used by GTK.
   *
   * It is the format provided by Gdk::Texture::download().
   * It is equal to Cairo::Surface::Format::ARGB32.
   *
   * Be aware that unlike the Format values, this format is
   * different for different endianness.
   */
  static const Format DEFAULT_FORMAT = static_cast<Format>(GDK_MEMORY_DEFAULT);

  // gdk_memory_texture_new() does more than call g_object_new().
  _WRAP_METHOD(static Glib::RefPtr<Texture> create(int width, int height,
    Format format, const Glib::RefPtr<const Glib::Bytes>& bytes, gsize stride),
    gdk_memory_texture_new)

  // There are no public signals, properties or vfuncs.
};

} // namespace Gdk
