# :stopdoc:
# This file is automatically generated by the WXRuby3 documentation
# generator. Do not alter this file.
# :startdoc:
module Wx
#
BITMAP_SCREEN_DEPTH = -1
# An empty {Wx::Bitmap} object.
#
NULL_BITMAP = nil
# This class encapsulates the concept of a platform-dependent bitmap, either monochrome or colour or colour with alpha channel support.
#
# If you need direct access the bitmap data instead going through drawing to it using {Wx::MemoryDC} you need to use the {Wx::PixelData} class (either {Wx::NativePixelData} for RGB bitmaps or {Wx::AlphaPixelData} for bitmaps with an additionally alpha channel).
# Note that many {Wx::Bitmap} functions take a type parameter, which is a value of the {Wx::BitmapType} enumeration. The validity of those values depends however on the platform where your program is running and from the wxWidgets configuration. If all possible wxWidgets settings are used:
#
# - WXMSW supports BMP and ICO files, BMP and ICO resources;
# - WXGTK supports any file supported by gdk-pixbuf;
# - WXOSX supports PICT resources;
# - WXX11 supports XPM files, XPM data, XBM data;
#
# In addition, {Wx::Bitmap} can load and save all formats that {Wx::Image} can; see {Wx::Image} for more info. Of course, you must have loaded the {Wx::Image} handlers (see {init_all_image_handlers} and {Wx::Image.add_handler}). Note that all available {Wx::BitmapHandlers} for a given wxWidgets port are automatically loaded at startup so you won't need to use {Wx::Bitmap.add_handler}.
# More on the difference between {Wx::Image} and {Wx::Bitmap}: {Wx::Image} is just a buffer of RGB bytes with an optional buffer for the alpha bytes. It is all generic, platform independent and image file format independent code. It includes generic code for scaling, resizing, clipping, and other manipulations of the image data. OTOH, {Wx::Bitmap} is intended to be a wrapper of whatever is the native image format that is quickest/easiest to draw to a DC or to be the target of the drawing operations performed on a {Wx::MemoryDC}. By splitting the responsibilities between {Wx::Image}/{Wx::Bitmap} like this then it's easier to use generic code shared by all platforms and image types for generic operations and platform specific code where performance or compatibility is needed.
#
# Category: Graphics Device Interface (GDI)
# Predefined objects/pointers: {Wx::NULL_BITMAP}
# @see Bitmaps and Icons
# @see Supported Bitmap File Formats
# @see Wx::DC#blit
# @see Wx::Icon
# @see Wx::Cursor
# @see Wx::MemoryDC
# @see Wx::Image
# @see Wx::PixelData
#
#
#
# @note This class is untracked and should not be derived from nor instances extended!
class Bitmap < GDIObject
# @overload initialize()
# Default constructor.
#
# Constructs a bitmap object with no data; an assignment or another member function such as {Wx::Bitmap#create} or {Wx::Bitmap#load_file} must be called subsequently.
# @return [Wx::Bitmap]
# @overload initialize(bitmap)
# Copy constructor, uses reference counting.
#
# To make a real copy, you can use:
# ```ruby
# newBitmap = oldBitmap.get_sub_bitmap(
# Wx::Rect.new(0, 0, oldBitmap.width, oldBitmap.height))
# ```
# @param bitmap [Wx::Bitmap]
# @return [Wx::Bitmap]
# @overload initialize(width, height, depth=Wx::BITMAP_SCREEN_DEPTH)
# Creates a new bitmap.
#
# A depth of {Wx::BITMAP_SCREEN_DEPTH} indicates the depth of the current screen or visual.
# Some platforms only support 1 for monochrome and {Wx::BITMAP_SCREEN_DEPTH} for the current colour setting.
# A depth of 32 including an alpha channel is supported under MSW, Mac and GTK+.
# @param width [Integer] The width of the bitmap in pixels, must be strictly positive.
# @param height [Integer] The height of the bitmap in pixels, must be strictly positive.
# @param depth [Integer] The number of bits used to represent each bitmap pixel.
# @return [Wx::Bitmap]
# @overload initialize(sz, depth=Wx::BITMAP_SCREEN_DEPTH)
# This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
# @param sz [Array(Integer, Integer), Wx::Size]
# @param depth [Integer]
# @return [Wx::Bitmap]
# @overload initialize(width, height, dc)
# Create a bitmap compatible with the given DC, inheriting its magnification factor.
# @param width [Integer] The width of the bitmap in pixels, must be strictly positive.
# @param height [Integer] The height of the bitmap in pixels, must be strictly positive.
# @param dc [Wx::DC] DC from which the scaling factor is inherited
# @return [Wx::Bitmap]
# @overload initialize(name, type=Wx::BITMAP_DEFAULT_TYPE)
# Loads a bitmap from a file or resource.
#
#
# @see Wx::Bitmap#load_file
# @param name [String] This can refer to a resource name or a filename under MS Windows and X. Its meaning is determined by the type parameter.
# @param type [Wx::BitmapType] May be one of the {Wx::BitmapType} values and indicates which type of bitmap should be loaded. See the note in the class detailed description. Note that the {Wx::BITMAP_DEFAULT_TYPE} constant has different value under different wxWidgets ports. See the bitmap.h header for the value it takes for a specific port.
# @return [Wx::Bitmap]
# @overload initialize(img, depth=Wx::BITMAP_SCREEN_DEPTH)
# Creates this bitmap object from the given image.
#
# This has to be done to actually display an image as you cannot draw an image directly on a window.
# The resulting bitmap will use the provided colour depth (or that of the current system if depth is {Wx::BITMAP_SCREEN_DEPTH}) which entails that a colour reduction may take place.
# On Windows, if there is a palette present (set with SetPalette), it will be used when creating the {Wx::Bitmap} (most useful in 8-bit display mode). On other platforms, the palette is currently ignored.
# @param img [Wx::Image] Platform-independent {Wx::Image} object.
# @param depth [Integer] Specifies the depth of the bitmap. If this is omitted, the display depth of the screen is used.
# @return [Wx::Bitmap]
# @overload initialize(img, dc)
# Creates a bitmap compatible with the given DC from the given image.
#
# This constructor initializes the bitmap with the data of the given image, which must be valid, but inherits the scaling factor from the given device context instead of simply using the default factor of 1.
# @param img [Wx::Image] Platform-independent {Wx::Image} object.
# @param dc [Wx::DC] DC from which the scaling factor is inherited
# @return [Wx::Bitmap]
# @overload initialize(cursor)
# Creates bitmap corresponding to the given cursor.
#
# This can be useful to display a cursor as it cannot be drawn directly on a window.
# @param cursor [Wx::Cursor] A valid {Wx::Cursor}.
# @return [Wx::Bitmap]
def initialize(*args) end
# Returns disabled (dimmed) version of the bitmap.
#
# This method is not available when wxUSE_IMAGE == 0
.
# @param brightness [Integer]
# @return [Wx::Bitmap]
def convert_to_disabled(brightness=255) end
# Creates an image from a platform-dependent bitmap.
#
# This preserves mask information so that bitmaps and images can be converted back and forth without loss in that respect.
# @return [Wx::Image]
def convert_to_image; end
# Creates the bitmap from an icon.
# @param icon [Wx::Icon]
# @return [Boolean]
def copy_from_icon(icon) end
# @overload create(width, height, depth=Wx::BITMAP_SCREEN_DEPTH)
# Creates a fresh bitmap.
#
# If the final argument is omitted, the display depth of the screen is used.
#
# true if the creation was successful.
# @param width [Integer] The width of the bitmap in pixels, must be strictly positive.
# @param height [Integer] The height of the bitmap in pixels, must be strictly positive.
# @param depth [Integer] The number of bits used to represent each bitmap pixel.
# @return [Boolean]
# @overload create(sz, depth=Wx::BITMAP_SCREEN_DEPTH)
# This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
# @param sz [Array(Integer, Integer), Wx::Size]
# @param depth [Integer]
# @return [Boolean]
# @overload create(width, height, dc)
# Create a bitmap compatible with the given DC, inheriting its magnification factor.
#
# true if the creation was successful.
# @param width [Integer] The width of the bitmap in pixels, must be strictly positive.
# @param height [Integer] The height of the bitmap in pixels, must be strictly positive.
# @param dc [Wx::DC] DC from which the scaling factor is inherited
# @return [Boolean]
def create(*args) end
# @overload create_with_dip_size(size, scale, depth=Wx::BITMAP_SCREEN_DEPTH)
# Create a bitmap specifying its size in DPI-independent pixels and the scale factor to use.
#
# The physical size of the bitmap is obtained by multiplying the given size by scale and rounding it to the closest integer.
# After using this function the following postconditions are true:
#
# - {Wx::Bitmap#get_size} returns size multiplied by scale
# - {Wx::Bitmap#get_dip_size} returns size
# - {Wx::Bitmap#get_scale_factor} returns scale
#
# true if the creation was successful.
# @param size [Array(Integer, Integer), Wx::Size] The size of the bitmap in DPI-independent pixels. Both width and height must be strictly positive.
# @param scale [Float] Scale factor used by the bitmap, see {Wx::Bitmap#set_scale_factor}.
# @param depth [Integer] The number of bits used to represent each bitmap pixel.
# @return [Boolean]
# @overload create_with_dip_size(width, height, scale, depth=Wx::BITMAP_SCREEN_DEPTH)
# This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
# @param width [Integer]
# @param height [Integer]
# @param scale [Float]
# @param depth [Integer]
# @return [Boolean]
def create_with_dip_size(*args) end
# Create a bitmap with a scale factor.
#
# This is an older synonym for {Wx::Bitmap#create_with_dip_size}, use the new function in the new code.
#
# true if the creation was successful.
# @param width [Integer] The width of the bitmap in pixels, must be strictly positive.
# @param height [Integer] The height of the bitmap in pixels, must be strictly positive.
# @param depth [Integer] The number of bits used to represent each bitmap pixel.
# @param logicalScale [Float] Scale factor used by the bitmap, see {Wx::Bitmap#set_scale_factor}.
# @return [Boolean]
def create_scaled(width, height, depth, logicalScale) end
# Gets the colour depth of the bitmap.
#
# A value of 1 indicates a monochrome bitmap.
# @return [Integer]
def get_depth; end
alias_method :depth, :get_depth
# Returns the size of bitmap in DPI-independent units.
#
# This assumes that the bitmap was created using the value of scale factor corresponding to the current DPI (see {Wx::Bitmap#create_with_dip_size} and {Wx::Bitmap#set_scale_factor}) and returns its physical size divided by this scale factor.
# Unlike {Wx::Bitmap#get_logical_size}, this function returns the same value under all platforms and so its result should not be used as window or device context coordinates.
# @return [Wx::Size]
def get_dip_size; end
alias_method :dip_size, :get_dip_size
# Returns the height of the bitmap in physical pixels.
#
#
# @see Wx::Bitmap#get_width
# @see Wx::Bitmap#get_size
# @see Wx::Bitmap#get_logical_height
# @return [Integer]
def get_height; end
alias_method :height, :get_height
# Returns the height of the bitmap in logical pixels.
#
# See {Wx::Bitmap#get_logical_size} for more information.
# @see Wx::Bitmap#get_logical_width
# @see Wx::Bitmap#get_width
# @return [Float]
def get_logical_height; end
alias_method :logical_height, :get_logical_height
# Returns the size of the bitmap in logical pixels.
#
# For the platforms using DPI-independent pixels, i.e. those where {Wx::HAS_DPI_INDEPENDENT_PIXELS} is defined, such as WXOSX or WXGTK 3, this function returns the physical size of the bitmap, as returned by {Wx::Bitmap#get_size}, divided by its scale factor, as returned by {Wx::Bitmap#get_scale_factor}, while for the other platforms, it simply returns the same thing as {Wx::Bitmap#get_size}.
# This ensures that the result of this function is always expressed in the pixel coordinates appropriate for the current platform, i.e. its return value is always in logical pixels, used for window and {Wx::DC} coordinates, whether these pixels are the same as physical pixels, which are returned by {Wx::Bitmap#get_size}, or not.
# @see Wx::Bitmap#get_logical_width
# @see Wx::Bitmap#get_logical_height
# @see Wx::Bitmap#get_size
# @return [Wx::Size]
def get_logical_size; end
alias_method :logical_size, :get_logical_size
# Returns the width of the bitmap in logical pixels.
#
# See {Wx::Bitmap#get_logical_size} for more information.
# @see Wx::Bitmap#get_logical_height
# @see Wx::Bitmap#get_width
# @return [Float]
def get_logical_width; end
alias_method :logical_width, :get_logical_width
# Gets the associated mask (if any) which may have been loaded from a file or set for the bitmap.
#
#
# @see Wx::Bitmap#set_mask
# @see Wx::Mask
# @return [Wx::Mask]
def get_mask; end
alias_method :mask, :get_mask
# Returns a sub bitmap of the current one as long as the rect belongs entirely to the bitmap.
#
# This function preserves bit depth and mask information.
# @param rect [Wx::Rect]
# @return [Wx::Bitmap]
def get_sub_bitmap(rect) end
alias_method :sub_bitmap, :get_sub_bitmap
# Returns the scale factor of this bitmap.
#
# Scale factor is 1 by default, but can be greater to indicate that the size of bitmap in logical, DPI-independent pixels is smaller than its actual size in physical pixels. Bitmaps with scale factor greater than 1 must be used in high DPI to appear sharp on the screen.
# Note that the scale factor is only used in the ports where logical pixels are not the same as physical ones, such as WXOSX or WXGTK3, and this function always returns 1 under the other platforms.
# @see Wx::Bitmap#set_scale_factor
# @see Wx::Bitmap#get_logical_width
# @see Wx::Bitmap#get_logical_height
# @see Wx::Bitmap#get_logical_size
# @return [Float]
def get_scale_factor; end
alias_method :scale_factor, :get_scale_factor
# Returns the height of the bitmap in logical pixels.
#
# This is an older synonym for {Wx::Bitmap#get_logical_height}, use the new function in the new code.
# @return [Float]
def get_scaled_height; end
alias_method :scaled_height, :get_scaled_height
# Returns the size of the bitmap in logical pixels.
#
# This is an older synonym for {Wx::Bitmap#get_logical_size}, use the new function in the new code.
# @return [Wx::Size]
def get_scaled_size; end
alias_method :scaled_size, :get_scaled_size
# Returns the width of the bitmap in logical pixels.
#
# This is an older synonym for {Wx::Bitmap#get_logical_width}, use the new function in the new code.
# @return [Float]
def get_scaled_width; end
alias_method :scaled_width, :get_scaled_width
# Returns the size of the bitmap in physical pixels.
#
# The return value of this function doesn't depend on the scale factor, it is always the physical size of the bitmap, i.e. corresponding to the actual number of pixels in it.
# @see Wx::Bitmap#get_height
# @see Wx::Bitmap#get_width
# @see Wx::Bitmap#get_logical_size
# @return [Wx::Size]
def get_size; end
alias_method :size, :get_size
# Returns the width of the bitmap in physical pixels.
#
#
# @see Wx::Bitmap#get_height
# @see Wx::Bitmap#get_size
# @see Wx::Bitmap#get_logical_width
# @return [Integer]
def get_width; end
alias_method :width, :get_width
# Returns true if the bitmap has an alpha channel.
#
# Note that the fact that a bitmap has an alpha channel doesn't necessarily mean that it has any transparency, as all of its pixels could be using {Wx::ALPHA_OPAQUE} value. To actually examine the alpha values, the bitmap can be converted to {Wx::Image}.
# @return [Boolean]
def has_alpha; end
alias_method :has_alpha?, :has_alpha
# Returns true if bitmap data is present.
# @return [Boolean]
def is_ok; end
alias_method :ok?, :is_ok
# Loads a bitmap from a file or resource.
#
# true if the operation succeeded, false otherwise.
#
#
A palette may be associated with the bitmap if one exists (especially for colour Windows bitmaps), and if the code supports it. You can check if one has been created by using the {Wx::Bitmap#get_palette} member. #
#Depending on how wxWidgets has been configured, not all formats may be available. #
#The bitmap object owns the mask once this has been called. #
#A mask can be set also for bitmap with an alpha channel but doing so under WXMSW is not recommended because performance of drawing such bitmap is not very good. #
#A mask can be associated also with a bitmap with an alpha channel but drawing such bitmaps under WXMSW may be slow so using them should be avoided if drawing performance is an important factor. #
#