danfickle / danfickle/java-bootstrap-laf

Enable antialias when drawing rounded shapes

オープン
#1 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
44
フォーク
6
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず JBootstrapButtonUI クラスを見つけ、その paint(Graphics, JComponent) メソッドと周辺の描画コードを読みます。そこでどのような角の丸い形状または正方形でない形状が描画されているかを確認します。それらの形状が antialiasing によって滑らかにレンダリングされ、以前の Graphics2D の設定が後で復元されれば、作業は完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
design, desktop
issue の種類
機能追加
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。