TextureSettings

Struct TextureSettings 

Source
pub struct TextureSettings { /* private fields */ }
Expand description

Texture creation parameters.

Implementations§

Source§

impl TextureSettings

Source

pub fn new() -> TextureSettings

Create default settings.

Examples found in repository?
examples/text_test.rs (line 23)
11fn main() {
12    let opengl = OpenGL::V3_2;
13    let size = [500, 300];
14    let ref mut window: GliumWindow = WindowSettings::new("gfx_graphics: text_test", size)
15        .exit_on_esc(true)
16        .graphics_api(opengl)
17        .build()
18        .unwrap();
19
20    let mut glyph_cache = GlyphCache::new(
21        Path::new("assets/FiraSans-Regular.ttf"),
22        window.clone(),
23        TextureSettings::new(),
24    )
25    .unwrap();
26
27    let mut g2d = Glium2d::new(opengl, window);
28    window.set_lazy(true);
29    while let Some(e) = window.next() {
30        if let Some(args) = e.render_args() {
31            let mut target = window.draw();
32            g2d.draw(&mut target, args.viewport(), |c, g| {
33                use graphics::*;
34
35                clear([1.0; 4], g);
36                text::Text::new_color([0.0, 0.5, 0.0, 1.0], 32)
37                    .draw(
38                        "Hello glium_graphics!",
39                        &mut glyph_cache,
40                        &DrawState::default(),
41                        c.transform.trans(10.0, 100.0),
42                        g,
43                    )
44                    .unwrap();
45            });
46            target.finish().unwrap();
47        }
48    }
49}
More examples
Hide additional examples
examples/image_test.rs (line 25)
12fn main() {
13    let opengl = OpenGL::V3_2;
14    let (w, h) = (300, 300);
15    let ref mut window: GliumWindow = WindowSettings::new("glium_graphics: image_test", [w, h])
16        .exit_on_esc(true)
17        .graphics_api(opengl)
18        .build()
19        .unwrap();
20
21    let rust_logo = Texture::from_path(
22        window,
23        "assets/rust.png",
24        Flip::None,
25        &TextureSettings::new(),
26    )
27    .unwrap();
28
29    let mut g2d = Glium2d::new(opengl, window);
30    window.set_lazy(true);
31    while let Some(e) = window.next() {
32        use graphics::*;
33
34        if let Some(args) = e.render_args() {
35            let mut target = window.draw();
36            g2d.draw(&mut target, args.viewport(), |c, g| {
37                clear(color::WHITE, g);
38                rectangle(
39                    [1.0, 0.0, 0.0, 1.0],
40                    [0.0, 0.0, 100.0, 100.0],
41                    c.transform,
42                    g,
43                );
44                rectangle(
45                    [0.0, 1.0, 0.0, 0.3],
46                    [50.0, 50.0, 100.0, 100.0],
47                    c.transform,
48                    g,
49                );
50                image(&rust_logo, c.transform.trans(100.0, 100.0), g);
51            });
52            target.finish().unwrap();
53        }
54    }
55}
examples/colored_image_test.rs (line 25)
12fn main() {
13    let opengl = OpenGL::V3_2;
14    let (w, h) = (300, 300);
15    let ref mut window: GliumWindow = WindowSettings::new("glium_graphics: colored_image_test", [w, h])
16        .exit_on_esc(true)
17        .graphics_api(opengl)
18        .build()
19        .unwrap();
20
21    let rust_logo = Texture::from_path(
22        window,
23        "assets/rust-white.png",
24        Flip::None,
25        &TextureSettings::new(),
26    )
27    .unwrap();
28
29    let mut g2d = Glium2d::new(opengl, window);
30    window.set_lazy(true);
31    while let Some(e) = window.next() {
32        use graphics::*;
33
34        if let Some(args) = e.render_args() {
35            let mut target = window.draw();
36            g2d.draw(&mut target, args.viewport(), |c, g| {
37                use graphics::triangulation::{tx, ty};
38
39                let transform = c.transform.trans(0.0, 0.0);
40
41                let tr = |p: [f64; 2]| [tx(transform, p[0], p[1]), ty(transform, p[0], p[1])];
42
43                clear(color::WHITE, g);
44                Rectangle::new([1.0, 0.0, 0.0, 1.0])
45                    .draw([0.0, 0.0, 100.0, 100.0], &c.draw_state, c.transform, g);
46                Rectangle::new([0.0, 1.0, 0.0, 0.3])
47                    .draw([50.0, 50.0, 100.0, 100.0], &c.draw_state, c.transform, g);
48                g.tri_list_uv_c(&c.draw_state, &rust_logo, |f| {
49                    (f)(
50                        &[
51                            tr([0.0, 0.0]),
52                            tr([300.0, 0.0]),
53                            tr([0.0, 300.0]),
54
55                            tr([300.0, 0.0]),
56                            tr([0.0, 300.0]),
57                            tr([300.0, 300.0]),
58                        ],
59                        &[
60                            [0.0, 0.0],
61                            [1.0, 0.0],
62                            [0.0, 1.0],
63
64                            [1.0, 0.0],
65                            [0.0, 1.0],
66                            [1.0, 1.0],
67                        ],
68                        &[
69                            [1.0, 0.0, 0.0, 1.0],
70                            [0.0, 1.0, 0.0, 1.0],
71                            [0.0, 0.0, 1.0, 1.0],
72
73                            [0.0, 00.0, 0.0, 1.0],
74                            [0.0, 00.0, 0.0, 1.0],
75                            [0.0, 00.0, 0.0, 1.0],
76                        ]
77                    )
78                });
79            });
80            target.finish().unwrap();
81        }
82    }
83}
examples/texture_wrap.rs (line 34)
12fn main() {
13    println!("Press U to change the texture wrap mode for the u coordinate");
14    println!("Press V to change the texture wrap mode for the v coordinate");
15
16    let opengl = OpenGL::V3_2;
17    let (w, h) = (600, 600);
18    let mut window: GliumWindow = WindowSettings::new("glium_graphics: texture_wrap", [w, h])
19        .exit_on_esc(true)
20        .graphics_api(opengl)
21        .build()
22        .unwrap();
23    window.set_lazy(true);
24
25    // Set up wrap modes
26    let wrap_modes = [
27        Wrap::ClampToEdge,
28        Wrap::ClampToBorder,
29        Wrap::Repeat,
30        Wrap::MirroredRepeat,
31    ];
32    let mut ix_u = 0;
33    let mut ix_v = 0;
34    let mut texture_settings = TextureSettings::new();
35    texture_settings.set_border_color([0.0, 0.0, 0.0, 1.0]);
36
37    let mut rust_logo = Texture::from_path(
38        &mut window,
39        "assets/rust.png",
40        Flip::None,
41        &texture_settings,
42    )
43    .unwrap();
44
45    let mut g2d = Glium2d::new(opengl, &mut window);
46    while let Some(e) = window.next() {
47        if let Some(args) = e.render_args() {
48            use graphics::*;
49            let mut target = window.draw();
50            g2d.draw(&mut target, args.viewport(), |_c, g| {
51                clear([1.0; 4], g);
52                let points = [[0.5, 0.5], [-0.5, 0.5], [-0.5, -0.5], [0.5, -0.5]];
53                // (0, 1, 2) and (0, 2, 3)
54                let uvs = [
55                    [4.0, 0.0],
56                    [0.0, 0.0],
57                    [0.0, 4.0],
58                    [4.0, 0.0],
59                    [0.0, 4.0],
60                    [4.0, 4.0],
61                ];
62                let mut verts = [[0.0, 0.0]; 6];
63                let indices_points: [usize; 6] = [0, 1, 2, 0, 2, 3];
64                for (ixv, &ixp) in (0..6).zip((&indices_points).into_iter()) {
65                    verts[ixv] = points[ixp];
66                }
67                g.tri_list_uv(&DrawState::new_alpha(), &[1.0; 4], &rust_logo, |f| {
68                    f(&verts, &uvs)
69                });
70            });
71            target.finish().unwrap();
72        }
73
74        if let Some(Button::Keyboard(Key::U)) = e.press_args() {
75            ix_u = (ix_u + 1) % wrap_modes.len();
76            texture_settings.set_wrap_u(wrap_modes[ix_u]);
77            rust_logo = Texture::from_path(
78                &mut window,
79                "assets/rust.png",
80                Flip::None,
81                &texture_settings,
82            )
83            .unwrap();
84            println!(
85                "Changed texture wrap mode for u coordinate to: {:?}",
86                wrap_modes[ix_u]
87            );
88        }
89
90        if let Some(Button::Keyboard(Key::V)) = e.press_args() {
91            ix_v = (ix_v + 1) % wrap_modes.len();
92            texture_settings.set_wrap_v(wrap_modes[ix_v]);
93            rust_logo = Texture::from_path(
94                &mut window,
95                "assets/rust.png",
96                Flip::None,
97                &texture_settings,
98            )
99            .unwrap();
100            println!(
101                "Changed texture wrap mode for v coordinate to: {:?}",
102                wrap_modes[ix_v]
103            );
104        }
105    }
106}
examples/draw_state.rs (line 29)
11fn main() {
12    println!("Press A to change blending");
13    println!("Press S to change clip inside/out");
14
15    let opengl = OpenGL::V3_2;
16    let (w, h) = (640, 480);
17    let ref mut window: GliumWindow = WindowSettings::new("glium_graphics: image_test", [w, h])
18        .exit_on_esc(true)
19        .graphics_api(opengl)
20        .build()
21        .unwrap();
22
23    let mut blend = Blend::Alpha;
24    let mut clip_inside = true;
25    let rust_logo = Texture::from_path(
26        window,
27        "assets/rust.png",
28        Flip::None,
29        &TextureSettings::new(),
30    )
31    .unwrap();
32
33    let mut g2d = Glium2d::new(opengl, window);
34    window.set_lazy(true);
35    while let Some(e) = window.next() {
36        if let Some(args) = e.render_args() {
37            use graphics::*;
38
39            let mut target = window.draw();
40            g2d.draw(&mut target, args.viewport(), |c, g| {
41                clear([0.8, 0.8, 0.8, 1.0], g);
42                g.clear_stencil(0);
43                Rectangle::new([1.0, 0.0, 0.0, 1.0]).draw(
44                    [0.0, 0.0, 100.0, 100.0],
45                    &c.draw_state,
46                    c.transform,
47                    g,
48                );
49
50                let draw_state = c.draw_state.blend(blend);
51                Rectangle::new([0.5, 1.0, 0.0, 0.3]).draw(
52                    [50.0, 50.0, 100.0, 100.0],
53                    &draw_state,
54                    c.transform,
55                    g,
56                );
57
58                let transform = c.transform.trans(100.0, 100.0);
59                // Compute clip rectangle from upper left corner.
60                let (clip_x, clip_y, clip_w, clip_h) = (100, 100, 100, 100);
61                let (clip_x, clip_y, clip_w, clip_h) = (
62                    clip_x,
63                    c.viewport.unwrap().draw_size[1] - clip_y - clip_h,
64                    clip_w,
65                    clip_h,
66                );
67                let clipped = c.draw_state.scissor([clip_x, clip_y, clip_w, clip_h]);
68                Image::new().draw(&rust_logo, &clipped, transform, g);
69
70                let transform = c.transform.trans(200.0, 200.0);
71                Ellipse::new([1.0, 0.0, 0.0, 1.0]).draw(
72                    [0.0, 0.0, 50.0, 50.0],
73                    &DrawState::new_clip(),
74                    transform,
75                    g,
76                );
77                Image::new().draw(
78                    &rust_logo,
79                    &(if clip_inside {
80                        DrawState::new_inside()
81                    } else {
82                        DrawState::new_outside()
83                    }),
84                    transform,
85                    g,
86                );
87            });
88
89            target.finish().unwrap();
90        }
91
92        if let Some(Button::Keyboard(Key::A)) = e.press_args() {
93            blend = match blend {
94                Blend::Alpha => Blend::Add,
95                Blend::Add => Blend::Multiply,
96                Blend::Multiply => Blend::Invert,
97                Blend::Invert => Blend::Lighter,
98                Blend::Lighter => Blend::Alpha,
99            };
100            println!("Changed blending to {:?}", blend);
101        }
102
103        if let Some(Button::Keyboard(Key::S)) = e.press_args() {
104            clip_inside = !clip_inside;
105            if clip_inside {
106                println!("Changed to clip inside");
107            } else {
108                println!("Changed to clip outside");
109            }
110        }
111    }
112}
Source

