どのように思を受け継ぐシステムのエイリアスの設定で絵文字を画面上では画像のように振れているか。
-
19-09-2019 - |
質問
する活動を行う意欲を自のGUIアプリケーションのJava6、自動的に使う設定をサブピクセルの抗エイリアスの設定を全てのフォント.その結果、大幅な改善にも適切な利用により、トータルコスAAします。
しかし塗装をイメージがないのを初期化するグラフィックスコンテキストの利用システムのAAを設定します。うに遊んでもJavaの異なるAAヒントは失われた原因でサブピクセル方法まですべてのユーザー
必要があります。継承システムAA設定の指定されたグラフィックスコンテキスト代を迎え、明示的に設定のヒント?現在使用瞬AAを避けるための恐ろしい結果を標準AAを小さくしている。しかしない設定に何か文字をAAと定せずAAヒントです。
更新2010-01-05
私ピこ;の副AAヒントが表示されるだけ尊重を塗る場合に直接AWTグラフィックスコンテキスト;私のイベントにはダブルバッファの画像では標準AA;しかしバイパス、ダブルバッファに画像の副で、アメリカン航空予約センターです。
その他The_Fireの回答もJVMsるスイング可能なものがJ2ME JVMs);ご注意The_Fire答えないを使用し、AWTコンポーネントを新しいラベル()の代わりに新しいJLabel()が失敗)を推計したところ、のFontRenderContextできない抽出しまでにコンポーネントを実現し、表示されます。
私の現在のコードを取得し、グラフィックスコンテキスト自分のイメージに現在のようになります。
try {
if((dbImage=dctRoot.createImage(wid,hgt,1))!=null) { // if createImage returns null or throws an exception the component is not yet displayable
dbGraphics=(Graphics2D)dbImage.getGraphics();
if(dctRoot.properties.getBoolean("Antialias",true)) {
try {
// set AA on overall
dbGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING ,RenderingHints.VALUE_ANTIALIAS_ON);
// set text AA to platform/impl default
dbGraphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
// try to override platform/impl AA with font-specified AA (Java 6+)
try { dbGraphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.class.getField("VALUE_TEXT_ANTIALIAS_GASP").get(null)); } catch(Throwable thr) {;} // yes, ignore exception
}
catch(Throwable thr) {
dctRoot.log.println("Antialiasing not supported on this JVM ("+thr+").");
dctRoot.setProperty("Antialias","False"); // turn off AA for subsequent painting
}
}
}
}
catch(Throwable thr) {
dbImage=null;
dbGraphics=null;
}
このコードの画像を使用して元のAWTコンポーネントとなっており、これを背景について、全て私の絵のコンポーネントが含まれており、パネルからできることを必要なsetFocusCycleRootいにも、ほかのAWT.の作成画像コード:
public DctImage createImage(int wid, int hgt, float accpty) {
GraphicsConfiguration cfg=awtComponent.getGraphicsConfiguration();
Image img=null;
if(transparentImages) {
//y { img=new BufferedImage(wid,hgt,BufferedImage.TYPE_INT_ARGB); } // NB: J2ME CDC/PP 1.1 does not have the BufferedImage constructors (one day I may discover a way to create a BufferedImage via another API!!)
try { img=cfg.createCompatibleImage(wid,hgt,Transparency.TRANSLUCENT); }// NB: J2ME CDC/PP 1.1 does not have this API, but prefer to use GraphicsConfiguration over new BufferImage(...)
catch(NoClassDefFoundError thr) { transparentImages=false; createImage(wid,hgt,accpty); } // try again with transparency disabled
catch(NoSuchMethodError thr) { transparentImages=false; createImage(wid,hgt,accpty); } // try again with transparency disabled
catch(NoSuchFieldError thr) { transparentImages=false; createImage(wid,hgt,accpty); } // try again with transparency disabled
}
else {
img=cfg.createCompatibleImage(wid,hgt);
}
if(accpty>0 && SET_ACCELERATION_PRIORITY!=null) {
try { SET_ACCELERATION_PRIORITY.invoke(img,new Object[]{new Float(accpty)}); } catch(Throwable thr) {;}
}
return (img==null ? null : new DctImage(img));
}
解決
私が要因か。
まず、画像を作り出す必要があるから、配下のAWTコンポーネントで作成する必要があな透明性
cfg.createCompatibleImage(wid,hgt);
の代わりに
cfg.createCompatibleImage(wid,hgt,Transparency.TRANSLUCENT);
第二に、一部説明の理由は、次AA設定KEY_ANTIALIASING、必ずオフに使用液晶副AA.
最後に、最も重要なことは、デスクトップフォント描画ヒントを簡単に検索:
java.awt.Toolkit.getDesktopProperty("awt.font.desktophints")
更新2010-01-05
Retesting Java6.26と思われる問題が必要な一般セットAAオテキストを描画するAAに解決の道Oracle...後日ただ 数年 代遅).
他のヒント
を振っき、正しい知識を身につけましょうテキストアンチエイリアスのヒントこのように:
JLabel label = new JLabel();
FontMetrics fm = label.getFontMetrics( label.getFont() );
Object aaHintValue = fm.getFontRenderContext().getAntiAliasingHint();
自分のシステムを返します RenderingHits.VALUE_TEXT_ANTIALIAS_LCD_HRGB
.
java.awt.います。getDesktopProperty("awt.商標または登録商標です。desktophints")がnullの場合linuxの場合、少なくともない特別なvmコマンドラインオプションを推計したところ、そのときに、プラットフォームのデフォルトは..追加。g-Dawt.useSystemAAFontSettings=液晶"という治療ができる副レンダリングを設定した場合のヒントをごGraphics2Dインスタンス.
待ちにする前に走りこのコードをWindows JVM?と思ったClearTypeしたマイクロソフト技術によるスイングを継承を通じて一部のネイティブコード(ie、ご利用いただけませんLinux、又はその他のMicrosoftプラットフォーム).
私が書いたサーブレットを生成したJPGs反頼フォントは、Debianは、このコードを使用した
Font font = new Font("Komix", Font.PLAIN, 8);
Graphics2D g2;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
FontRenderContext frc = g2.getFontRenderContext();
g2.setFont(font);
g2.setPaint(Color.black);
g2.drawString(sMessage, xOffset, yOffset);
Offhandんリコールの場合は、このコードに依存してアプリケーション向けた輸入javax.スイング、サーブレットでは約300本、思い思いでしたか)は、クイックチェックインはGoogleのようになりますが正面からのAWTます。い役立っています。