/usr/include/gdkmm-3.0/gdkmm/pixbuf.h is in libgtkmm-3.0-dev 3.22.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 | // Generated by gmmproc 2.54.0 -- DO NOT MODIFY!
#ifndef _GDKMM_PIXBUF_H
#define _GDKMM_PIXBUF_H
#include <gdkmmconfig.h>
#include <glibmm/ustring.h>
#include <sigc++/sigc++.h>
/* Copyright (C) 1998-2002 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
// This is for including the config header before any code (such as
// the #ifndef GDKMM_DISABLE_DEPRECATED in deprecated classes) is generated:
#include <vector>
//#include <gdkmm/window.h>
#include <gdkmm/pixbufformat.h>
#include <gdkmm/types.h>
#include <giomm/inputstream.h>
#include <giomm/icon.h>
#include <cairomm/surface.h>
#include <glibmm/error.h>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
using GdkPixbuf = struct _GdkPixbuf;
using GdkPixbufClass = struct _GdkPixbufClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Gdk
{ class Pixbuf_Class; } // namespace Gdk
#endif //DOXYGEN_SHOULD_SKIP_THIS
namespace Gdk
{
class Window;
/** @addtogroup gdkmmEnums gdkmm Enums and Flags */
/**
* @var Colorspace COLORSPACE_RGB
* Indicates a red/green/blue additive color space.
*
* @enum Colorspace
*
* This enumeration defines the color spaces that are supported by
* the gdk-pixbuf library. Currently only RGB is supported.
*
* @ingroup gdkmmEnums
*/
enum Colorspace
{
COLORSPACE_RGB
};
} // namespace Gdk
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{
template <>
class Value<Gdk::Colorspace> : public Glib::Value_Enum<Gdk::Colorspace>
{
public:
static GType value_type() G_GNUC_CONST;
};
} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Gdk
{
/**
* @var InterpType INTERP_NEAREST
* Nearest neighbor sampling; this is the fastest
* and lowest quality mode. Quality is normally unacceptable when scaling
* down, but may be OK when scaling up.
*
* @var InterpType INTERP_TILES
* This is an accurate simulation of the PostScript
* image operator without any interpolation enabled. Each pixel is
* rendered as a tiny parallelogram of solid color, the edges of which
* are implemented with antialiasing. It resembles nearest neighbor for
* enlargement, and bilinear for reduction.
*
* @var InterpType INTERP_BILINEAR
* Best quality/speed balance; use this mode by
* default. Bilinear interpolation. For enlargement, it is
* equivalent to point-sampling the ideal bilinear-interpolated image.
* For reduction, it is equivalent to laying down small tiles and
* integrating over the coverage area.
*
* @var InterpType INTERP_HYPER
* This is the slowest and highest quality
* reconstruction function. It is derived from the hyperbolic filters in
* Wolberg's "Digital Image Warping", and is formally defined as the
* hyperbolic-filter sampling the ideal hyperbolic-filter interpolated
* image (the filter is designed to be idempotent for 1:1 pixel mapping).
*
* @enum InterpType
*
* This enumeration describes the different interpolation modes that
* can be used with the scaling functions. @a GDK_INTERP_NEAREST is
* the fastest scaling method, but has horrible quality when
* scaling down. @a GDK_INTERP_BILINEAR is the best choice if you
* aren't sure what to choose, it has a good speed/quality balance.
*
* <note>
* Cubic filtering is missing from the list; hyperbolic
* interpolation is just as fast and results in higher quality.
* </note>
*
* @ingroup gdkmmEnums
*/
enum InterpType
{
INTERP_NEAREST,
INTERP_TILES,
INTERP_BILINEAR,
INTERP_HYPER
};
} // namespace Gdk
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{
template <>
class Value<Gdk::InterpType> : public Glib::Value_Enum<Gdk::InterpType>
{
public:
static GType value_type() G_GNUC_CONST;
};
} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Gdk
{
/**
* @var PixbufAlphaMode PIXBUF_ALPHA_BILEVEL
* A bilevel clipping mask (black and white)
* will be created and used to draw the image. Pixels below 0.5 opacity
* will be considered fully transparent, and all others will be
* considered fully opaque.
*
* @var PixbufAlphaMode PIXBUF_ALPHA_FULL
* For now falls back to Gdk::PIXBUF_ALPHA_BILEVEL.
* In the future it will do full alpha compositing.
*
* @enum PixbufAlphaMode
*
* These values can be passed to
* gdk_pixbuf_render_to_drawable_alpha() to control how the alpha
* channel of an image should be handled. This function can create a
* bilevel clipping mask (black and white) and use it while painting
* the image. In the future, when the X %Window System gets an alpha
* channel extension, it will be possible to do full alpha
* compositing onto arbitrary drawables. For now both cases fall
* back to a bilevel clipping mask.
*
* @ingroup gdkmmEnums
*/
enum PixbufAlphaMode
{
PIXBUF_ALPHA_BILEVEL,
PIXBUF_ALPHA_FULL
};
} // namespace Gdk
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{
template <>
class Value<Gdk::PixbufAlphaMode> : public Glib::Value_Enum<Gdk::PixbufAlphaMode>
{
public:
static GType value_type() G_GNUC_CONST;
};
} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Gdk
{
/**
* @var PixbufRotation PIXBUF_ROTATE_NONE
* No rotation.
*
* @var PixbufRotation PIXBUF_ROTATE_COUNTERCLOCKWISE
* Rotate by 90 degrees.
*
* @var PixbufRotation PIXBUF_ROTATE_UPSIDEDOWN
* Rotate by 180 degrees.
*
* @var PixbufRotation PIXBUF_ROTATE_CLOCKWISE
* Rotate by 270 degrees.
*
* @enum PixbufRotation
*
* The possible rotations which can be passed to Gdk::Pixbuf::rotate_simple().
* To make them easier to use, their numerical values are the actual degrees.
*
* @ingroup gdkmmEnums
*/
enum PixbufRotation
{
PIXBUF_ROTATE_NONE = 0,
PIXBUF_ROTATE_COUNTERCLOCKWISE = 90,
PIXBUF_ROTATE_UPSIDEDOWN = 180,
PIXBUF_ROTATE_CLOCKWISE = 270
};
} // namespace Gdk
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{
template <>
class Value<Gdk::PixbufRotation> : public Glib::Value_Enum<Gdk::PixbufRotation>
{
public:
static GType value_type() G_GNUC_CONST;
};
} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Gdk
{
/** %Exception class for Gdk::Pixbuf errors.
*/
class PixbufError : public Glib::Error
{
public:
/** @var Code CORRUPT_IMAGE
* An image file was broken somehow.
*
* @var Code INSUFFICIENT_MEMORY
* Not enough memory.
*
* @var Code BAD_OPTION
* A bad option was passed to a pixbuf save module.
*
* @var Code UNKNOWN_TYPE
* Unknown image type.
*
* @var Code UNSUPPORTED_OPERATION
* Don't know how to perform the
* given operation on the type of image at hand.
*
* @var Code FAILED
* Generic failure code, something went wrong.
*
* @var Code INCOMPLETE_ANIMATION
* Only part of the animation was loaded.
*
* @enum Code
*
* An error code in the Gdk::PIXBUF_ERROR domain. Many gdk-pixbuf
* operations can cause errors in this domain, or in the FILE_ERROR
* domain.
*/
enum Code
{
CORRUPT_IMAGE,
INSUFFICIENT_MEMORY,
BAD_OPTION,
UNKNOWN_TYPE,
UNSUPPORTED_OPERATION,
FAILED,
INCOMPLETE_ANIMATION
};
PixbufError(Code error_code, const Glib::ustring& error_message);
explicit PixbufError(GError* gobject);
Code code() const;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
static void throw_func(GError* gobject);
friend void wrap_init(); // uses throw_func()
#endif //DOXYGEN_SHOULD_SKIP_THIS
};
} // namespace Gdk
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{
template <>
class Value<Gdk::PixbufError::Code> : public Glib::Value_Enum<Gdk::PixbufError::Code>
{
public:
static GType value_type() G_GNUC_CONST;
};
} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Gdk
{
class Pixbuf
: public Glib::Object,
public Gio::Icon
{
#ifndef DOXYGEN_SHOULD_SKIP_THIS
public:
using CppObjectType = Pixbuf;
using CppClassType = Pixbuf_Class;
using BaseObjectType = GdkPixbuf;
using BaseClassType = GdkPixbufClass;
// noncopyable
Pixbuf(const Pixbuf&) = delete;
Pixbuf& operator=(const Pixbuf&) = delete;
private: friend class Pixbuf_Class;
static CppClassType pixbuf_class_;
protected:
explicit Pixbuf(const Glib::ConstructParams& construct_params);
explicit Pixbuf(GdkPixbuf* castitem);
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
public:
Pixbuf(Pixbuf&& src) noexcept;
Pixbuf& operator=(Pixbuf&& src) noexcept;
~Pixbuf() noexcept override;
/** Get the GType for this class, for use with the underlying GObject type system.
*/
static GType get_type() G_GNUC_CONST;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
static GType get_base_type() G_GNUC_CONST;
#endif
///Provides access to the underlying C GObject.
GdkPixbuf* gobj() { return reinterpret_cast<GdkPixbuf*>(gobject_); }
///Provides access to the underlying C GObject.
const GdkPixbuf* gobj() const { return reinterpret_cast<GdkPixbuf*>(gobject_); }
///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
GdkPixbuf* gobj_copy();
private:
protected:
//TODO: Throw an exception when the C function returns NULL?
/** Transfers image data from a #GdkWindow and converts it to an RGB(A)
* representation inside a Gdk::Pixbuf. In other words, copies
* image data from a server-side drawable to a client-side RGB(A) buffer.
* This allows you to efficiently read individual pixels on the client side.
*
* This function will create an RGB pixbuf with 8 bits per channel with
* the same size specified by the @a width and @a height arguments. The pixbuf
* will contain an alpha channel if the @a window contains one.
*
* If the window is off the screen, then there is no image data in the
* obscured/offscreen regions to be placed in the pixbuf. The contents of
* portions of the pixbuf corresponding to the offscreen region are undefined.
*
* If the window you're obtaining data from is partially obscured by
* other windows, then the contents of the pixbuf areas corresponding
* to the obscured regions are undefined.
*
* If the window is not mapped (typically because it's iconified/minimized
* or not on the current workspace), then an invalid object will be returned.
*
* If memory can't be allocated for the return value, an invalid object will be returned
* instead.
*
* @param src Source window.
* @param src_x Source X coordinate within the window.
* @param src_y Source Y coordinate within the window.
* @param width Width in pixels of region to get.
* @param height Height in pixels of region to get.
*
* @newin{2,12}
*/
Pixbuf(const Glib::RefPtr<Window>& src,
int src_x, int src_y, int width, int height);
/** Transfers image data from a Cairo::Surface and converts it to an RGB(A)
* representation inside a Gdk::Pixbuf. This allows you to efficiently read
* individual pixels from cairo surfaces. For Gdk::Windows, use the
* constructor that takes a Gdk::Window instead.
*
* This will create an RGB pixbuf with 8 bits per channel. The pixbuf will contain an alpha channel if the surface contains one.
*
* @param src Surface to copy from.
* @param src_x Source X coordinate within the surface.
* @param src_y Source Y coordinate within the surface.
* @param width Width in pixels of region to get.
* @param height Height in pixels of region to get.
*
* @newin{2,30}
*/
Pixbuf(const ::Cairo::RefPtr< ::Cairo::Surface>& src,
int src_x, int src_y, int width, int height);
public:
typedef sigc::slot<void, const guint8*> SlotDestroyData;
/** Transfers image data from a #GdkWindow and converts it to an RGB(A)
* representation inside a Gdk::Pixbuf. In other words, copies
* image data from a server-side drawable to a client-side RGB(A) buffer.
* This allows you to efficiently read individual pixels on the client side.
*
* This function will create an RGB pixbuf with 8 bits per channel with
* the same size specified by the @a width and @a height arguments. The pixbuf
* will contain an alpha channel if the @a window contains one.
*
* If the window is off the screen, then there is no image data in the
* obscured/offscreen regions to be placed in the pixbuf. The contents of
* portions of the pixbuf corresponding to the offscreen region are undefined.
*
* If the window you're obtaining data from is partially obscured by
* other windows, then the contents of the pixbuf areas corresponding
* to the obscured regions are undefined.
*
* If the window is not mapped (typically because it's iconified/minimized
* or not on the current workspace), then an invalid object will be returned.
*
* If memory can't be allocated for the return value, an invalid object will be returned
* instead.
*
* @param src Source window.
* @param src_x Source X coordinate within the window.
* @param src_y Source Y coordinate within the window.
* @param width Width in pixels of region to get.
* @param height Height in pixels of region to get.
*
* @newin{2,12}
*/
static Glib::RefPtr<Pixbuf> create(const Glib::RefPtr<Window>& src, int src_x, int src_y, int width, int height);
/** Transfers image data from a Cairo::Surface and converts it to an RGB(A)
* representation inside a Gdk::Pixbuf. This allows you to efficiently read
* individual pixels from cairo surfaces. For Gdk::Windows, use the
* create() method that takes a Gdk::Window instead.
*
* This will create an RGB pixbuf with 8 bits per channel. The pixbuf will contain an alpha channel if the surface contains one.
*
* @param src Surface to copy from.
* @param src_x Source X coordinate within the surface.
* @param src_y Source Y coordinate within the surface.
* @param width Width in pixels of region to get.
* @param height Height in pixels of region to get.
*
* @newin{2,30}
*/
static Glib::RefPtr<Pixbuf> create(const ::Cairo::RefPtr< ::Cairo::Surface>& src, int src_x, int src_y, int width, int height);
/** Creates a new Gdk::Pixbuf with a copy of the information in the specified
* @a pixbuf. Note that this does not copy the options set on the original Gdk::Pixbuf,
* use copy_options() for this.
*
* @return A newly-created pixbuf with a reference count of 1, or <tt>nullptr</tt> if
* not enough memory could be allocated.
*/
Glib::RefPtr<Pixbuf> copy() const;
/** Creates a new Gdk::Pixbuf structure and allocates a buffer for it. The
* buffer has an optimal rowstride. Note that the buffer is not cleared;
* you will have to fill it completely yourself.
*
* @param colorspace Color space for image.
* @param has_alpha Whether the image should have transparency information.
* @param bits_per_sample Number of bits per color sample.
* @param width Width of image in pixels, must be > 0.
* @param height Height of image in pixels, must be > 0.
* @return A newly-created Gdk::Pixbuf with a reference count of 1, or
* <tt>nullptr</tt> if not enough memory could be allocated for the image buffer.
*/
static Glib::RefPtr<Pixbuf> create(Colorspace colorspace, bool has_alpha, int bits_per_sample, int width, int height);
/** Creates a new pixbuf which represents a sub-region of @a src_pixbuf.
* The new pixbuf shares its pixels with the original pixbuf, so
* writing to one affects both. The new pixbuf holds a reference to
* @a src_pixbuf, so @a src_pixbuf will not be finalized until the new
* pixbuf is finalized.
*
* Note that if @a src_pixbuf is read-only, this function will force it
* to be mutable.
*
* @param src_pixbuf A Gdk::Pixbuf.
* @param src_x X coord in @a src_pixbuf.
* @param src_y Y coord in @a src_pixbuf.
* @param width Width of region in @a src_pixbuf.
* @param height Height of region in @a src_pixbuf.
* @return A new pixbuf.
*/
static Glib::RefPtr<Pixbuf> create_subpixbuf(const Glib::RefPtr<Pixbuf>& src_pixbuf, int src_x, int src_y, int width, int height);
/** Creates a new pixbuf by loading an image from a file. The file format is detected automatically.
* @param filename The path to the pixbuf file.
*
* @throw Glib::FileError
* @throw Gdk::PixbufError
*/
static Glib::RefPtr<Pixbuf> create_from_file(const std::string& filename);
/** Creates a new pixbuf by loading an image from a file. The file format is detected automatically.
* The image will be scaled to fit in the requested size.
* @param filename The path to the pixbuf file.
* @param width The desired width
* @param height The desired height
* @param preserve_aspect_ratio Whether the image's aspect ratio will be preserved when scaling.
*
* @throw Glib::FileError
* @throw Gdk::PixbufError
*/
static Glib::RefPtr<Pixbuf> create_from_file(const std::string& filename, int width, int height, bool preserve_aspect_ratio = true);
//gdk_pixbuf_new_from_file_at_size() just calls gdk_pixbuf_new_from_file_at_scale().
/** Creates a new pixbuf by loading an image from a resource. The file format is detected automatically.
* @param resource_path The path of the resource file.
*
* @throw Gio::ResourceError
* @throw Gdk::PixbufError
*
* @newin{3,12}
*/
static Glib::RefPtr<Pixbuf> create_from_resource(const std::string& resource_path);
/** Creates a new pixbuf by loading an image from a resource. The file format is detected automatically.
* The image will be scaled to fit in the requested size, optionally
* preserving the image's aspect ratio. When preserving the aspect ratio,
* a @a width of -1 will cause the image to be scaled to the exact given
* height, and a @a height of -1 will cause the image to be scaled to the
* exact given width. When not preserving aspect ratio, a @a width or
* @a height of -1 means to not scale the image at all in that dimension.
* @param resource_path The path of the resource file.
* @param width The desired width
* @param height The desired height
* @param preserve_aspect_ratio Whether the image's aspect ratio will be preserved when scaling.
*
* @throw Gio::ResourceError
* @throw Gdk::PixbufError
*
* @newin{3,12}
*/
static Glib::RefPtr<Pixbuf> create_from_resource(const std::string& resource_path, int width, int height, bool preserve_aspect_ratio = true);
/** Creates a new Gdk::Pixbuf out of in-memory image data.
* Currently only RGB images with 8 bits per sample are supported.
*
* @param data %Image data in 8-bit/sample packed format.
* @param colorspace Colorspace for the image data.
* @param has_alpha Whether the data has an opacity channel.
* @param bits_per_sample Number of bits per sample.
* @param width Width of the image in pixels.
* @param height Height of the image in pixels.
* @param rowstride Distance in bytes between rows.
* @return A newly-created Gdk::Pixbuf object.
*/
static Glib::RefPtr<Pixbuf> create_from_data(const guint8* data, Colorspace colorspace,
bool has_alpha, int bits_per_sample,
int width, int height, int rowstride);
/** Creates a new Gdk::Pixbuf out of in-memory image data.
* Currently only RGB images with 8 bits per sample are supported.
*
* @param data %Image data in 8-bit/sample packed format.
* @param colorspace Colorspace for the image data.
* @param has_alpha Whether the data has an opacity channel.
* @param bits_per_sample Number of bits per sample.
* @param width Width of the image in pixels.
* @param height Height of the image in pixels.
* @param rowstride Distance in bytes between rows.
* @param destroy_slot Slot used to free the data when the pixbuf's
* reference count drops to zero.
* @return A newly-created Gdk::Pixbuf object.
*/
static Glib::RefPtr<Pixbuf> create_from_data(const guint8* data, Colorspace colorspace,
bool has_alpha, int bits_per_sample,
int width, int height, int rowstride,
const SlotDestroyData& destroy_slot);
/** Creates a new pixbuf by parsing XPM data in memory. This data is commonly
* the result of including an XPM file into a program's C source.
*
* @param data Pointer to inline XPM data.
* @return A newly-created pixbuf with a reference count of 1.
*/
static Glib::RefPtr<Pixbuf> create_from_xpm_data(const char *const * data);
#ifndef GDKMM_DISABLE_DEPRECATED
/** Create a Gdk::Pixbuf from a flat representation that is suitable for
* storing as inline data in a program. This is useful if you want to ship a
* program with images, but don't want to depend on any external files.
*
* GTK+ ships with a program called <tt>gdk-pixbuf-csource</tt> which allows
* for conversion of GdkPixbufs into such a inline representation. In almost
* all cases, you should pass the <tt>--raw</tt> flag to
* <tt>gdk-pixbuf-csource</tt>. A sample invocation would be:
*
* <tt>gdk-pixbuf-csource --raw --name=myimage_inline myimage.png</tt>
*
* For the typical case where the inline pixbuf is read-only static data, you
* don't need to copy the pixel data unless you intend to write to it, so you
* can pass <tt>false</tt> for @a copy_pixels. (If you pass <tt>--rle</tt> to
* <tt>gdk-pixbuf-csource</tt>, a copy will be made even if @a copy_pixels is
* <tt>false</tt>, so using this option is generally a bad idea.)
*
* If you create a pixbuf from const inline data compiled into your program,
* it's probably safe to ignore errors, since things will always succeed. For
* non-const inline data, you could get out of memory. For untrusted inline
* data located at runtime, you could have corrupt inline data in addition.
*
* @param data_length Length in bytes of the @a data argument.
* @param data Byte data containing a serialized GdkPixdata structure.
* @param copy_pixels Whether to copy the pixel data, or use direct pointers
* to @a data for the resulting pixbuf.
* @throw Gdk::PixbufError
*
* @deprecated Use Gio::Resource instead.
*/
static Glib::RefPtr<Pixbuf> create_from_inline(int data_length, const guint8* data, bool copy_pixels = false);
#endif // GDKMM_DISABLE_DEPRECATED
/** Creates a new pixbuf by loading an image from an input stream.
*
* The file format is detected automatically. If <tt>nullptr</tt> is returned, then
* @a error will be set. The @a cancellable can be used to abort the operation
* from another thread. If the operation was cancelled, the error
* IO_ERROR_CANCELLED will be returned. Other possible errors are in
* the Gdk::PIXBUF_ERROR and IO_ERROR domains.
*
* The stream is not closed.
*
* @newin{2,14}
*
* @param stream A InputStream to load the pixbuf from.
* @param cancellable Optional Cancellable object, <tt>nullptr</tt> to ignore.
* @return A newly-created pixbuf, or <tt>nullptr</tt> if any of several error
* conditions occurred: the file could not be opened, the image format is
* not supported, there was not enough memory to allocate the image buffer,
* the stream contained invalid data, or the operation was cancelled.
*/
static Glib::RefPtr<Pixbuf> create_from_stream(const Glib::RefPtr<Gio::InputStream>& stream, const Glib::RefPtr<Gio::Cancellable>& cancellable);
static Glib::RefPtr<Pixbuf> create_from_stream(const Glib::RefPtr<Gio::InputStream>& stream);
/** Creates a new pixbuf by loading an image from an input stream.
*
* The file format is detected automatically. If <tt>nullptr</tt> is returned, then
* @a error will be set. The @a cancellable can be used to abort the operation
* from another thread. If the operation was cancelled, the error
* IO_ERROR_CANCELLED will be returned. Other possible errors are in
* the Gdk::PIXBUF_ERROR and IO_ERROR domains.
*
* The image will be scaled to fit in the requested size, optionally
* preserving the image's aspect ratio.
*
* When preserving the aspect ratio, a @a width of -1 will cause the image to be
* scaled to the exact given height, and a @a height of -1 will cause the image
* to be scaled to the exact given width. If both @a width and @a height are
* given, this function will behave as if the smaller of the two values
* is passed as -1.
*
* When not preserving aspect ratio, a @a width or @a height of -1 means to not
* scale the image at all in that dimension.
*
* The stream is not closed.
*
* @newin{2,14}
*
* @param stream A InputStream to load the pixbuf from.
* @param width The width the image should have or -1 to not constrain the width.
* @param height The height the image should have or -1 to not constrain the height.
* @param preserve_aspect_ratio <tt>true</tt> to preserve the image's aspect ratio.
* @param cancellable Optional Cancellable object, <tt>nullptr</tt> to ignore.
* @return A newly-created pixbuf, or <tt>nullptr</tt> if any of several error
* conditions occurred: the file could not be opened, the image format is
* not supported, there was not enough memory to allocate the image buffer,
* the stream contained invalid data, or the operation was cancelled.
*/
static Glib::RefPtr<Pixbuf> create_from_stream_at_scale(const Glib::RefPtr<Gio::InputStream>& stream, int width, int height, bool preserve_aspect_ratio, const Glib::RefPtr<Gio::Cancellable>& cancellable);
static Glib::RefPtr<Pixbuf> create_from_stream_at_scale(const Glib::RefPtr<Gio::InputStream>& stream, int width, int height, bool preserve_aspect_ratio);
/** Queries the color space of a pixbuf.
*
* @return Color space.
*/
Colorspace get_colorspace() const;
/** Queries the number of channels of a pixbuf.
*
* @return Number of channels.
*/
int get_n_channels() const;
/** Queries whether a pixbuf has an alpha channel (opacity information).
*
* @return <tt>true</tt> if it has an alpha channel, <tt>false</tt> otherwise.
*/
bool get_has_alpha() const;
/** Queries the number of bits per color sample in a pixbuf.
*
* @return Number of bits per color sample.
*/
int get_bits_per_sample() const;
/** Queries a pointer to the pixel data of a pixbuf.
*
* @return A pointer to the pixbuf's pixel data.
* Please see the section on [image data](image-data) for information
* about how the pixel data is stored in memory.
*
* This function will cause an implicit copy of the pixbuf data if the
* pixbuf was created from read-only data.
*/
guint8* get_pixels() const;
//TODO: _WRAP_METHOD(guint8* get_pixels(guint& length) const, gdk_pixbuf_get_pixels_with_length)
/** Queries the width of a pixbuf.
*
* @return Width in pixels.
*/
int get_width() const;
/** Queries the height of a pixbuf.
*
* @return Height in pixels.
*/
int get_height() const;
/** Queries the rowstride of a pixbuf, which is the number of bytes between
* the start of a row and the start of the next row.
*
* @return Distance between row starts.
*/
int get_rowstride() const;
/** Returns the length of the pixel data, in bytes.
*
* @newin{2,26}
*
* @return The length of the pixel data.
*/
gsize get_byte_length() const;
/** Clears a pixbuf to the given RGBA value, converting the RGBA value into
* the pixbuf's pixel format. The alpha will be ignored if the pixbuf
* doesn't have an alpha channel.
*
* @param pixel RGBA pixel to clear to
* (0xffffffff is opaque white, 0x00000000 transparent black).
*/
void fill(guint32 pixel);
/** Saves pixbuf to a file in format @a type.
* By default, "jpeg", "png", "ico" and "bmp" are possible file formats to
* save in, but more formats may be installed. The list of all writable
* formats can be determined by using get_formats() with is_writable().
*
* @newin{3,6}
*
* @param filename The path of the file to be created.
* @param type The file type.
*
* @throw Glib::FileError
* @throw Gdk::PixbufError
*/
void save(const std::string& filename, const Glib::ustring& type) const;
#ifndef GDKMM_DISABLE_DEPRECATED
/**
* Same as the const version.
* @deprecated 3.6: Use the const version instead.
*/
void save(const std::string& filename, const Glib::ustring& type);
#endif // GDKMM_DISABLE_DEPRECATED
/** Saves pixbuf to a file in format @a type.
* By default, "jpeg", "png", "ico" and "bmp" are possible file formats to save in, but more formats may be installed.
* TThe list of all writable formats can be determined by using get_formats() with
* Gdk::PixbufFormat::is_writable().
*
* The @a option_keys and @a option_values, if not empty, should contain pairs of strings that modify the save parameters.
* For example, "quality", "100".
*
* Currently only a few parameters exist. JPEG images can be saved with a "quality" parameter;
* its value should be in the range [0,100]. Text chunks can be attached to PNG images by specifying parameters of the
* form "tEXt::key", where key is an ASCII string of length 1-79. The values are UTF-8 encoded strings. ICO images can be
* saved in depth 16, 24, or 32, by using the "depth" parameter. When the ICO saver is given "x_hot" and "y_hot"
* parameters, it produces a CUR instead of an ICO.
*
* @newin{3,6}
*
* @param filename The path of the file to be created.
* @param type The file type.
* @param option_keys
* @param option_values
*
* @throw Glib::FileError
* @throw Gdk::PixbufError
*/
void save(const std::string& filename, const Glib::ustring& type,
const std::vector<Glib::ustring>& option_keys,
const std::vector<Glib::ustring>& option_values) const;
#ifndef GDKMM_DISABLE_DEPRECATED
/**
* Same as the const version.
* @deprecated 3.6: Use the const version instead.
*/
void save(const std::string& filename, const Glib::ustring& type,
const std::vector<Glib::ustring>& option_keys,
const std::vector<Glib::ustring>& option_values);
#endif // GDKMM_DISABLE_DEPRECATED
#if 0 //TODO:
typedef sigc::slot<const char* buf, gsize> SlotSave;
/** @throws TODO
*/
void save(const SlotSave& slot, const std::string& type);
/** A map of option keys to option values.
*/
typepdef std::map<Glib::ustring, Glib::ustring> SaveValuesMap;
void save(const SlotSave& slot, const std::string& type, const SaveValuesMap& options);
#endif
/* TODO:
typedef gboolean (*GdkPixbufSaveFunc) (const gchar *buf,
gsize count,
GError **error,
gpointer data);
gboolean gdk_pixbuf_save_to_callback (GdkPixbuf *pixbuf,
GdkPixbufSaveFunc save_func,
gpointer user_data,
const char *type,
GError **error,
...);
gboolean gdk_pixbuf_save_to_callbackv (GdkPixbuf *pixbuf,
GdkPixbufSaveFunc save_func,
gpointer user_data,
const char *type,
char **option_keys,
char **option_values,
GError **error);
*/
/** Saves the pixbuf to a new buffer in format @a type.
* Note that the buffer is not nul-terminated and may contain embedded nulls.
* @see save().
*
* @newin{3,6}
*
* @param buffer This will be set to the address of a new buffer.
* @param buffer_size This will be set to the size of the @a buffer.
* @param type Currently "jpeg", "png", "ico" or "bmp".
*
* @throw Glib::FileError
* @throw Gdk::PixbufError
*/
void save_to_buffer(gchar*& buffer, gsize& buffer_size,
const Glib::ustring& type = "png") const;
#ifndef GDKMM_DISABLE_DEPRECATED
/**
* Same as the const version.
* @deprecated 3.6: Use the const version instead.
*/
void save_to_buffer(gchar*& buffer, gsize& buffer_size,
const Glib::ustring& type = "png");
#endif // GDKMM_DISABLE_DEPRECATED
/** Saves the pixbuf to a new buffer in format @a type.
* Note that the buffer is not nul-terminated and may contain embedded nulls.
* @see save().
*
* @newin{3,6}
*
* @param buffer This will be set to the address of a new buffer.
* @param buffer_size This will be set to the size of the @a buffer.
* @param type Currently "jpeg", "png", "ico" or "bmp".
* @param option_keys Names of options to set.
* @param option_values Values for named options.
*
* @throw Glib::FileError
* @throw Gdk::PixbufError
*/
void save_to_buffer(gchar*& buffer, gsize& buffer_size,
const Glib::ustring& type,
const std::vector<Glib::ustring>& option_keys,
const std::vector<Glib::ustring>& option_values) const;
#ifndef GDKMM_DISABLE_DEPRECATED
/**
* Same as the const version.
* @deprecated 3.6: Use the const version instead.
*/
void save_to_buffer(gchar*& buffer, gsize& buffer_size,
const Glib::ustring& type,
const std::vector<Glib::ustring>& option_keys,
const std::vector<Glib::ustring>& option_values);
#endif // GDKMM_DISABLE_DEPRECATED
/** Takes an existing pixbuf and adds an alpha channel to it.
* If the existing pixbuf already had an alpha channel, the channel
* values are copied from the original; otherwise, the alpha channel
* is initialized to 255 (full opacity).
*
* If @a substitute_color is <tt>true</tt>, then the color specified by ( @a r, @a g, @a b) will be
* assigned zero opacity. That is, if you pass (255, 255, 255) for the
* substitute color, all white pixels will become fully transparent.
*
* @param substitute_color Whether to set a color to zero opacity. If this
* is <tt>false</tt>, then the ( @a r, @a g, @a b) arguments will be ignored.
* @param r Red value to substitute.
* @param g Green value to substitute.
* @param b Blue value to substitute.
* @return A newly-created pixbuf with a reference count of 1.
*/
Glib::RefPtr<Gdk::Pixbuf> add_alpha(bool substitute_color, guint8 r, guint8 g, guint8 b) const;
/** Copies a rectangular area from @a src_pixbuf to @a dest_pixbuf. Conversion of
* pixbuf formats is done automatically.
*
* If the source rectangle overlaps the destination rectangle on the
* same pixbuf, it will be overwritten during the copy operation.
* Therefore, you can not use this function to scroll a pixbuf.
*
* @param src_x Source X coordinate within @a src_pixbuf.
* @param src_y Source Y coordinate within @a src_pixbuf.
* @param width Width of the area to copy.
* @param height Height of the area to copy.
* @param dest_pixbuf Destination pixbuf.
* @param dest_x X coordinate within @a dest_pixbuf.
* @param dest_y Y coordinate within @a dest_pixbuf.
*/
void copy_area(int src_x, int src_y, int width, int height, const Glib::RefPtr<Gdk::Pixbuf>& dest_pixbuf, int dest_x, int dest_y) const;
/** Modifies saturation and optionally pixelates @a src, placing the result in
* @a dest. @a src and @a dest may be the same pixbuf with no ill effects. If
* @a saturation is 1.0 then saturation is not changed. If it's less than 1.0,
* saturation is reduced (the image turns toward grayscale); if greater than
* 1.0, saturation is increased (the image gets more vivid colors). If @a pixelate
* is <tt>true</tt>, then pixels are faded in a checkerboard pattern to create a
* pixelated image. @a src and @a dest must have the same image format, size, and
* rowstride.
*
* @param dest Place to write modified version of @a src.
* @param saturation Saturation factor.
* @param pixelate Whether to pixelate.
*/
void saturate_and_pixelate(const Glib::RefPtr<Gdk::Pixbuf>& dest, float saturation, bool pixelate) const;
/** Creates a transformation of the source image @a src by scaling by
* @a scale_x and @a scale_y then translating by @a offset_x and @a offset_y,
* then renders the rectangle ( @a dest_x, @a dest_y, @a dest_width,
* @a dest_height) of the resulting image onto the destination image
* replacing the previous contents.
*
* Try to use scale_simple() first, this function is
* the industrial-strength power tool you can fall back to if
* scale_simple() isn't powerful enough.
*
* If the source rectangle overlaps the destination rectangle on the
* same pixbuf, it will be overwritten during the scaling which
* results in rendering artifacts.
*
* @param dest The Gdk::Pixbuf into which to render the results.
* @param dest_x The left coordinate for region to render.
* @param dest_y The top coordinate for region to render.
* @param dest_width The width of the region to render.
* @param dest_height The height of the region to render.
* @param offset_x The offset in the X direction (currently rounded to an integer).
* @param offset_y The offset in the Y direction (currently rounded to an integer).
* @param scale_x The scale factor in the X direction.
* @param scale_y The scale factor in the Y direction.
* @param interp_type The interpolation type for the transformation.
*/
void scale(const Glib::RefPtr<Gdk::Pixbuf>& dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, InterpType interp_type) const;
/** Creates a transformation of the source image @a src by scaling by
* @a scale_x and @a scale_y then translating by @a offset_x and @a offset_y.
* This gives an image in the coordinates of the destination pixbuf.
* The rectangle ( @a dest_x, @a dest_y, @a dest_width, @a dest_height)
* is then composited onto the corresponding rectangle of the
* original destination image.
*
* When the destination rectangle contains parts not in the source
* image, the data at the edges of the source image is replicated
* to infinity.
*
* ![](composite.png)
*
* @param dest The Gdk::Pixbuf into which to render the results.
* @param dest_x The left coordinate for region to render.
* @param dest_y The top coordinate for region to render.
* @param dest_width The width of the region to render.
* @param dest_height The height of the region to render.
* @param offset_x The offset in the X direction (currently rounded to an integer).
* @param offset_y The offset in the Y direction (currently rounded to an integer).
* @param scale_x The scale factor in the X direction.
* @param scale_y The scale factor in the Y direction.
* @param interp_type The interpolation type for the transformation.
* @param overall_alpha Overall alpha for source image (0..255).
*/
void composite(const Glib::RefPtr<Gdk::Pixbuf>& dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, InterpType interp_type, int overall_alpha) const;
/** Creates a transformation of the source image @a src by scaling by
* @a scale_x and @a scale_y then translating by @a offset_x and @a offset_y,
* then composites the rectangle ( @a dest_x , @a dest_y, @a dest_width,
* @a dest_height) of the resulting image with a checkboard of the
* colors @a color1 and @a color2 and renders it onto the destination
* image.
*
* See composite_color_simple() for a simpler variant of this
* function suitable for many tasks.
*
* @param dest The Gdk::Pixbuf into which to render the results.
* @param dest_x The left coordinate for region to render.
* @param dest_y The top coordinate for region to render.
* @param dest_width The width of the region to render.
* @param dest_height The height of the region to render.
* @param offset_x The offset in the X direction (currently rounded to an integer).
* @param offset_y The offset in the Y direction (currently rounded to an integer).
* @param scale_x The scale factor in the X direction.
* @param scale_y The scale factor in the Y direction.
* @param interp_type The interpolation type for the transformation.
* @param overall_alpha Overall alpha for source image (0..255).
* @param check_x The X offset for the checkboard (origin of checkboard is at - @a check_x, - @a check_y).
* @param check_y The Y offset for the checkboard.
* @param check_size The size of checks in the checkboard (must be a power of two).
* @param color1 The color of check at upper left.
* @param color2 The color of the other check.
*/
void composite_color(const Glib::RefPtr<Gdk::Pixbuf>& dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, InterpType interp_type, int overall_alpha, int check_x, int check_y, int check_size, guint32 color1, guint32 color2) const;
/** Create a new Gdk::Pixbuf containing a copy of @a src scaled to
* @a dest_width x @a dest_height. Leaves @a src unaffected. @a interp_type
* should be Gdk::INTERP_NEAREST if you want maximum speed (but when
* scaling down Gdk::INTERP_NEAREST is usually unusably ugly). The
* default @a interp_type should be Gdk::INTERP_BILINEAR which offers
* reasonable quality and speed.
*
* You can scale a sub-portion of @a src by creating a sub-pixbuf
* pointing into @a src; see new_subpixbuf().
*
* For more complicated scaling/compositing see scale()
* and composite().
*
* @param dest_width The width of destination image.
* @param dest_height The height of destination image.
* @param interp_type The interpolation type for the transformation.
* @return The new Gdk::Pixbuf, or <tt>nullptr</tt> if not enough memory could be
* allocated for it.
*/
Glib::RefPtr<Gdk::Pixbuf> scale_simple(int dest_width, int dest_height, InterpType interp_type) const;
/** Creates a new Gdk::Pixbuf by scaling @a src to @a dest_width x
* @a dest_height and compositing the result with a checkboard of colors
* @a color1 and @a color2.
*
* @param dest_width The width of destination image.
* @param dest_height The height of destination image.
* @param interp_type The interpolation type for the transformation.
* @param overall_alpha Overall alpha for source image (0..255).
* @param check_size The size of checks in the checkboard (must be a power of two).
* @param color1 The color of check at upper left.
* @param color2 The color of the other check.
* @return The new Gdk::Pixbuf, or <tt>nullptr</tt> if not enough memory could be
* allocated for it.
*/
Glib::RefPtr<Gdk::Pixbuf> composite_color_simple(int dest_width, int dest_height, InterpType interp_type, int overall_alpha, int check_size, guint32 color1, guint32 color2) const;
/** Rotates a pixbuf by a multiple of 90 degrees, and returns the
* result in a new pixbuf.
*
* @newin{2,6}
*
* @param angle The angle to rotate by.
* @return The new Gdk::Pixbuf, or <tt>nullptr</tt>
* if not enough memory could be allocated for it.
*/
Glib::RefPtr<Gdk::Pixbuf> rotate_simple(PixbufRotation angle) const;
/** Flips a pixbuf horizontally or vertically and returns the
* result in a new pixbuf.
*
* @newin{2,6}
*
* @param horizontal <tt>true</tt> to flip horizontally, <tt>false</tt> to flip vertically.
* @return The new Gdk::Pixbuf, or <tt>nullptr</tt>
* if not enough memory could be allocated for it.
*/
Glib::RefPtr<Gdk::Pixbuf> flip(bool horizontal = true) const;
/** Looks up @a key in the list of options that may have been attached to the
* @a pixbuf when it was loaded, or that may have been attached by another
* function using set_option().
*
* For instance, the ANI loader provides "Title" and "Artist" options.
* The ICO, XBM, and XPM loaders provide "x_hot" and "y_hot" hot-spot
* options for cursor definitions. The PNG loader provides the tEXt ancillary
* chunk key/value pairs as options. Since 2.12, the TIFF and JPEG loaders
* return an "orientation" option string that corresponds to the embedded
* TIFF/Exif orientation tag (if present). Since 2.32, the TIFF loader sets
* the "multipage" option string to "yes" when a multi-page TIFF is loaded.
* Since 2.32 the JPEG and PNG loaders set "x-dpi" and "y-dpi" if the file
* contains image density information in dots per inch.
*
* @param key A nul-terminated string.
* @return The value associated with @a key. This is a nul-terminated
* string that should not be freed or <tt>nullptr</tt> if @a key was not found.
*/
Glib::ustring get_option(const Glib::ustring& key) const;
/** Attaches a key/value pair as an option to a Gdk::Pixbuf. If @a key already
* exists in the list of options attached to @a pixbuf, the new value is
* ignored and <tt>false</tt> is returned.
*
* @newin{2,2}
*
* @param key A nul-terminated string.
* @param value A nul-terminated string.
* @return <tt>true</tt> on success.
*/
bool set_option(const Glib::ustring& key, const Glib::ustring& value);
/** Remove the key/value pair option attached to a Gdk::Pixbuf.
*
* @newin{2,36}
*
* @param key A nul-terminated string representing the key to remove.
* @return <tt>true</tt> if an option was removed, <tt>false</tt> if not.
*/
bool remove_option(const Glib::ustring& key);
/** Copy the key/value pair options attached to a Gdk::Pixbuf to another.
* This is useful to keep original metadata after having manipulated
* a file. However be careful to remove metadata which you've already
* applied, such as the "orientation" option after rotating the image.
*
* @newin{2,36}
*
* @param dest_pixbuf The Gdk::Pixbuf to copy options to.
* @return <tt>true</tt> on success.
*/
bool copy_options(const Glib::RefPtr<Pixbuf>& dest_pixbuf) const;
//This creates a new GdkPixbuf or returns the original with a reference.
/** Takes an existing pixbuf and checks for the presence of an
* associated "orientation" option, which may be provided by the
* jpeg loader (which reads the exif orientation tag) or the
* tiff loader (which reads the tiff orientation tag, and
* compensates it for the partial transforms performed by
* libtiff). If an orientation option/tag is present, the
* appropriate transform will be performed so that the pixbuf
* is oriented correctly.
*
* @newin{2,12}
*
* @return A newly-created pixbuf, or a reference to the
* input pixbuf (with an increased reference count).
*/
Glib::RefPtr<Pixbuf> apply_embedded_orientation();
/** Obtains the available information about the image formats supported by GdkPixbuf.
* @result A list of PixbufFormats describing the supported image formats.
*/
static std::vector<PixbufFormat> get_formats();
/** The colorspace in which the samples are interpreted.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< Colorspace > property_colorspace() const;
/** The number of samples per pixel.
* Currently, only 3 or 4 samples per pixel are supported.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< int > property_n_channels() const;
/** Whether the pixbuf has an alpha channel.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< bool > property_has_alpha() const;
/** The number of bits per sample.
* Currently only 8 bit per sample are supported.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< int > property_bits_per_sample() const;
/** The number of columns of the pixbuf.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< int > property_width() const;
/** The number of rows of the pixbuf.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< int > property_height() const;
/** The number of bytes between the start of a row and
* the start of the next row. This number must (obviously)
* be at least as large as the width of the pixbuf.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< int > property_rowstride() const;
/** A pointer to the pixel data of the pixbuf.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< void* > property_pixels() const;
public:
public:
//C++ methods used to invoke GTK+ virtual functions:
protected:
//GTK+ Virtual Functions (override these to change behaviour):
//Default Signal Handlers::
};
} // namespace Gdk
namespace Glib
{
/** A Glib::wrap() method for this object.
*
* @param object The C instance.
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
* @result A C++ instance that wraps this C instance.
*
* @relates Gdk::Pixbuf
*/
Glib::RefPtr<Gdk::Pixbuf> wrap(GdkPixbuf* object, bool take_copy = false);
}
#endif /* _GDKMM_PIXBUF_H */
|