pub fn get_convert_gamma(&self) -> bool

Gets whether to convert gamma, treated as sRGB color space.

Source

pub fn set_convert_gamma(&mut self, val: bool)

Sets convert gamma.

Source

pub fn convert_gamma(self, val: bool) -> TextureSettings

Sets convert gamma.

Source

pub fn get_compress(&self) -> bool

Gets wheter compress on the GPU.

Source

pub fn set_compress(&mut self, val: bool)

Sets compress.

Source

pub fn compress(self, val: bool) -> TextureSettings

Sets compress.

Source

pub fn get_generate_mipmap(&self) -> bool

Gets generate mipmap.

Source

pub fn set_generate_mipmap(&mut self, val: bool)

Sets generate mipmap.

Source

pub fn generate_mipmap(self, val: bool) -> TextureSettings

Sets generate mipmap.

Source

pub fn get_min(&self) -> Filter

Gets minify filter.

Source

pub fn set_min(&mut self, val: Filter)

Sets minify filter.

Source

pub fn min(self, val: Filter) -> TextureSettings

Sets minify filter.

Source

pub fn get_mag(&self) -> Filter

Gets magnify filter

Source

pub fn set_mag(&mut self, val: Filter)

Sets magnify filter

Source

pub fn mag(self, val: Filter) -> TextureSettings

