Displayer.SetPixel should use color.Color
Los mantenedores suelen responder en 3 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- go
- Área
- embedded-iot
Línea de trabajo
Start by locating the Displayer interface and its SetPixel implementations across the drivers repository. Review how each device converts or handles color values, then assess the impact of changing the interface to accept color.Color. Done means the interface and affected drivers consistently support the proposed color input; the issue does not name specific files or tests.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
I want to be able to do this:
display.FillRectangle(x, 5, 5, 5, color.White)
But beause Displayer.SetPixel takes color.RGBA, I must do this:
dispay.FillRectangle(x, 5, 5, 5, color.RGBAModel.Convert(color.White).(color.RGBA))
color.Color is meant to provide an interface for all colors:
type Color interface {
// RGBA returns the alpha-premultiplied red, green, blue and alpha values
// for the color. Each value ranges within [0, 0xffff], but is represented
// by a uint32 so that multiplying by a blend factor up to 0xffff will not
// overflow.
//
// An alpha-premultiplied color component c has been scaled by alpha (a),
// so has valid values 0 <= c <= a.
RGBA() (r, g, b, a uint32)
}
I know this is going to be painful, because so many things use it, but I propose Displayer be redefined as follows, so that it may use the color package as intended:
type Displayer interface {
// Size returns the current size of the display.
Size() (x, y int16)
// SetPixel modifies the internal buffer.
SetPixel(x, y int16, c color.Color)
// Display sends the buffer (if any) to the screen.
Display() error
}
It should then be up to each device implementing Displayer to decide how to handle the 16-bit color. Probably most of them will shift R, G, and B right by 8, and continue to ignore A.
Existing code (other than drivers) will not be impacted by this change, since color.RGBA already implements color.Color. If performance is a concern, type matching can be used to check whether c is a color.RGBA and avoid the bit shifts.
- Lenguaje dominante
- Go
- Estrellas
- 756
- Forks
- 251
- Merge medio
- 7 d 12 h
- PR fusionados (30 d)
- 8
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de tinygo-org/drivers
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
tinygo-org/drivers#946 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
tinygo-org/drivers#927 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 22/100
tinygo-org/drivers#901 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 32/100
tinygo-org/drivers#886 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
tinygo-org/drivers#877 ·
Los mantenedores suelen responder en 3 días
Todos los issues de tinygo-org/drivers
Issues similares
-
release
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
github/gh-aw-mcpg#17603 ·
Los mantenedores suelen responder en 1 día
-
avr: SPI Mode2 runs as mode 1Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
tinygo-org/tinygo#6727 ·
Los mantenedores suelen responder en 1 día
-
help wanted
Dificultad 1/5 Menos de una hora Aptitud para principiantes 94/100
oras-project/oras-go#1827 ·
Los mantenedores suelen responder en 1 día
-
docs: database/sql Sessions example never commits its batch, and its "Full Example" link is a 404Abiertodocumentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
ClickHouse/clickhouse-go#2185 ·
Los mantenedores suelen responder en 1 día
-
bug needs triage receiver/podman
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
open-telemetry/opentelemetry-collector-contrib#53700 · 1 comentario ·
Los mantenedores suelen responder en 1 día