/* PIKA - Photo and Image Kooker Application
 * a rebranding of The GNU Image Manipulation Program (created with heckimp)
 * A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
 *
 * Original copyright, applying to most contents (license remains unchanged): 
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
 * 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 3 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, see <https://www.gnu.org/licenses/>.
 */

#ifndef __PIKA_TEMP_BUF_H__
#define __PIKA_TEMP_BUF_H__


PikaTempBuf * pika_temp_buf_new               (gint               width,
                                               gint               height,
                                               const Babl        *format) G_GNUC_WARN_UNUSED_RESULT;
PikaTempBuf * pika_temp_buf_new_from_pixbuf   (GdkPixbuf         *pixbuf,
                                               const Babl        *f_or_null) G_GNUC_WARN_UNUSED_RESULT;
PikaTempBuf * pika_temp_buf_copy              (const PikaTempBuf *src) G_GNUC_WARN_UNUSED_RESULT;

PikaTempBuf * pika_temp_buf_ref               (const PikaTempBuf *buf);
void          pika_temp_buf_unref             (const PikaTempBuf *buf);

PikaTempBuf * pika_temp_buf_scale             (const PikaTempBuf *buf,
                                               gint               width,
                                               gint               height) G_GNUC_WARN_UNUSED_RESULT;

gint          pika_temp_buf_get_width         (const PikaTempBuf *buf);
gint          pika_temp_buf_get_height        (const PikaTempBuf *buf);

const Babl  * pika_temp_buf_get_format        (const PikaTempBuf *buf);
void          pika_temp_buf_set_format        (PikaTempBuf       *buf,
                                               const Babl        *format);

guchar      * pika_temp_buf_get_data          (const PikaTempBuf *buf);
gsize         pika_temp_buf_get_data_size     (const PikaTempBuf *buf);

guchar      * pika_temp_buf_data_clear        (PikaTempBuf       *buf);

gpointer      pika_temp_buf_lock              (const PikaTempBuf *buf,
                                               const Babl        *format,
                                               GeglAccessMode     access_mode) G_GNUC_WARN_UNUSED_RESULT;
void          pika_temp_buf_unlock            (const PikaTempBuf *buf,
                                               gconstpointer      data);

gsize         pika_temp_buf_get_memsize       (const PikaTempBuf *buf);

GeglBuffer  * pika_temp_buf_create_buffer     (const PikaTempBuf *temp_buf) G_GNUC_WARN_UNUSED_RESULT;
GdkPixbuf   * pika_temp_buf_create_pixbuf     (const PikaTempBuf *temp_buf) G_GNUC_WARN_UNUSED_RESULT;

PikaTempBuf * pika_gegl_buffer_get_temp_buf   (GeglBuffer        *buffer);


/*  stats  */

guint64       pika_temp_buf_get_total_memsize (void);


#endif  /*  __PIKA_TEMP_BUF_H__  */
