wBitmap

This class encapsulates the system bitmap.

Notice: Because the constructor of wBitmap is Bitmap(), if you also import winim for BITMAP struct in Windows SDK, you may encounter a naming clash problem. Use winim.BITMAP or wNim.Bitmap() to resolve.

Superclass:wGdiObject
Seealso:wDC wIconImage

Types

wBitmapError = object of wGdiObjectError
  
An error raised when wBitmap creation failed.

Procs

proc init(self: wBitmap; width, height: int; depth: int = 0) {...}{.raises: [wBitmapError],
    tags: [].}
Initializes a new bitmap. A depth of 0 indicates the depth of the current screen.
proc Bitmap(width, height: int; depth: int = 0): wBitmap {...}{.inline, discardable,
    raises: [wBitmapError], tags: [].}
Constructor.
proc init(self: wBitmap; size: wSize; depth: int = 0) {...}{.raises: [wBitmapError], tags: [].}
Initializes a new bitmap. A depth of 0 indicates the depth of the current screen.
proc Bitmap(size: wSize; depth: int = 0): wBitmap {...}{.inline, discardable,
    raises: [wBitmapError], tags: [].}
Constructor.
proc init(self: wBitmap; gdipBmp: ptr GpBitmap) {...}{.raises: [wBitmapError], tags: [].}
Initializes a bitmap from a gdiplus bitmap handle.
proc Bitmap(gdipBmp: ptr GpBitmap): wBitmap {...}{.inline, discardable,
    raises: [wBitmapError], tags: [].}
Constructor.
proc init(self: wBitmap; image: wImage) {...}{.raises: [wNilAccess, wBitmapError], tags: [].}
Initializes a bitmap from the given wImage object.
proc Bitmap(image: wImage): wBitmap {...}{.inline, discardable,
                                  raises: [wNilAccess, wBitmapError], tags: [].}
Constructor.
proc init(self: wBitmap; iconImage: wIconImage) {...}{.
    raises: [wNilAccess, wNilAccess, Exception, wBitmapError], tags: [RootEffect].}
Initializes a bitmap from the given wIconImage object.
proc Bitmap(iconImage: wIconImage): wBitmap {...}{.inline, discardable,
    raises: [wNilAccess, Exception, wBitmapError], tags: [RootEffect].}
Constructor.
proc init(self: wBitmap; icon: wIcon) {...}{.raises: [wNilAccess, wNilAccess, Exception,
    wBitmapError], tags: [RootEffect].}
Initializes a bitmap from the given wIcon object.
proc Bitmap(icon: wIcon): wBitmap {...}{.inline, discardable,
                                raises: [wNilAccess, Exception, wBitmapError],
                                tags: [RootEffect].}
Constructor.
proc init(self: wBitmap; cursor: wCursor) {...}{.raises: [wNilAccess, wNilAccess, Exception,
    wBitmapError], tags: [RootEffect].}
Initializes a bitmap from the given wCursor object.
proc Bitmap(cursor: wCursor): wBitmap {...}{.inline, discardable, raises: [wNilAccess,
    Exception, wBitmapError], tags: [RootEffect].}
Constructor.
proc init(self: wBitmap; filename: string) {...}{.raises: [wNilAccess, Exception,
    wBitmapError], tags: [RootEffect].}
Initializes a bitmap from a image file.
proc Bitmap(filename: string): wBitmap {...}{.inline, discardable, raises: [wNilAccess,
    Exception, wBitmapError], tags: [RootEffect].}
Constructor.
proc init(self: wBitmap; data: pointer; length: int) {...}{.
    raises: [wNilAccess, Exception, wBitmapError], tags: [RootEffect].}
Initializes a bitmap from raw image data.
proc Bitmap(data: pointer; length: int): wBitmap {...}{.inline, discardable,
    raises: [wNilAccess, Exception, wBitmapError], tags: [RootEffect].}
Constructor.
proc init(self: wBitmap; handle: HBITMAP; copy = true; shared = false) {...}{.
    raises: [wBitmapError], tags: [].}
Initializes a bitmap from system bitmap handle. If copy is false, the function only wrap the handle to wBitmap object. If shared is false, the handle will be destroyed together with wBitmap object by the GC. Otherwise, the caller is responsible for destroying it.
proc Bitmap(handle: HBITMAP; copy = true; shared = false): wBitmap {...}{.inline, discardable,
    raises: [wBitmapError], tags: [].}
Constructor.
proc init(self: wBitmap; bmp: wBitmap) {...}{.raises: [wNilAccess, wBitmapError], tags: [].}
Initializes a bitmap from wBitmap object, aka. copy.
proc Bitmap(bmp: wBitmap): wBitmap {...}{.inline, discardable,
                                 raises: [wNilAccess, wBitmapError], tags: [].}
Constructor.
proc getSize(self: wBitmap): wSize {...}{.inline, raises: [], tags: [].}
Returns the size of the bitmap in pixels.
proc getWidth(self: wBitmap): int {...}{.inline, raises: [], tags: [].}
Gets the width of the bitmap in pixels.
proc getHeight(self: wBitmap): int {...}{.inline, raises: [], tags: [].}
Gets the height of the bitmap in pixels.
proc getDepth(self: wBitmap): int {...}{.inline, raises: [], tags: [].}
Gets the color depth of the bitmap.

Templates

template wNilBitmap(): untyped
Predefined empty bitmap. Don't delete.