Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualShippou

Posted 28 February 2014 - 05:19 PM

I have run into an interesting side effect in my code. It seems like turning on RenderingHints for my Graphics g1 object also is affecting my Graphics g object.

 

 As it is written, the Graphics g object should not be anti-aliased, only g1 object .... am I not "getting" something here ?

.

public void paint(Graphics g){
     Graphics2D g1 = (Graphics2D) g;
     RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
     g1.setRenderingHints(rh);
     g.setColor(Color.BLACK);
     g.fillRect(0, 0, WIDTH + 20, HEIGHT + 20);
     manager.draw(g);
     stage.draw(g);
     player.draw(g);
     g.setFont(font);
     g.drawString("\u263a \u263b",20,20);
     g.dispose();
     repaint();
	}

#4Shippou

Posted 28 February 2014 - 05:18 PM

I have run into an interesting side effect in my code. It seems like turning on RenderingHints for my Graphics g1 object also is affecting my Graphics g object.

 

 As it is written, the Graphics  "g" object should not be anti-aliased, only g1 object .... am I not "getting" something here ?

.

public void paint(Graphics g){
     Graphics2D g1 = (Graphics2D) g;
     RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
     g1.setRenderingHints(rh);
     g.setColor(Color.BLACK);
     g.fillRect(0, 0, WIDTH + 20, HEIGHT + 20);
     manager.draw(g);
     stage.draw(g);
     player.draw(g);
     g.setFont(font);
     g.drawString("\u263a \u263b",20,20);
     g.dispose();
     repaint();
	}

#3Shippou

Posted 28 February 2014 - 05:17 PM

I have run into an interesting side effect in my code. It seems like turning on RenderingHints for my Graphics g1 object also is affecting my Graphics g object.

 

 As it is written, the Graphics  "g" object should not be anti-aliased, only g1 object .... am I not "getting" something here ?

.

public void paint(Graphics g){
		Graphics2D g1 = (Graphics2D) g;
		RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g1.setRenderingHints(rh);
		g.setColor(Color.BLACK);
		g.fillRect(0, 0, WIDTH + 20, HEIGHT + 20);
		manager.draw(g);
		stage.draw(g);
        player.draw(g);
		g.setFont(font);
		g.drawString("\u263a \u263b",20,20);
        g.dispose();
		repaint();
	}

#2Shippou

Posted 28 February 2014 - 05:16 PM

I have run into an interesting side effect in my code. It seems like turning on RenderingHints for my Graphics g1 object also is affecting my Graphics g object.

 

 As it is written, the Graphics  "g" object should not be anti-aliased, only g1 object .... am I not "getting" something here ?

public void paint(Graphics g){
		Graphics2D g1 = (Graphics2D) g;
		RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g1.setRenderingHints(rh);
		g.setColor(Color.BLACK);
		g.fillRect(0, 0, WIDTH + 20, HEIGHT + 20);
		manager.draw(g);
		stage.draw(g);
        player.draw(g);
		g.setFont(font);
		g.drawString("\u263a \u263b",20,20);
        g.dispose();
		repaint();
	}

#1Shippou

Posted 28 February 2014 - 05:16 PM

I have run into an interesting side effect in my code. It seems like turning on RenderingHints for my Graphics g1 object also is affecting my Graphics g object.

 

 As it is written, the Graphics  "g" object should not be anti-aliased, only g1 object .... am I not "getting" something here ?

public void paint(Graphics g){
		Graphics2D g1 = (Graphics2D) g;
		RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g1.setRenderingHints(rh);
		g.setColor(Color.BLACK);
		g.fillRect(0, 0, WIDTH + 20, HEIGHT + 20);
		manager.draw(g);
		stage.draw(g);
        player.draw(g);
		g.setFont(font);
		g.drawString("\u263a \u263b",20,20);
        g.dispose();
		repaint();
	}

PARTNERS