Sets magnify filter

Source

pub fn get_mipmap(&self) -> Filter

Gets minify mipmap filter

Source

pub fn set_mipmap(&mut self, val: Filter)

Sets magnify mipmap filter, and sets generate_mipmap to true.

Source

pub fn mipmap(self, val: Filter) -> TextureSettings

Sets magnify mipmap filter, and sets generate_mipmap to true

Source

pub fn get_filter(&self) -> (Filter, Filter)

Returns the min and mag filter

Source

pub fn set_filter(&mut self, val: Filter)

Sets the min and mag filter

Source

pub fn filter(self, val: Filter) -> TextureSettings

Sets the min and mag filter

Source

pub fn get_wrap_u(&self) -> Wrap

Gets the wrapping mode for the u coordinate

Source

pub fn set_wrap_u(&mut self, val: Wrap)

Sets the wrapping mode for the u coordinate

Examples found in repository?
examples/texture_wrap.rs (line 76)
12fn main() {
13    println!("Press U to change the texture wrap mode for the u coordinate");
14    println!("Press V to change the texture wrap mode for the v coordinate");
15
16    let opengl = OpenGL::V3_2;
17    let (w, h) = (600, 600);
18    let mut window: GliumWindow = WindowSettings::new("glium_graphics: texture_wrap", [w, h])
19        .exit_on_esc(true)
20        .graphics_api(opengl)
21        .build()
22        .unwrap();
23    window.set_lazy(true);
24
25    // Set up wrap modes
26    let wrap_modes = [
27        Wrap::ClampToEdge,
28        Wrap::ClampToBorder,
29        Wrap::Repeat,
30        Wrap::MirroredRepeat,
31    ];
32    let mut ix_u = 0;
33    let mut ix_v = 0;
34    let mut texture_settings = TextureSettings::new();
35    texture_settings.set_border_color([0.0, 0.0, 0.0, 1.0]);
36
37    let mut rust_logo = Texture::from_path(
38        &mut window,
39        "assets/rust.png",
40        Flip::None,
41        &texture_settings,
42    )
43    .unwrap();
44
45    let mut g2d = Glium2d::new(opengl, &mut window);
46    while let Some(e) = window.next() {
47        if let Some(args) = e.render_args() {
48            use graphics::*;
49            let mut target = window.draw();
50            g2d.draw(&mut target, args.viewport(), |_c, g| {
51                clear([1.0; 4], g);
52                let points = [[0.5, 0.5], [-0.5, 0.5], [-0.5, -0.5], [0.5, -0.5]];
53                // (0, 1, 2) and (0, 2, 3)
54                let uvs = [
55                    [4.0, 0.0],
56                    [0.0, 0.0],
57                    [0.0, 4.0],
58                    [4.0, 0.0],
59                    [0.0, 4.0],
60                    [4.0, 4.0],
61                ];
62                let mut verts = [[0.0, 0.0]; 6];
63                let indices_points: [usize; 6] = [0, 1, 2, 0, 2, 3];
64                for (ixv, &ixp) in (0..6).zip((&indices_points).into_iter()) {
65                    verts[ixv] = points[ixp];
66                }
67                g.tri_list_uv(&DrawState::new_alpha(), &[1.0; 4], &rust_logo, |f| {
68                    f(&verts, &uvs)
69                });
70            });
71            target.finish().unwrap();
72        }
73
74        if let Some(Button::Keyboard(Key::U)) = e.press_args() {
75            ix_u = (ix_u + 1) % wrap_modes.len();
76            texture_settings.set_wrap_u(wrap_modes[ix_u]);
77            rust_logo = Texture::from_path(
78                &mut window,
79                "assets/rust.png",
80                Flip::None,
81                &texture_settings,
82            )
83            .unwrap();
84            println!(
85                "Changed texture wrap mode for u coordinate to: {:?}",
86                wrap_modes[ix_u]
87            );
88        }
89
90        if let Some(Button::Keyboard(Key::V)) = e.press_args() {
91            ix_v = (ix_v + 1) % wrap_modes.len();
92            texture_settings.set_wrap_v(wrap_modes[ix_v]);
93            rust_logo = Texture::from_path(
94                &mut window,
95                "assets/rust.png",
96                Flip::None,
97                &texture_settings,
98            )
99            .unwrap();
100            println!(
101                "Changed texture wrap mode for v coordinate to: {:?}",
102                wrap_modes[ix_v]
103            );
104        }
105    }
106}
Source

