danfickle / danfickle/java-bootstrap-laf
Enable antialias when drawing rounded shapes
- Lenguaje dominante
- Java
- Estrellas
- 44
- Forks
- 6
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
I recommend you to enable antialias when drawing non-square shapes to make them smooth and pretty. For example in your `JBootstrapButtonUI` class:
``` java
@Override
public void paint ( Graphics g, JComponent c )
{
// Enabling antialias
final Graphics2D g2d = ( Graphics2D ) g;
final RenderingHints.Key key = RenderingHints.KEY_ANTIALIASING;
final Object oldAAhint = g2d.getRenderingHint ( key );
g2d.setRenderingHint ( key, RenderingHints.VALUE_ANTIALIAS_ON );
// ... painting code ...
// Restoring previous antialias settings
g2d.setRenderingHint ( key, oldAAhint );
}
```
And don't worry, `Graphics` can be casted to `Graphics2D` without any issues as it is always passed into paint methods, unless you switch graphics debug on (I doubt you will, because it is a really outdated feature).
You can also look into features provided by `Graphics2D` class - there are lots of them.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Empieza por localizar la clase JBootstrapButtonUI y leer su método paint(Graphics, JComponent) y el código de pintado circundante. Comprueba qué formas redondeadas o no cuadradas se dibujan allí; el trabajo está terminado cuando esas formas se rendericen suavemente con antialiasing y la configuración anterior de Graphics2D se restaure después.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java
- Área
- design, desktop
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 30/100