!SfJCDXZbMHXkPovtKL:matrix.org

Rust Embedded Graphics

139 Members
Help and chat for embedded-graphics and the wider embedded Rust graphics ecosystem | https://github.com/embedded-graphics/embedded-graphics | https://crates.io/crates/embedded-graphics17 Servers

Load older messages


SenderMessageTime
23 Sep 2021
@jamwaffles:matrix.orgjamwafflesonly pain09:12:50
@jamwaffles:matrix.orgjamwaffles
In reply to @jamesmunns:matrix.org
Is there a thing that I could use to get anti-aliased/smoothed fonts?
I think if you can find an AA font bitmap, you should be able to create a custom MonoFont using that
09:14:20
@jamwaffles:matrix.orgjamwafflesNo transparency of course but if your "blend colour" is black/off anyway it should look fine?09:14:38
28 Sep 2021
@moerk:matrix.org@moerk:matrix.org left the room.04:52:42
@flovanmt:matrix.orgflovanmtima_cac3122.jpeg
Download ima_cac3122.jpeg
09:09:53
@flovanmt:matrix.orgflovanmtStart implementing an on screen keyboard for morph_ui09:10:10
@jamwaffles:matrix.orgjamwaffles:pog:09:13:20
@bugadani:matrix.orgbugadanipog indeed, it's awesome09:22:49
@flovanmt:matrix.orgflovanmtThanks 🙂09:32:35
@unrust:matrix.orgunrust joined the room.23:26:34
29 Sep 2021
@marek.miettinen:matrix.orgMarek Miettinen joined the room.21:56:30
@marek.miettinen:matrix.orgMarek Miettinen Hi! I've implemented Drawable for a bunch of structs (each in their own crate). I'd like to import them and put the (heterogenous) struct instances in a Vec, then loop over them and call .draw(&mut display) on each with a delay (and other setup) in between.
This doesn't work because Drawable cannot be made into an object ("the trait cannot be made into an object because method draw has generic type parameters").
Is there a way to circumvent the object safety rules, maybe by wrapping things in a struct or some container? Is there some fundamental reason why this can't work? I realize this is probably more of a Rust question than an embedded-graphics one, but would appreciate any help or direction, thanks!
22:16:44
@almindor:matrix.orgalmindorhttps://huonw.github.io/blog/2015/05/where-self-meets-sized-revisiting-object-safety/ is a good read on this, I also find this issue a PITA22:21:03
@almindor:matrix.orgalmindor the specific issue here is that Drawable has fn draw<D>(&self, target: &mut D) -> Result<Self::Output, D::Error> with the D generic param, making it "object-unsafe" because we don't know the vtable for D (as far as I understand the issue at least) 22:24:14
@marek.miettinen:matrix.orgMarek Miettinen Yes, so it seems I can't do this directly. I'm wondering if there's a more "idiomatic" way to achieve something like this using e-g. Or if it's possible to create a struct of my own (that would satisfy the object safety requirements, but would contain the actual Drawable) 22:30:49
@dirbaio:matrix.orgdirbaio

you can do this with an enum wrapper. it's a bit boilerplatey but it'll get around the non-object-safety

enum MyDrawable {
   Circle(Circle),
   Square(Square),
}

impl Drawable for MyDrawable {
   // methods deletgate to circle or square
}
22:38:52
@marek.miettinen:matrix.orgMarek Miettinen
In reply to @dirbaio:matrix.org

you can do this with an enum wrapper. it's a bit boilerplatey but it'll get around the non-object-safety

enum MyDrawable {
   Circle(Circle),
   Square(Square),
}

impl Drawable for MyDrawable {
   // methods deletgate to circle or square
}
This seems to work, thank you so much!
23:06:17
@felixfahrbahn:matrix.orgfelixfahrbahn joined the room.23:42:54
30 Sep 2021
@jim.tesson:matrix.org@jim.tesson:matrix.org joined the room.04:46:36
@jim.tesson:matrix.org@jim.tesson:matrix.org left the room.04:52:53
@jamwaffles:matrix.orgjamwaffles There's an issue here with I think a different symptom of the same problem if anyone wants to follow/comment. 08:40:15
3 Oct 2021
@sszilvasi:matrix.orgsszilvasi joined the room.05:39:13
5 Oct 2021
@felixfahrbahn:matrix.orgfelixfahrbahn set a profile picture.09:11:16
10 Oct 2021
@romen:matrix.orgromen joined the room.11:07:15
11 Oct 2021
@chris:cooperteam.netRAOF (he/his) joined the room.03:50:33
@antoinevg:matrix.organtoinevg set a profile picture.11:29:21
13 Oct 2021
@nipal:matrix.orgnipal joined the room.03:34:44
@yatekii:matrix.orgNoah changed their display name from yatekii to Noah.22:04:12
14 Oct 2021
@hanno:braun-odw.euHanno Braun joined the room.20:10:56
19 Oct 2021
@mrpenner:matrix.orgmrp joined the room.02:13:18

There are no newer messages yet.


Back to Room List