pub fn wrap_u(self, val: Wrap) -> TextureSettings

Sets the wrapping mode for the u coordinate

Source

pub fn get_wrap_v(&self) -> Wrap

Gets the wrapping mode for the v coordinate

Source

pub fn set_wrap_v(&mut self, val: Wrap)

Sets the wrapping mode for the v coordinate

Examples found in repository?
examples/texture_wrap.rs (line 92)
12fn main() {
13    println!("Press U to change the texture wrap mode for the u coordinate");
14    println!("Press V to change the texture wrap mode for the v coordinate");
15
16    let opengl = OpenGL::V3_2;
17    let (w, h) = (600, 600);
18    let mut window: GliumWindow = WindowSettings::new("glium_graphics: texture_wrap", [w, h])
19        .exit_on_esc(true)
20        .graphics_api(opengl)
21        .build()
22        .unwrap();
23    window.set_lazy(true);
24
25    // Set up wrap modes
26    let wrap_modes = [
27        Wrap::ClampToEdge,
28        Wrap::ClampToBorder,
29        Wrap::Repeat,
30        Wrap::MirroredRepeat,
31    ];
32    let mut ix_u = 0;
33    let mut ix_v = 0;
34    let mut texture_settings = TextureSettings::new();
35    texture_settings.set_border_color([0.0, 0.0, 0.0, 1.0]);
36
37    let mut rust_logo = Texture::from_path(
38        &mut window,
39        "assets/rust.png",
40        Flip::None,
41        &texture_settings,
42    )
43    .unwrap();
44
45    let mut g2d = Glium2d::new(opengl, &mut window);
46    while let Some(e) = window.next() {
47        if let Some(args) = e.render_args() {
48            use graphics::*;
49            let mut target = window.draw();
50            g2d.draw(&mut target, args.viewport(), |_c, g| {
51                clear([1.0; 4], g);
52                let points = [[0.5, 0.5], [-0.5, 0.5], [-0.5, -0.5], [0.5, -0.5]];
53                // (0, 1, 2) and (0, 2, 3)
54                let uvs = [
55                    [4.0, 0.0],
56                    [0.0, 0.0],
57                    [0.0, 4.0],
58                    [4.0, 0.0],
59                    [0.0, 4.0],
60                    [4.0, 4.0],
61                ];
62                let mut verts = [[0.0, 0.0]; 6];
63                let indices_points: [usize; 6] = [0, 1, 2, 0, 2, 3];
64                for (ixv, &ixp) in (0..6).zip((&indices_points).into_iter()) {
65                    verts[ixv] = points[ixp];
66                }
67                g.tri_list_uv(&DrawState::new_alpha(), &[1.0; 4], &rust_logo, |f| {
68                    f(&verts, &uvs)
69                });
70            });
71            target.finish().unwrap();
72        }
73
74        if let Some(Button::Keyboard(Key::U)) = e.press_args() {
75            ix_u = (ix_u + 1) % wrap_modes.len();
76            texture_settings.set_wrap_u(wrap_modes[ix_u]);
77            rust_logo = Texture::from_path(
78                &mut window,
79                "assets/rust.png",
80                Flip::None,
81                &texture_settings,
82            )
83            .unwrap();
84            println!(
85                "Changed texture wrap mode for u coordinate to: {:?}",
86                wrap_modes[ix_u]
87            );
88        }
89
90        if let Some(Button::Keyboard(Key::V)) = e.press_args() {
91            ix_v = (ix_v + 1) % wrap_modes.len();
92            texture_settings.set_wrap_v(wrap_modes[ix_v]);
93            rust_logo = Texture::from_path(
94                &mut window,
95                "assets/rust.png",
96                Flip::None,
97                &texture_settings,
98            )
99            .unwrap();
100            println!(
101                "Changed texture wrap mode for v coordinate to: {:?}",
102                wrap_modes[ix_v]
103            );
104        }
105    }
106}
Source

