/usr/include/gdkmm-2.4/gdkmm/pixbuf.h is in libgtkmm-2.4-dev 1:2.24.5-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 | // -*- c++ -*-
// Generated by gmmproc 2.45.3 -- 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// This is for including the config header before any code (such as
// the #ifndef GDKMM_DISABLE_DEPRECATED in deprecated classes) is generated:
#include <gdkmm/drawable.h>
#include <gdkmm/image.h>
#include <gdkmm/pixmap.h>
#include <gdkmm/bitmap.h>
#include <gdkmm/pixbufformat.h>
#include <gdkmm/types.h>
#include <giomm/inputstream.h>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GdkPixbuf GdkPixbuf;
typedef struct _GdkPixbufClass 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
{
/** @addtogroup gdkmmEnums gdkmm Enums and Flags */
/**
*
* @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
{
/**
*
* @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
{
/**
*
* @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
{
/**
*
* @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:
/**
*/
enum Code
{
CORRUPT_IMAGE,
INSUFFICIENT_MEMORY,
BAD_OPTION,
UNKNOWN_TYPE,
UNSUPPORTED_OPERATION,
FAILED
};
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
{
#ifndef DOXYGEN_SHOULD_SKIP_THIS
struct PixbufFormatTraits
{
typedef PixbufFormat CppType;
typedef const GdkPixbufFormat* CType;
typedef GdkPixbufFormat* CTypeNonConst;
static CType to_c_type (const CppType& obj) { return obj.gobj(); }
static CType to_c_type (CType ptr) { return ptr; }
static CppType to_cpp_type (CType ptr) { return PixbufFormat(ptr); /* Does not take ownership */ }
static void release_c_type (CType /* ptr */) { /* Doesn't happen */ }
};
#endif //DOXYGEN_SHOULD_SKIP_THIS
class Pixbuf : public Glib::Object
{
#ifndef DOXYGEN_SHOULD_SKIP_THIS
public:
typedef Pixbuf CppObjectType;
typedef Pixbuf_Class CppClassType;
typedef GdkPixbuf BaseObjectType;
typedef GdkPixbufClass BaseClassType;
private: friend class Pixbuf_Class;
static CppClassType pixbuf_class_;
private:
// noncopyable
Pixbuf(const Pixbuf&);
Pixbuf& operator=(const Pixbuf&);
protected:
explicit Pixbuf(const Glib::ConstructParams& construct_params);
explicit Pixbuf(GdkPixbuf* castitem);
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
public:
virtual ~Pixbuf();
/** 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:
//gtkmmproc error: gdk_pixbuf_ref : ignored method defs lookup failed//gtkmmproc error: gdk_pixbuf_unref : ignored method defs lookup failed
protected:
/** Creates a pixbuf object from a drawable.
*
* Transfers image data from a Drawable and converts it to an RGB(A)
* representation inside a 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.
*
* If the drawable @src has no colormap (See Gdk::Drawable::get_colormap()),
* then a suitable colormap must be specified. Otherwise, you may use the
* constructor that takes no colormap argument.
* Typically a Gdk::Window or a pixmap created by passing a Gdk:Window
* to the Gdk::Pixbuf constructor will already have a colormap associated with
* it. If the drawable is a bitmap (1 bit per pixel pixmap),
* then a colormap is not required; pixels with a value of 1 are
* assumed to be white, and pixels with a value of 0 are assumed to be
* black. For taking screenshots, Gdk::Colormap::get_system() returns
* the correct colormap to use.
*
* This will create an RGB pixbuf with 8 bits per channel and no
* alpha, with the same size specified by the @a width and @a height
* arguments.
*
* If the specified drawable is a pixmap, then the requested source
* rectangle must be completely contained within the pixmap, otherwise
* the constructor will fail. For pixmaps only (not for windows)
* passing -1 for width or height is allowed to mean the full width
* or height of the pixmap.
*
* If the specified drawable is a window, and 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.
*
* See alo Gdk::Drawable::get_image().
*
* @param src Source drawable.
* @param cmap: A colormap.
* @param src_x Source X coordinate within drawable.
* @param src_y Source Y coordinate within drawable.
* @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<Drawable>& src, const Glib::RefPtr<Colormap>& cmap,
int src_x, int src_y, int width, int height);
/** Creates a pixbuf object from a drawable, using the colormap from the drawable.
*
* @param src Source drawable.
* @param src_x Source X coordinate within drawable.
* @param src_y Source Y coordinate within drawable.
* @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<Drawable>& src,
int src_x, int src_y, int width, int height);
#ifndef GDKMM_DISABLE_DEPRECATED
/// @deprecated Use the constructor without dest_x and dest_y parameters.
Pixbuf(const Glib::RefPtr<Drawable>& src, const Glib::RefPtr<Colormap>& cmap,
int src_x, int src_y, int dest_x, int dest_y, int width, int height);
#endif // GDKMM_DISABLE_DEPRECATED
/** Creates a pixbuf object from an image.
*
* @param src Source Image.
* @param cmap A colormap.
* @param src_x Source X coordinate within the image.
* @param src_y Source Y coordinate within the image.
* @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<Image>& src, const Glib::RefPtr<Colormap>& cmap,
int src_x, int src_y, int width, int height);
/** Creates a pixbuf object from an image, using the colormap from the image.
*
* @param src Source Image.
* @param src_x Source X coordinate within the image.
* @param src_y Source Y coordinate within the image.
* @param width Width in pixels of region to get.
* @param height Height in pixels of region to get.
*
* @newinp212
*/
Pixbuf(const Glib::RefPtr<Image>& src,
int src_x, int src_y, int width, int height);
#ifndef GDKMM_DISABLE_DEPRECATED
/// @deprecated Use the constructors without dest_x and dest_y parameters.
Pixbuf(const Glib::RefPtr<Image>& src, const Glib::RefPtr<Colormap>& cmap,
int src_x, int src_y, int dest_x, int dest_y, int width, int height);
#endif // GDKMM_DISABLE_DEPRECATED
public:
typedef sigc::slot<void, const guint8*> SlotDestroyData;
// Hand-coded so the implementation in the .ccg is also only
// built when GDKMM_DISABLE_DEPRECATED is defined.
#ifndef GDKMM_DISABLE_DEPRECATED
/** @deprecated Use the create() methods that don't have the unused dest_x and dest_y parameters. */
static Glib::RefPtr<Gdk::Pixbuf> create(const Glib::RefPtr<Drawable>& src,
const Glib::RefPtr<Colormap>& cmap,
int src_x, int src_y,
int dest_x, int dest_y,
int width, int height);
/** @deprecated Use the create() methods that that don't have the unused dest_x and dest_y parameters. */
static Glib::RefPtr<Gdk::Pixbuf> create(const Glib::RefPtr<Image>& src,
const Glib::RefPtr<Colormap>& cmap,
int src_x, int src_y,
int dest_x, int dest_y,
int width, int height);
#endif // GDKMM_DISABLE_DEPRECATED
/** Creates a pixbuf object from a drawable.
*
* Transfers image data from a Drawable and converts it to an RGB(A)
* representation inside a 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.
*
* If the drawable @src has no colormap (See Gdk::Drawable::get_colormap()),
* then a suitable colormap must be specified. Otherwise, you may use the
* constructor that takes no colormap argument.
* Typically a Gdk::Window or a pixmap created by passing a Gdk:Window
* to the Gdk::Pixbuf constructor will already have a colormap associated with
* it. If the drawable is a bitmap (1 bit per pixel pixmap),
* then a colormap is not required; pixels with a value of 1 are
* assumed to be white, and pixels with a value of 0 are assumed to be
* black. For taking screenshots, Gdk::Colormap::get_system() returns
* the correct colormap to use.
*
* This will create an RGB pixbuf with 8 bits per channel and no
* alpha, with the same size specified by the @a width and @a height
* arguments.
*
* If the specified drawable is a pixmap, then the requested source
* rectangle must be completely contained within the pixmap, otherwise
* the constructor will fail. For pixmaps only (not for windows)
* passing -1 for width or height is allowed to mean the full width
* or height of the pixmap.
*
* If the specified drawable is a window, and 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.
*
* See alo Gdk::Drawable::get_image().
*
* @param src Source drawable.
* @param cmap: A colormap.
* @param src_x Source X coordinate within drawable.
* @param src_y Source Y coordinate within drawable.
* @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<Drawable>& src, const Glib::RefPtr<Colormap>& cmap, int src_x, int src_y, int width, int height);
/** Creates a pixbuf object from a drawable, using the colormap from the drawable.
*
* @param src Source drawable.
* @param src_x Source X coordinate within drawable.
* @param src_y Source Y coordinate within drawable.
* @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<Drawable>& src, int src_x, int src_y, int width, int height);
/** Creates a pixbuf object from an image.
*
* @param src Source Image.
* @param cmap A colormap.
* @param src_x Source X coordinate within the image.
* @param src_y Source Y coordinate within the image.
* @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<Image>& src, const Glib::RefPtr<Colormap>& cmap, int src_x, int src_y, int width, int height);
/** Creates a pixbuf object from an image, using the colormap from the image.
*
* @param src Source Image.
* @param src_x Source X coordinate within the image.
* @param src_y Source Y coordinate within the image.
* @param width Width in pixels of region to get.
* @param height Height in pixels of region to get.
*
* @newinp212
*/
static Glib::RefPtr<Pixbuf> create(const Glib::RefPtr<Image>& src, int src_x, int src_y, int width, int height);
Glib::RefPtr<Pixbuf> copy() const;
static Glib::RefPtr<Pixbuf> create(Colorspace colorspace, bool has_alpha, int bits_per_sample, int width, int height);
/** @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.
*/
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 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);
static Glib::RefPtr<Pixbuf> create_from_xpm_data(const char *const * data);
/** 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
*/
static Glib::RefPtr<Pixbuf> create_from_inline(int data_length, const guint8* data, bool copy_pixels = false);
static Glib::RefPtr<Pixbuf> create_from_stream(const Glib::RefPtr<Gio::InputStream>& stream, const Glib::RefPtr<Gio::Cancellable>& cancelable);
static Glib::RefPtr<Pixbuf> create_from_stream(const Glib::RefPtr<Gio::InputStream>& stream);
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>& cancelable);
static Glib::RefPtr<Pixbuf> create_from_stream_at_scale(const Glib::RefPtr<Gio::InputStream>& stream, int width, int height, bool preserve_aspect_ratio);
Colorspace get_colorspace() const;
int get_n_channels() const;
bool get_has_alpha() const;
int get_bits_per_sample() const;
guint8* get_pixels() const;
int get_width() const;
int get_height() const;
int get_rowstride() const;
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().
*
* @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);
/** 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 @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.
*
* @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 Glib::StringArrayHandle& option_keys,
const Glib::StringArrayHandle& option_values);
/* 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().
*
* @param buffer This will be set to the address of a new buffer.
* @param 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");
/* 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().
*
* @param buffer This will be set to the address of a new buffer.
* @param 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,
const Glib::StringArrayHandle& option_keys,
const Glib::StringArrayHandle& option_values);
Glib::RefPtr<Gdk::Pixbuf> add_alpha(bool substitute_color, guint8 r, guint8 g, guint8 b) const;
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;
void saturate_and_pixelate(const Glib::RefPtr<Gdk::Pixbuf>& dest, float saturation, bool pixelate) const;
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;
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;
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;
Glib::RefPtr<Gdk::Pixbuf> scale_simple(int dest_width, int dest_height, InterpType interp_type) const;
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;
Glib::RefPtr<Gdk::Pixbuf> rotate_simple(PixbufRotation angle) const;
Glib::RefPtr<Gdk::Pixbuf> flip(bool horizontal = true) const;
/** Takes the opacity values in a rectangular portion of a pixbuf and thresholds
* them to produce a bi-level alpha mask that can be used as a clipping mask for
* a drawable.
*
* @param bitmap Bitmap where the bilevel mask will be painted to.
* @param src_x Source X coordinate.
* @param src_y Source Y coordinate.
* @param dest_x Destination X coordinate.
* @param dest_y Destination Y coordinate.
* @param width Width of region to threshold, or -1 to use pixbuf width.
* @param height Height of region to threshold, or -1 to use pixbuf height.
* @param alpha_threshold Opacity values below this will be painted as zero; all
* other values will be painted as one.
*/
void render_threshold_alpha(const Glib::RefPtr<Gdk::Bitmap>& bitmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height, int alpha_threshold);
#ifndef GDKMM_DISABLE_DEPRECATED
/** Renders a rectangular portion of a pixbuf to a drawable while using the
* specified GC. This is done using GdkRGB, so the specified drawable must have
* the GdkRGB visual and colormap. Note that this function will ignore the
* opacity information for images with an alpha channel; the GC must already
* have the clipping mask set if you want transparent regions to show through.
*
* For an explanation of dither offsets, see the GdkRGB documentation. In
* brief, the dither offset is important when re-rendering partial regions of an
* image to a rendered version of the full image, or for when the offsets to a
* base position change, as in scrolling. The dither matrix has to be shifted
* for consistent visual results. If you do not have any of these cases, the
* dither offsets can be both zero.
*
* Deprecated: 2.4: This function is obsolete. Use gdk_draw_pixbuf() instead.
*
* @deprecated Use Gdk::Drawable::draw_pixbuf() instead.
*
* @param drawable Destination drawable.
* @param gc GC used for rendering.
* @param src_x Source X coordinate within pixbuf.
* @param src_y Source Y coordinate within pixbuf.
* @param dest_x Destination X coordinate within drawable.
* @param dest_y Destination Y coordinate within drawable.
* @param width Width of region to render, in pixels, or -1 to use pixbuf width.
* @param height Height of region to render, in pixels, or -1 to use pixbuf height.
* @param dither Dithering mode for GdkRGB.
* @param x_dither X offset for dither.
* @param y_dither Y offset for dither.
*/
void render_to_drawable(const Glib::RefPtr<Drawable>& drawable, const Glib::RefPtr<Gdk::GC>& gc, int src_x, int src_y, int dest_x, int dest_y, int width, int height, RgbDither dither, int x_dither, int y_dither);
#endif // GDKMM_DISABLE_DEPRECATED
#ifndef GDKMM_DISABLE_DEPRECATED
/** Renders a rectangular portion of a pixbuf to a drawable. The destination
* drawable must have a colormap. All windows have a colormap, however, pixmaps
* only have colormap by default if they were created with a non-<tt>0</tt> window argument.
* Otherwise a colormap must be set on them with gdk_drawable_set_colormap.
*
* On older X servers, rendering pixbufs with an alpha channel involves round trips
* to the X server, and may be somewhat slow.
*
* Deprecated: 2.4: This function is obsolete. Use gdk_draw_pixbuf() instead.
*
* @deprecated Use Gdk::Drawable::draw_pixbuf() instead.
*
* @param drawable Destination drawable.
* @param src_x Source X coordinate within pixbuf.
* @param src_y Source Y coordinates within pixbuf.
* @param dest_x Destination X coordinate within drawable.
* @param dest_y Destination Y coordinate within drawable.
* @param width Width of region to render, in pixels, or -1 to use pixbuf width.
* @param height Height of region to render, in pixels, or -1 to use pixbuf height.
* @param alpha_mode Ignored. Present for backwards compatibility.
* @param alpha_threshold Ignored. Present for backwards compatibility.
* @param dither Dithering mode for GdkRGB.
* @param x_dither X offset for dither.
* @param y_dither Y offset for dither.
*/
void render_to_drawable_alpha(const Glib::RefPtr<Drawable>& drawable, int src_x, int src_y, int dest_x, int dest_y, int width, int height, PixbufAlphaMode alpha_mode, int alpha_threshold, RgbDither dither, int x_dither, int y_dither);
#endif // GDKMM_DISABLE_DEPRECATED
void render_pixmap_and_mask_for_colormap(const Glib::RefPtr<Colormap>& colormap,
Glib::RefPtr<Pixmap>& pixmap_return,
Glib::RefPtr<Bitmap>& mask_return,
int alpha_threshold);
void render_pixmap_and_mask(Glib::RefPtr<Pixmap>& pixmap_return,
Glib::RefPtr<Bitmap>& mask_return, int alpha_threshold);
Glib::ustring get_option(const Glib::ustring& key) const;
typedef Glib::SListHandle< Glib::RefPtr<PixbufFormat>, PixbufFormatTraits > SListHandle_PixbufFormat;
/** Obtains the available information about the image formats supported by GdkPixbuf.
* @result A list of PixbufFormats describing the supported image formats.
*/
static SListHandle_PixbufFormat get_formats();
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 */
|