rawTherapee/rtgui/rtsurface.h
Pandagrapher 50e54aa395 Convert remaining RTPixbuf to RTSurface
Changes:
- Remove RTPixbuf use in directory browser to use native GTK mechanism
- Replace RTPixbuf by RTSurface for thumbnail icons
- Remove now useless RTPixbuf class

Fixes:
- Elaborate RTSurface width / height based on the type
2022-08-27 11:37:59 +02:00

56 lines
1.6 KiB
C++

/*
* This file is part of RawTherapee.
*
* Copyright (c) 2018 Jean-Christophe FRISCH <natureh.510@gmail.com>
* Copyright (c) 2022 Pierre CABRERA <pierre.cab@gmail.com>
*
* RawTherapee 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.
*
* RawTherapee 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 RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "rtscalable.h"
/**
* @brief A custom class in order to handle Hi-DPI surface.
*/
class RTSurface final : public RTScalable
{
public:
enum RTSurfaceType {
InvalidType = 1,
IconType = 2,
PNGType = 3,
SVGType = 4
};
private:
double dpiBack; // Used to identify dpi change
int scaleBack; // Used to identify scale change
RTSurfaceType type;
Glib::ustring name;
Gtk::IconSize icon_size;
Cairo::RefPtr<Cairo::ImageSurface> surface;
public:
RTSurface();
explicit RTSurface(const Glib::ustring &icon_name, const Gtk::IconSize iconSize);
explicit RTSurface(const Glib::ustring &fname);
int getWidth();
int getHeight();
bool hasSurface();
Cairo::RefPtr<Cairo::ImageSurface> get();
};