pub fn wrap_v(self, val: Wrap) -> TextureSettings

Sets the wrapping mode for the v coordinate

Source

pub fn get_border_color(&self) -> [f32; 4]

Gets the border color

Source

pub fn set_border_color(&mut self, val: [f32; 4])

Sets the border color

Examples found in repository?
examples/texture_wrap.rs (line 35)
12fn main() {
13    println!("Press U to change the texture wrap mode for the u coordinate");
14    println!("Press V to change the texture wrap mode for the v coordinate");
15
16    let opengl = OpenGL::V3_2;
17    let (w, h) = (600, 600);
18    let mut window: GliumWindow = WindowSettings::new("glium_graphics: texture_wrap", [w, h])
19        .exit_on_esc(true)
20        .graphics_api(opengl)
21        .build()
22        .unwrap();
23    window.set_lazy(true);
24
25    // Set up wrap modes
26    let wrap_modes = [
27        Wrap::ClampToEdge,
28        Wrap::ClampToBorder,
29        Wrap::Repeat,
30        Wrap::MirroredRepeat,
31    ];
32    let mut ix_u = 0;
33    let mut ix_v = 0;
34    let mut texture_settings = TextureSettings::new();
35    texture_settings.set_border_color([0.0, 0.0, 0.0, 1.0]);
36
37    let mut rust_logo = Texture::from_path(
38        &mut window,
39        "assets/rust.png",
40        Flip::None,
41        &texture_settings,
42    )
43    .unwrap();
44
45    let mut g2d = Glium2d::new(opengl, &mut window);
46    while let Some(e) = window.next() {
47        if let Some(args) = e.render_args() {
48            use graphics::*;
49            let mut target = window.draw();
50            g2d.draw(&mut target, args.viewport(), |_c, g| {
51                clear([1.0; 4], g);
52                let points = [[0.5, 0.5], [-0.5, 0.5], [-0.5, -0.5], [0.5, -0.5]];
53                // (0, 1, 2) and (0, 2, 3)
54                let uvs = [
55                    [4.0, 0.0],
56                    [0.0, 0.0],
57                    [0.0, 4.0],
58                    [4.0, 0.0],
59                    [0.0, 4.0],
60                    [4.0, 4.0],
61                ];
62                let mut verts = [[0.0, 0.0]; 6];
63                let indices_points: [usize; 6] = [0, 1, 2, 0, 2, 3];
64                for (ixv, &ixp) in (0..6).zip((&indices_points).into_iter()) {
65                    verts[ixv] = points[ixp];
66                }
67                g.tri_list_uv(&DrawState::new_alpha(), &[1.0; 4], &rust_logo, |f| {
68                    f(&verts, &uvs)
69                });
70            });
71            target.finish().unwrap();
72        }
73
74        if let Some(Button::Keyboard(Key::U)) = e.press_args() {
75            ix_u = (ix_u + 1) % wrap_modes.len();
76            texture_settings.set_wrap_u(wrap_modes[ix_u]);
77            rust_logo = Texture::from_path(
78                &mut window,
79                "assets/rust.png",
80                Flip::None,
81                &texture_settings,
82            )
83            .unwrap();
84            println!(
85                "Changed texture wrap mode for u coordinate to: {:?}",
86                wrap_modes[ix_u]
87            );
88        }
89
90        if let Some(Button::Keyboard(Key::V)) = e.press_args() {
91            ix_v = (ix_v + 1) % wrap_modes.len();
92            texture_settings.set_wrap_v(wrap_modes[ix_v]);
93            rust_logo = Texture::from_path(
94                &mut window,
95                "assets/rust.png",
96                Flip::None,
97                &texture_settings,
98            )
99            .unwrap();
100            println!(
101                "Changed texture wrap mode for v coordinate to: {:?}",
102                wrap_modes[ix_v]
103            );
104        }
105    }
106}
Source

pub fn border_color(self, val: [f32; 4]) -> TextureSettings

Sets the border color

Trait Implementations§

Source§

impl Clone for TextureSettings

Source§

fn clone(&self) -> TextureSettings

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TextureSettings

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Content for T
where T: Copy,

Source§

type Owned = T

A type that holds a sized version of the content.
Source§

fn read<F, E>(size: usize, f: F) -> Result<T, E>
where F: FnOnce(&mut T) -> Result<(), E>,

Prepares an output buffer, then turns this buffer into an Owned.
Source§

fn get_elements_size() -> usize

Returns the size of each element.
Source§

fn to_void_ptr(&self) -> *const ()

Produces a pointer to the data.
Source§

fn ref_from_ptr<'a>(ptr: *mut (), size: usize) -> Option<*mut T>

Builds a pointer to this type from a raw pointer.
Source§

fn is_size_suitable(size: usize) -> bool

Returns true if the size is suitable to store a type like this.
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more