BNBTexture

Objective-C

@interface BNBTexture : NSObject

- (void)loadResource:(nullable BNBResource *)res;

/**
 *Load texture data from specified file descriptor.
 *@param fd (i32): file descriptor, should be closed on the caller side.
 */
- (void)loadByFd:(int32_t)fd;

/**
 *Load texture data from specified file name. For now only supported .png, .jpeg, .jpg, .ktx (2d) images.
 *@param fileName (string): absolute path for image file
 */
- (void)load:(nonnull NSString *)fileName;

/**@return width (int) of loaded image */
- (int32_t)getWidth;

/**@return height (int) of loaded image */
- (int32_t)getHeight;

/**@return channels count of loaded image (R, RG, RGBA, i.e. 1, 2, or 4). */
- (int32_t)getLayers;

/**
 *set mimpap generation flag. (affect only on ogl backend).
 *@param enable (bool): mipmap generation enable flag.
 */
- (void)setMips:(BOOL)enable;

/**@return flag (bool) : mimpap generation flag  */
- (BOOL)hasMips;

/**
 *enable/disable texture tiling
 *@param enable (bool): tiled wrapping flag
 */
- (void)setTiling:(BOOL)enable;

/**@return tiled texture wrapping flag (bool). */
- (BOOL)getTiling;

/**
 *set texture filtering mode
 *param mode (texture_filtering_mode)
 */
- (void)setFiltering:(BNBTextureFilteringMode)type;

/**@return filtering mode (texture_filtering_mode) */
- (BNBTextureFilteringMode)getFilteringMode;

/**@return upcast to base type */
- (nullable BNBImage *)asImage;

@end

Swift

class BNBTexture : NSObject

Undocumented

  • Undocumented

    Declaration

    Objective-C

    - (void)loadResource:(nullable BNBResource *)res;

    Swift

    func load(_ res: BNBResource?)
  • Load texture data from specified file descriptor.

    Declaration

    Objective-C

    - (void)loadByFd:(int32_t)fd;

    Swift

    func load(byFd fd: Int32)

    Parameters

    fd

    (i32): file descriptor, should be closed on the caller side.

  • Load texture data from specified file name. For now only supported .png, .jpeg, .jpg, .ktx (2d) images.

    Declaration

    Objective-C

    - (void)load:(nonnull NSString *)fileName;

    Swift

    func load(_ fileName: String)

    Parameters

    fileName

    (string): absolute path for image file

  • Declaration

    Objective-C

    - (int32_t)getWidth;

    Swift

    func getWidth() -> Int32

    Return Value

    width (int) of loaded image

  • Declaration

    Objective-C

    - (int32_t)getHeight;

    Swift

    func getHeight() -> Int32

    Return Value

    height (int) of loaded image

  • Declaration

    Objective-C

    - (int32_t)getLayers;

    Swift

    func getLayers() -> Int32

    Return Value

    channels count of loaded image (R, RG, RGBA, i.e. 1, 2, or 4).

  • set mimpap generation flag. (affect only on ogl backend).

    Declaration

    Objective-C

    - (void)setMips:(BOOL)enable;

    Swift

    func setMips(_ enable: Bool)

    Parameters

    enable

    (bool): mipmap generation enable flag.

  • Declaration

    Objective-C

    - (BOOL)hasMips;

    Swift

    func hasMips() -> Bool

    Return Value

    flag (bool) : mimpap generation flag

  • enable/disable texture tiling

    Declaration

    Objective-C

    - (void)setTiling:(BOOL)enable;

    Swift

    func setTiling(_ enable: Bool)

    Parameters

    enable

    (bool): tiled wrapping flag

  • Declaration

    Objective-C

    - (BOOL)getTiling;

    Swift

    func getTiling() -> Bool

    Return Value

    tiled texture wrapping flag (bool).

  • set texture filtering mode param mode (texture_filtering_mode)

    Declaration

    Objective-C

    - (void)setFiltering:(BNBTextureFilteringMode)type;

    Swift

    func setFiltering(_ type: BNBTextureFilteringMode)
  • Declaration

    Objective-C

    - (BNBTextureFilteringMode)getFilteringMode;

    Swift

    func getFilteringMode() -> BNBTextureFilteringMode

    Return Value

    filtering mode (texture_filtering_mode)

  • Declaration

    Objective-C

    - (nullable BNBImage *)asImage;

    Swift

    func asImage() -> BNBImage?

    Return Value

    upcast to base type