/**
* Updates the image shown in attributes panel.
*/
private void updateAttributesPreviewImage()
{
BufferedImage attributesPreviewImage = this.attributesPreviewComponent.getImage();
if (attributesPreviewImage == null || attributesPreviewImage == this.imageChoicePreviewComponent.getImage())
{
attributesPreviewImage = new BufferedImage(IMAGE_PREFERRED_SIZE, IMAGE_PREFERRED_SIZE,
BufferedImage.TYPE_INT_RGB);
this.attributesPreviewComponent.setImage(attributesPreviewImage);
}
// Fill image with a white background
Graphics2D g2D = (Graphics2D) attributesPreviewImage.getGraphics();
g2D.setPaint(Color.WHITE);
g2D.fillRect(0, 0, IMAGE_PREFERRED_SIZE, IMAGE_PREFERRED_SIZE);
BufferedImage textureImage = this.imageChoicePreviewComponent.getImage();
if (textureImage != null)
{
// Draw the texture image as if it will be shown on a 250 x 250 cm wall
g2D.setPaint(new TexturePaint(textureImage,
new Rectangle2D.Float(0, 0, this.controller.getWidth() / 250 * IMAGE_PREFERRED_SIZE,
this.controller.getHeight() / 250 * IMAGE_PREFERRED_SIZE)));
g2D.fillRect(0, 0, IMAGE_PREFERRED_SIZE, IMAGE_PREFERRED_SIZE);
}
g2D.dispose();
this.attributesPreviewComponent.repaint();
}
ImportedTextureWizardStepsPanel.java 文件源码
java
阅读 18
收藏 0
点赞 0
评论 0
项目:SweetHome3D
作者:
评论列表
文章目录