async buffered image: rename changed to loaded

This commit is contained in:
Adam
2019-10-11 21:30:36 -04:00
parent bdd9feb3ea
commit 2488d4f7fa
5 changed files with 9 additions and 8 deletions

View File

@@ -44,9 +44,9 @@ public class AsyncBufferedImage extends BufferedImage
}
/**
* Call when the buffer has been changed
* Call when the image has been loaded
*/
public synchronized void changed()
public synchronized void loaded()
{
loaded = true;
for (Runnable r : listeners)
@@ -57,9 +57,10 @@ public class AsyncBufferedImage extends BufferedImage
}
/**
* Register a function to be ran when the buffer has changed
* Register a function to be ran when the image has been loaded.
* If the image is already loaded, the function will not be ran.
*/
public synchronized void onChanged(Runnable r)
public synchronized void onLoaded(Runnable r)
{
if (loaded)
{

View File

@@ -415,7 +415,7 @@ public class ItemManager
return false;
}
sprite.toBufferedImage(img);
img.changed();
img.loaded();
return true;
});
return img;

View File

@@ -317,7 +317,7 @@ class LootTrackerBox extends JPanel
BufferedImage transparentImage = ImageUtil.alphaOffset(itemImage, .3f);
imageLabel.setIcon(new ImageIcon(transparentImage));
};
itemImage.onChanged(addTransparency);
itemImage.onLoaded(addTransparency);
addTransparency.run();
}
else

View File

@@ -116,7 +116,7 @@ class TimeTrackingPanel extends PluginPanel
BufferedImage subIcon = icon.getSubimage(0, 0, 32, 32);
materialTab.setIcon(new ImageIcon(subIcon.getScaledInstance(24, 24, Image.SCALE_SMOOTH)));
};
icon.onChanged(resize);
icon.onLoaded(resize);
resize.run();
materialTab.setOnSelectEvent(() ->

View File

@@ -78,7 +78,7 @@ public class InfoBoxManager
if (image instanceof AsyncBufferedImage)
{
AsyncBufferedImage abi = (AsyncBufferedImage) image;
abi.onChanged(() -> updateInfoBoxImage(infoBox));
abi.onLoaded(() -> updateInfoBoxImage(infoBox));
}
}