Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Enable Glyphs to have an outline

Abierto
#297 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
go

Línea de trabajo

Empieza en vg/draw/canvas.go leyendo GlyphStyle y las implementaciones de DrawGlyph de los glifos; después, revisa el pull request 298 para conocer el enfoque propuesto existente. Se considera terminado cuando los glifos se puedan renderizar con un contorno opcional, manteniendo el comportamiento existente cuando no se configure ningún contorno.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

screen shot 2016-07-15 at 4 42 05 pm

Just in case anyone is wanting to ask why we would do this, 1. other libraries do it, and 2. In my case I need to make my application create a graph that looks like the current ones (with an outline). Consider for example the javascript library, chart.js

A patch for this could be done without altering the API. Here is my current solution:

--- a/vg/draw/canvas.go
+++ b/vg/draw/canvas.go
@@ -55,6 +55,12 @@ type GlyphStyle struct {
        // Radius specifies the size of the glyph's radius.
        Radius vg.Length

+       // Width of the line around the glyph. If set, LineColour is used to outline the glyph
+       Width vg.Length
+
+       // Outline glyph with this color if Width is set.
+       LineColor color.Color
+
        // Shape draws the shape of the glyph.
        Shape GlyphDrawer
 }
@@ -106,6 +112,11 @@ func (CircleGlyph) DrawGlyph(c *Canvas, sty GlyphStyle, pt vg.Point) {
        p.Arc(pt, sty.Radius, 0, 2*math.Pi)
        p.Close()
        c.Fill(p)
+
+       if sty.Width > 0 {
+               c.SetLineStyle(LineStyle{Color: sty.LineColor, Width: sty.Width})
+               c.Stroke(p)
+       }
 }

 // RingGlyph is a glyph that draws the outline of a circle.

This simply add's two fields, if you want to set an outline, you can set the new Width field, and the new LineColor field.

Patch: https://github.com/gonum/plot/pull/298

Lenguaje dominante
Go
Estrellas
3k
Forks
202
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de gonum/plot

Todos los issues de gonum/plot

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.