Skip to content

Conversation

@FoamyGuy
Copy link
Contributor

@FoamyGuy FoamyGuy commented Jul 3, 2020

This implements the fill_row() function. Solves #12.

I tested by using the edited BitmapSaver library from PR #12 on that repo and this code:

import board
from adafruit_bitmapsaver import save_pixels
import displayio
import terminalio
from adafruit_display_text import label
import adafruit_ili9341

# Release any resources currently in use for the displays
displayio.release_displays()

spi = board.SPI()
tft_cs = board.CE0
tft_dc = board.D25

display_bus = displayio.FourWire(
    spi, command=tft_dc, chip_select=tft_cs, reset=board.D24
)
display = adafruit_ili9341.ILI9341(display_bus, width=320, height=240)

text = "Hello world"
text_area = label.Label(terminalio.FONT, text=text)
text_area.x = 10
text_area.y = 10
display.show(text_area)


print("Taking Screenshot...")
save_pixels("/home/pi/screenshot.bmp", display)
print("Screenshot taken")

while True:
    pass

Copy link
Collaborator

@makermelissa makermelissa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only change I see is making use of the color converter's functionality for this.

Comment on lines 59 to 64
def _rgb_tuple_to_rgb565(color_tuple):
return (
((color_tuple[0] & 0x00F8) << 8)
| ((color_tuple[1] & 0x00FC) << 3)
| (color_tuple[2] & 0x00F8) >> 3
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's already a function that does this in ColorConverter. Can you try making use of that? I'm not certain if you would need to make adjustments, but it should work with tuples and convert it in a similar manner.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat. I missed that, I really should poke around the existing code some more. Thank you. Will change it to use the existing function.

Copy link
Collaborator

@makermelissa makermelissa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this.

@makermelissa makermelissa merged commit fdc8aba into adafruit:master Jul 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants