// Generated by gmmproc 2.84.0 -- DO NOT MODIFY!


#include <glibmm.h>

#include <gdkmm/texturedownloader.h>
#include <gdkmm/private/texturedownloader_p.h>


/* Copyright (C) 2023 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/colorstate.h>
#include <gdk/gdk.h>

namespace Gdk
{

TextureDownloader::TextureDownloader(const Glib::RefPtr<Texture>& texture)
: gobject_(gdk_texture_downloader_new(texture->gobj()))
{
}

} //namespace Gdk

namespace
{
} // anonymous namespace


namespace Glib
{

Gdk::TextureDownloader wrap(GdkTextureDownloader* object, bool take_copy)
{
  return Gdk::TextureDownloader(object, take_copy);
}

} // namespace Glib


namespace Gdk
{


// static
GType TextureDownloader::get_type()
{
  return gdk_texture_downloader_get_type();
}

TextureDownloader::TextureDownloader()
:
  gobject_ (nullptr) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
{}

TextureDownloader::TextureDownloader(const TextureDownloader& other)
:
  gobject_ ((other.gobject_) ? gdk_texture_downloader_copy(other.gobject_) : nullptr)
{}

TextureDownloader::TextureDownloader(TextureDownloader&& other) noexcept
:
  gobject_(other.gobject_)
{
  other.gobject_ = nullptr;
}

TextureDownloader& TextureDownloader::operator=(TextureDownloader&& other) noexcept
{
  TextureDownloader temp (std::move(other));
  swap(temp);
  return *this;
}

TextureDownloader::TextureDownloader(GdkTextureDownloader* gobject, bool make_a_copy)
:
  // For BoxedType wrappers, make_a_copy is true by default.  The static
  // BoxedType wrappers must always take a copy, thus make_a_copy = true
  // ensures identical behaviour if the default argument is used.
  gobject_ ((make_a_copy && gobject) ? gdk_texture_downloader_copy(gobject) : gobject)
{}

TextureDownloader& TextureDownloader::operator=(const TextureDownloader& other)
{
  TextureDownloader temp (other);
  swap(temp);
  return *this;
}

TextureDownloader::~TextureDownloader() noexcept
{
  if(gobject_)
    gdk_texture_downloader_free(gobject_);
}

void TextureDownloader::swap(TextureDownloader& other) noexcept
{
  std::swap(gobject_, other.gobject_);
}

GdkTextureDownloader* TextureDownloader::gobj_copy() const
{
  return gdk_texture_downloader_copy(gobject_);
}


void TextureDownloader::set_texture(const Glib::RefPtr<Texture>& texture)
{
  gdk_texture_downloader_set_texture(gobj(), Glib::unwrap(texture));
}

Glib::RefPtr<Texture> TextureDownloader::get_texture()
{
  auto retvalue = Glib::wrap(gdk_texture_downloader_get_texture(gobj()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const Texture> TextureDownloader::get_texture() const
{
  return const_cast<TextureDownloader*>(this)->get_texture();
}

void TextureDownloader::set_format(MemoryFormat format)
{
  gdk_texture_downloader_set_format(gobj(), static_cast<GdkMemoryFormat>(format));
}

MemoryFormat TextureDownloader::get_format() const
{
  return static_cast<MemoryFormat>(gdk_texture_downloader_get_format(const_cast<GdkTextureDownloader*>(gobj())));
}

Glib::RefPtr<ColorState> TextureDownloader::get_color_state() const
{
  auto retvalue = Glib::wrap(gdk_texture_downloader_get_color_state(const_cast<GdkTextureDownloader*>(gobj())));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

void TextureDownloader::set_color_state(const Glib::RefPtr<const ColorState>& color_state)
{
  gdk_texture_downloader_set_color_state(gobj(), const_cast<GdkColorState*>(Glib::unwrap(color_state)));
}

void TextureDownloader::download_into(guchar* data, gsize stride) const
{
  gdk_texture_downloader_download_into(const_cast<GdkTextureDownloader*>(gobj()), data, stride);
}

Glib::RefPtr<Glib::Bytes> TextureDownloader::download_bytes(gsize& out_stride) const
{
  return Glib::wrap(gdk_texture_downloader_download_bytes(const_cast<GdkTextureDownloader*>(gobj()), &(out_stride)));
}

Glib::RefPtr<Glib::Bytes> TextureDownloader::download_bytes_with_planes(ArrayPlanes& out_offsets, ArrayPlanes& out_strides) const
{
  return Glib::wrap(gdk_texture_downloader_download_bytes_with_planes(const_cast<GdkTextureDownloader*>(gobj()), out_offsets.data(), out_strides.data()));
}


} // namespace Gdk


