Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+17 votes

I'm trying to get the image in imageView to always be located at the point 0,0 in imageView.

Here's the code in our method InitializeAfterSceneCreated that pertains to the sizing

	//videoView.fitWidthProperty().addListener((obs, oldV, newV) -> repaintCanvas());
	//videoView.fitHeightProperty().addListener((obs, oldV, newV) -> repaintCanvas());
asked in CSC285_Fall2018 by (317 points)

1 Answer

+5 votes
Best answer

Honestly, I think it may be simplest to replace your ImageView (videoView) with another Canvas, get the GraphicsContext from that Canvas, and manually call gc.drawImage(myImage,0,0,width,height) to draw the image whenever you need it drawn.

That way the image you display will always be starting at 0,0.

You lose the auto-scaling functionality that ImageView has by using a Canvas to display the image, but in the end auto-scaling wasn't very useful for us anyway, since we need to know how much scaling is taking place anyway!

(I helped another group with this, and it took surprisingly little time to replace the ImageView with a canvas...)

answered by (3.4k points)
selected by