GithubHelp home page GithubHelp logo

rahul-thakoor / embedded-graphics-web-simulator Goto Github PK

View Code? Open in Web Editor NEW
19.0 19.0 9.0 2.18 MB

A web simulator for the embedded-graphics library

Home Page: https://rahul-thakoor.github.io/embedded-graphics-web-simulator/

Rust 100.00%
embedded-rust rust wasm webassembly

embedded-graphics-web-simulator's People

Contributors

dependabot[bot] avatar jacobrosenthal avatar rahul-thakoor avatar reecestevens avatar spookyvision avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

embedded-graphics-web-simulator's Issues

Time for another release?

Hi! Love your work <3

I'm using embedded-graphics 0.8 but embedded-graphics-web-simulator only supports this in repo. I think it would be nice to put out another release.

display.size changed when output_settings.scale set

Hello!

I use your simulator for testing my drawing function.
The code below draws an image on the center of the display.

fn draw_image<D>(&raw_image: &ImageRawLE<Rgb565>, display: &mut D) -> Result<(), D::Error>
where
    D: DrawTarget<Rgb565>,
{
    use core::convert::TryFrom;
    let (w, h) = display.size().into();
    let (iw, ih) = (raw_image.width(), raw_image.height());
    let (x, y) = (
        i32::try_from(w / 2 - iw / 2).unwrap(),
        i32::try_from(h / 2 - ih / 2).unwrap(),
    );
    let top_left = Point::new(x, y);
    let image = Image::new(&raw_image, top_left);
    image.draw(display)
}

But I got different outputs according to the scale of display.

localhost_8081_

Current implementation of WebSimulatorDisplay looks to change its size by output_settings.

https://github.com/meganetaaan/embedded-graphics-web-simulator/blob/0158a015e0295a62db85c293590f7553fd289b99/examples/basic/src/lib.rs#L40

I think it might be better the display.size returns its original (not scaled) display size?

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.