Skip to content

stdlib/imageView source ↗

image

21 items · generated by scribe fromstdlib/image.fd· synced 2026-11-15

stdlib/image21 items

Contents

Image

pub struct Image {

Fields:

NameType
widthi64
heighti64
channelsi64
dataVec<i64>

Defined at line 24


image_create

Create a blank image (all black, fully opaque if RGBA).

pub fn image_create(width: i64, height: i64, channels: i64) -> Image {

Parameters:

  • width: i64
  • height: i64
  • channels: i64

Returns: Image

Defined at line 33


image_get_pixel

Get a pixel at (x, y). Returns RGBA as a packed i64: 0xRRGGBBAA.

pub fn image_get_pixel(img: & Image, x: i64, y: i64) -> i64 {

Parameters:

  • img: & Image
  • x: i64
  • y: i64

Returns: i64

Defined at line 61


image_set_pixel

Set a pixel at (x, y) from RGBA components.

pub fn image_set_pixel(img: & mut Image, x: i64, y: i64, r: i64, g: i64, b: i64, a: i64) -> void {

Parameters:

  • img: & mut Image
  • x: i64
  • y: i64
  • r: i64
  • g: i64
  • b: i64
  • a: i64

Returns: void

Defined at line 77


image_fill

Fill the entire image with a solid color.

pub fn image_fill(img: & mut Image, r: i64, g: i64, b: i64, a: i64) -> void {

Parameters:

  • img: & mut Image
  • r: i64
  • g: i64
  • b: i64
  • a: i64

Returns: void

Defined at line 91


image_free

Free image data (the Vec will be dropped automatically, but this clears it).

pub fn image_free(img: & mut Image) -> void {

Parameters:

  • img: & mut Image

Returns: void

Defined at line 104


image_load_png

Load a PNG image file. Returns an Image with width=0 on failure.

pub fn image_load_png(path: str) -> Image {

Parameters:

  • path: str

Returns: Image

Defined at line 128


image_load_jpg

Load a JPEG image file. Returns an Image with width=0 on failure.

pub fn image_load_jpg(path: str) -> Image {

Parameters:

  • path: str

Returns: Image

Defined at line 140


image_load

Load an image, auto-detecting format from file extension.

pub fn image_load(path: str) -> Image {

Parameters:

  • path: str

Returns: Image

Defined at line 151


image_to_texture

Convert an Image to an SDL texture for rendering. Returns texture handle or 0 on failure.

pub fn image_to_texture(ren: i64, img: & Image) -> i64 {

Parameters:

  • ren: i64
  • img: & Image

Returns: i64

Defined at line 175


image_flip_h

Flip an image horizontally (mirror left-right).

pub fn image_flip_h(img: & mut Image) -> void {

Parameters:

  • img: & mut Image

Returns: void

Defined at line 185


image_flip_v

Flip an image vertically (mirror top-bottom).

pub fn image_flip_v(img: & mut Image) -> void {

Parameters:

  • img: & mut Image

Returns: void

Defined at line 207


image_subregion

Extract a sub-region of an image as a new Image.

pub fn image_subregion(img: & Image, x: i64, y: i64, w: i64, h: i64) -> Image {

Parameters:

  • img: & Image
  • x: i64
  • y: i64
  • w: i64
  • h: i64

Returns: Image

Defined at line 228


image_resize_nn

Resize an image using nearest-neighbor sampling.

pub fn image_resize_nn(img: & Image, new_w: i64, new_h: i64) -> Image {

Parameters:

  • img: & Image
  • new_w: i64
  • new_h: i64

Returns: Image

Defined at line 252


Color

pub struct Color {

Fields:

NameType
ri64
gi64
bi64
ai64

Defined at line 276


color_pack

Pack RGBA components into a single i64: 0xRRGGBBAA.

pub fn color_pack(r: i64, g: i64, b: i64, a: i64) -> i64 {

Parameters:

  • r: i64
  • g: i64
  • b: i64
  • a: i64

Returns: i64

Defined at line 284


color_unpack

Unpack a color i64 into RGBA components.

pub fn color_unpack(c: i64) -> Color {

Parameters:

  • c: i64

Returns: Color

Defined at line 289


COLOR_WHITE:

pub const COLOR_WHITE: i64 = 0xFFFFFFFF; pub const COLOR_BLACK: i64 = 0x000000FF; pub const COLOR_RED: i64 = 0xFF0000FF; pub const COLOR_GREEN: i64 = 0x00FF00FF; pub const COLOR_BLUE: i64 = 0x0000FFFF; pub const COLOR_YELLOW: i64 = 0xFFFF00FF; pub const COLOR_CYAN: i64 = 0x00FFFFFF; pub const COLOR_MAGENTA: i64 = 0xFF00FFFF; pub const COLOR_TRANSPARENT: i64 = 0x00000000; pub const COLOR_GRAY: i64 = 0x808080FF; pub const COLOR_DARK_GRAY: i64 = 0x404040FF; pub const COLOR_LIGHT_GRAY: i64 = 0xC0C0C0FF;

Defined at line 300


Generated by scribe, the Fides documentation generator