You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
If I render text to a surface, then render the surface to the screen, the text is flipped upside down. Happens in linux and stdweb. Possible this is a duplicate of #623, but he only mentions scale not the image being flipped.
To Reproduce
use quicksilver::{
geom::{Rectangle, Vector, Circle},
graphics::{Color, VectorFont, Image, PixelFormat, Surface},
run, Graphics, Input, Result, Settings, Window,
};
fn main() {
run(
Settings {
size: Vector::new(1920.0, 1080.0),
title: "Square Example",
..Settings::default()
},
app,
);
}
async fn app(window: Window, mut gfx: Graphics, mut input: Input) -> Result<()> {
// Clear the screen to a blank, white color
gfx.clear(Color::WHITE);
// Paint a blue square with a red outline in the center of our screen
// It should have a top-left of (350, 100) and a size of (150, 100)
let rect = Rectangle::new(Vector::new(350.0, 100.0), Vector::new(100.0, 100.0));
let ttf = VectorFont::load("font.ttf").await?;
let mut font = ttf.to_renderer(&gfx, 72.0)?;
gfx.fill_rect(&rect, Color::BLUE);
gfx.stroke_rect(&rect, Color::RED);
// Send the data to be drawn
dbg!("{:?}", window.size());
let mut surface = Surface::new(
&gfx,
Image::from_raw(&gfx, None, 512, 512, PixelFormat::RGBA)?,
)?;
// // Set the render area to the surface size
gfx.fit_to_surface(&surface)?;
// // Draw a circle inside a rectangle
gfx.fill_rect(
&Rectangle::new(Vector::new(350.0, 100.0), Vector::new(100.0, 100.0)),
Color::RED,
);
font.draw(
&mut gfx,
"Hello world!\nHello Quicksilver!",
Color::BLACK,
Vector::new(100.0, 100.0),
)?;
gfx.fill_circle(&Circle::new(Vector::new(400.0, 150.0), 50.0), Color::BLACK);
// Flush to the surface, which draws to the image
gfx.flush(Some(&surface))?;
gfx.fit_to_window(&window);
let image = surface.detach().expect("The image failed to detach");
gfx.draw_image(&image, Rectangle::new_sized(Vector::new(400.0, 300.0)));
gfx.draw_image(
&image,
Rectangle::new(Vector::new(400.0, 300.0), Vector::new(400.0, 300.0)),
);
gfx.present(&window)?;
loop {
while let Some(_) = input.next_event().await {}
}
}
Environment and versions (please complete the following information):
Environment: Ubuntu 19.10, Chrome Version 81.0.4044.138 (Official Build) (64-bit)
Rust compiler version: rustc 1.44.0 (49cae5576 2020-06-01)
Quicksilver verison: quicksilver = "0.4.0-alpha0.5"
The text was updated successfully, but these errors were encountered:
Describe the bug
If I render text to a surface, then render the surface to the screen, the text is flipped upside down. Happens in linux and stdweb. Possible this is a duplicate of #623, but he only mentions scale not the image being flipped.
To Reproduce
Environment and versions (please complete the following information):
Environment: Ubuntu 19.10, Chrome Version 81.0.4044.138 (Official Build) (64-bit)
Rust compiler version: rustc 1.44.0 (49cae5576 2020-06-01)
Quicksilver verison: quicksilver = "0.4.0-alpha0.5"
The text was updated successfully, but these errors were encountered: