# sfml_rust::canvas::canvas_state::Drawable - Rust
API documentation for the Rust `Drawable` trait in crate `sfml_rust`.
Keywords: rust, rustlang, rust-lang, Drawable

# [−] [src] Trait sfml_rust::canvas::canvas_state::Drawable

    pub trait Drawable {
        fn get_vertices(&self) -> Vec<(f32, f32, f32)>;
        fn get_color(&self) -> (f32, f32, f32, f32);
        fn get_ti_coords(&self) -> Vec<(f32, f32)>;
        fn get_texture_handle(&self) -> Option<Arc<CanvasTextureHandle>>;
        fn get_image_handle(&self) -> Option<Arc<CanvasImageHandle>>;

        fn collect(&self) -> Vec<RuntimeVertexDef> { ... }
    }

A drawable object can be passed into a CanvasFrame to be rendered Very generic implementation. (N % 2 == 0) vertices, ditto for texture coords, and rgba color Provides Image and Texture handles for drawing

## Required methods

### `fn get_vertices(&self) -> Vec<(f32, f32, f32)>`

### `fn get_color(&self) -> (f32, f32, f32, f32)`

### `fn get_ti_coords(&self) -> Vec<(f32, f32)>`

### `fn get_texture_handle(&self) -> Option<Arc<CanvasTextureHandle>>`

### `fn get_image_handle(&self) -> Option<Arc<CanvasImageHandle>>`

Loading content...

## Provided methods

### `fn collect(&self) -> Vec<RuntimeVertexDef>`

Loading content...

## Implementors

### `impl Drawable for CompuSprite` [src]

#### `fn get_vertices(&self) -> Vec<(f32, f32, f32)>` [src]

#### `fn get_color(&self) -> (f32, f32, f32, f32)` [src]

#### `fn get_ti_coords(&self) -> Vec<(f32, f32)>` [src]

#### `fn get_texture_handle(&self) -> Option<Arc<CanvasTextureHandle>>` [src]

#### `fn get_image_handle(&self) -> Option<Arc<CanvasImageHandle>>` [src]

### `impl Drawable for Poly` [src]

#### `fn get_vertices(&self) -> Vec<(f32, f32, f32)>` [src]

#### `fn get_color(&self) -> (f32, f32, f32, f32)` [src]

#### `fn get_ti_coords(&self) -> Vec<(f32, f32)>` [src]

#### `fn get_texture_handle(&self) -> Option<Arc<CanvasTextureHandle>>` [src]

#### `fn get_image_handle(&self) -> Option<Arc<CanvasImageHandle>>` [src]

### `impl Drawable for Sprite` [src]

#### `fn get_vertices(&self) -> Vec<(f32, f32, f32)>` [src]

#### `fn get_color(&self) -> (f32, f32, f32, f32)` [src]

#### `fn get_ti_coords(&self) -> Vec<(f32, f32)>` [src]

#### `fn get_texture_handle(&self) -> Option<Arc<CanvasTextureHandle>>` [src]

#### `fn get_image_handle(&self) -> Option<Arc<CanvasImageHandle>>` [src]

Loading content...

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)