Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

priya shri

Greenhorn
+ Follow
since Oct 07, 2018
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by priya shri

Actually i am getting a decimal value by which i am getting a wrong cropping. for example my image width is 10006 and  this image fit into a panel  that width is 1000 , MXL=10,MYT=10,MXR=30,MYB=30,
then cropx=(10-0/1000-0) * 10006 =100.06
1 year ago
I am making a project in swing. In which i want to crop image using mouse onto a panel . My image size is very large so when i fit  image  onto a panel and cropping it then i am getting blur image.
And when i use resize image coordinate and cropping from original image then i am getting wrong cropping image . so i want to fixed image onto a panel and crop image should be perfect.
How can i do this? i am using this code :

           int x = Math.min(p1.x, p2.x);
           int y = Math.min(p1.y, p2.y);
           int w = Math.abs(p1.x - p2.x);
           int h = Math.abs(p1.y - p2.y);
           double xScale=image.getWidth()/mf.jPanel2.getWidth();
           double yScale=image.getHeight()/mf.jPanel2.getHeight();
           int x1 = (int) Math.round(x * xScale);
           int y1 = (int) Math.round (y * yScale);
           int w1=     (int) Math.round(w * xScale);
           int h1=     (int) Math.round(h * yScale);
           BufferedImage dest = image.getSubimage(x1,y1,w1,h1);
1 year ago