This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-05-19 09:55:33

Canthiar
Scratcher
Registered: 2007-05-16
Posts: 100+

Rendering in the Java App

I have a program that renders slightly differently in the Java application from Scratch itself.  In the Java application when I stamp one of my sprites it leaves behind a gray outline.  Did I do something wrong with my images or is there a difference in the way that they are rendered.

The program is here:

http://scratch.mit.edu/projects/Canthiar/4459

Edit: I was a bit overzealous and removed the project listed in this post from the site.

Last edited by Canthiar (2007-05-21 00:46:12)

Offline

 

#2 2007-05-19 14:13:18

Canthiar
Scratcher
Registered: 2007-05-16
Posts: 100+

Re: Rendering in the Java App

This one seems to have the same problem:
http://scratch.mit.edu/projects/Canthiar/4834

Should I just not use stamps to try to erase from the background?

Offline

 

#3 2007-05-21 00:44:07

Canthiar
Scratcher
Registered: 2007-05-16
Posts: 100+

Re: Rendering in the Java App

A little digging leads me to believe that it is because the Java app is using bi-linear filtering while the download version uses nearest neighbor.  The transparent parts of images are represented as a solid black and this black is getting blended with the light color in the image next to the transparent section.

I'm no Java expert, but it looks like it is getting set to blend using a bi-linear filter in Sprite.rotateAndScale( ) when it is allocating a AffineTransformOp object to create a new instance of Sprite.rotatedCostume.  It really depends on how Sprite.rotationstyle gets set.

If it's not going to be changed for the Java app then I'm sure I can work around it so that it renders the same for both version of Scratch.

Offline

 

#4 2007-05-21 08:03:47

johnm
Scratcher
Registered: 2007-03-08
Posts: 100+

Re: Rendering in the Java App

Hi, Canthiar.

Thanks for digging into this (including the Java code!) Your analysis is exactly right--the Java code is using bi-linear interpolation and Scratch uses nearest-neighbor. I will try changing the Java player and, if it's not too ugly and doesn't break, I'll put out a new version soon.

  -- John

Offline

 

#5 2007-05-21 09:05:54

Canthiar
Scratcher
Registered: 2007-05-16
Posts: 100+

Re: Rendering in the Java App

Hey John,

Thanks for looking at it, I apologize for decompiling the code.  If it doesn't look good to change the filter then that's your call, I can always work around it.

Offline

 

#6 2011-08-22 14:16:40

TheScratch2000
Scratcher
Registered: 2011-08-14
Posts: 2

Re: Rendering in the Java App

<key[  ]pressed?>

Offline

 

Board footer