capture takes (u32, u32)
This commit is contained in:
parent
e8eb9ac44b
commit
da4e6cbf6b
|
@ -193,7 +193,7 @@ fn main() {
|
|||
|
||||
// Make a screenshot
|
||||
let size = renderer.gl_window().get_inner_size().unwrap();
|
||||
let cap = renderer.capture(size);
|
||||
let cap = renderer.capture(size.into());
|
||||
cap.save(format!("capture-{}.png", capture_count)).unwrap();
|
||||
capture_count += 1;
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ use glium::uniforms::MagnifySamplerFilter;
|
|||
use glium::draw_parameters::{DepthTest, Blend};
|
||||
use glium::index::{NoIndices, PrimitiveType};
|
||||
use glium::glutin::GlWindow;
|
||||
use glium::glutin::dpi::LogicalSize;
|
||||
|
||||
use scene::Scene;
|
||||
use camera::{RenderCamera, mat_to_f32};
|
||||
|
@ -216,15 +215,12 @@ impl Renderer {
|
|||
}
|
||||
|
||||
/// Returns a DynamicImage of the corresponding frame.
|
||||
pub fn capture(&self, dimensions: LogicalSize) -> image::DynamicImage {
|
||||
pub fn capture(&self, dimensions: (u32, u32)) -> image::DynamicImage {
|
||||
rgba_image_data_to_image(self.capture_rgba_image_data(dimensions))
|
||||
}
|
||||
|
||||
/// Returns a RgbaImageData of the corresponding frame.
|
||||
pub fn capture_rgba_image_data(&self, dimensions: LogicalSize) -> RgbaImageData {
|
||||
|
||||
let dpi = self.gl_window().get_hidpi_factor();
|
||||
let dimensions: (u32, u32) = dimensions.to_physical(dpi).into();
|
||||
pub fn capture_rgba_image_data(&self, dimensions: (u32, u32)) -> RgbaImageData {
|
||||
|
||||
let rect = Rect {
|
||||
left: 0,
|
||||
|
|
Loading…
Reference in New Issue