New Image loading

Joel,

Could you give a super-brief rundown on the correct way to load an Image using your new SourceOp stuff?

Thanks,
Brent.

Thus spake “Brent Easton”:

If you’re loading an image from the archive, do this:

SourceOp op = Op.load(“someimage.png”);

In order to get the image synchronously, do this:

Image img = op.getImage(null);

In order to get the image asynchronously, you need to supply
an ImageOpObserver (like Repainter):

Image img = op.getImage(new Repainter(component, rectangle));

or

Future fut = op.getFutureImage(new Repainter(component, rectangle));

depending on whether you need the Future for some reason (Board needs the
Futures, most other things don’t right now).

If you want a paricular tile and not the whole image, there are getTile() and
getFutureTile() methods, also.

I see now that none of my Javadoc made it into the current versions of many
of the imageop classes. I’ll have to fix that this evening.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)