Move image off screen [SOLVED] #5195
Replies: 1 comment
-
Posted at 2022-09-21 by @thyttan There are negative integers to, why not use those? 😋 Natural numbers are all positive though 😉 Sincerely Posted at 2022-09-21 by Sir_Indy Thank you Ganble, you're right it's not an issue with integers! You can probably tell I'm only a very amateur programmer! In that case, An example run in the emulator (same results on watch):
Draw a 100px square, colour it red, display in on the overlay. Negative number doesn't work, see third screenshot of blank screen. By contrast, Sorry, didn't do enough experimenting with the basic Attachments: Posted at 2022-09-21 by @thyttan Just regarding the locked thread you mention above - here's its more healthy twin: http://forum.espruino.com/conversations/379900/ Posted at 2022-09-21 by Sir_Indy Thank you Ganblejs!
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2022-09-21 by Sir_Indy
Hi All,
How can I position an image so the top-left point is off the screen, i.e. the x and y coordinate are negative? (Bangle.js2, possibly linked to this question which now seems locked?)
OR
How can I display only part of an image? Crop an image in memory and display it?
As part of my Overlay Notifications project, I'm making images and showing them on the overlay using
Bangle.setLCDOverlay(img, x, y);
. But x and y must be integers, so I can't scroll my image up by setting y as negative. Scrolling down works (by setting y to >0), the bottom of the image drops off the bottom of the screen.img.scroll
doesn't work, again x and y must be integers, setting them negative goes bananas and crashes the watch. I also tried 'blit', but that reads screen pixels (I think) so also doesn't work for me. This would also apply tog.drawImage(image, x, y)
andg.drawString(str, x, y)
, x and y must be integers.Thank you!
Beta Was this translation helpful? Give feedback.
All reactions