Skip to content

metal animation goes very glitchy #4914

@ddyer0

Description

@ddyer0

This is a different problem than the other "glitchy metal" report. Here a temporary bitmap is being
created and drawn to create an animated rotation. On non-metal platforms this works very smoothly.

Untitled.design.mp4

the top level of the animation does this
Image r2 = rotationImage.rotate(rotateDirectionMath.PI/2animAmount,0x0);
int xp = rotation_center_x-rwidth/2;
int yp = rotation_center_y-rwidth/2;
r2.makeTransparent(0.25).drawImage(gc,xp,yp);

Basically the image is constructed from raw integers and then immediately drawn.
This occurs in the EDT process.

public Image rotate( double angle, int fillColor)
{
int w = getWidth();
int h = getHeight();
int opix[] = new int[wh];
int ipix[] = new int[w
h];
getRGB(0,0,w,h,ipix,0,w);
G.Rotate(ipix,opix,w,h,angle,fillColor);
SystemImage.pixelCount += w*h;
Image fin = new Image("temp for rotate");
fin.createImageFromInts(opix,w,h,0,w);

 return(fin);

}
public Image makeTransparent(double percent)
{
int w = getWidth();
int h = getHeight();
int ipix[] = new int[w*h];
getRGB(0,0,w,h,ipix,0,w);

   for(int lim = ipix.length-1; lim>=0; lim--)
   {
	   int pix = ipix[lim];
	   int trans = 0xff&(pix>>24);
       trans = (int)(trans*percent);
	   ipix[lim]=(trans<<24)|(0xffffff&pix);
   }
   Image fin = new Image("temp for transparent image");
   fin.createImageFromInts(ipix,w,h, 0, w);
   return(fin);

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions