com.github.bloodshura.x.assets.ext.XAssetsExtensions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shurax-assets-ext Show documentation
Show all versions of shurax-assets-ext Show documentation
Extensions for the ShuraX Assets library, including new image and sound codecs.
The newest version!
/*
* Copyright (c) 2013-2018, João Vitor Verona Biazibetti - All Rights Reserved
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*
* https://www.github.com/BloodShura
*/
package com.github.bloodshura.x.assets.ext;
import com.github.bloodshura.x.assets.AssetManager;
import com.github.bloodshura.x.assets.XAssets;
import com.github.bloodshura.x.assets.ext.image.IcoCodec;
import com.github.bloodshura.x.assets.ext.image.JimiAdditionalExtension;
import com.github.bloodshura.x.assets.ext.image.JimiCodec;
import com.github.bloodshura.x.assets.ext.sound.OggCodec;
import com.github.bloodshura.x.assets.image.ImageFormat;
import com.github.bloodshura.x.assets.sound.SoundFormat;
import com.github.bloodshura.x.assets.sound.codec.DefaultSoundCodec;
import com.sun.jimi.core.JimiControl;
import javax.annotation.Nonnull;
public class XAssetsExtensions {
public static void installImage() {
installImage(XAssets.getManager());
}
public static void installImage(@Nonnull AssetManager manager) {
JimiControl.addExtension(new JimiAdditionalExtension());
manager.setCodec(ImageFormat.APF, JimiCodec.class);
manager.setCodec(ImageFormat.BMP, JimiCodec.class);
manager.setCodec(ImageFormat.CUR, JimiCodec.class);
//manager.setCodec(ImageFormat.GIF, JimiCodec.class); GIF does not have encoding, so let's just use the default codec
manager.setCodec(ImageFormat.ICO, IcoCodec.class);
manager.setCodec(ImageFormat.JPG, JimiCodec.class);
manager.setCodec(ImageFormat.PCT, JimiCodec.class);
manager.setCodec(ImageFormat.PCX, JimiCodec.class);
manager.setCodec(ImageFormat.PNG, JimiCodec.class);
manager.setCodec(ImageFormat.PSD, JimiCodec.class);
manager.setCodec(ImageFormat.RAS, JimiCodec.class);
manager.setCodec(ImageFormat.TGA, JimiCodec.class);
manager.setCodec(ImageFormat.TIFF, JimiCodec.class);
manager.setCodec(ImageFormat.XBM, JimiCodec.class);
manager.setCodec(ImageFormat.XPM, JimiCodec.class);
}
public static void installSound() {
installSound(XAssets.getManager());
}
public static void installSound(@Nonnull AssetManager manager) {
manager.setCodec(SoundFormat.MP3, DefaultSoundCodec.class); // The codec is loaded via Tritonus into Java Sound SPI
manager.setCodec(SoundFormat.OGG, OggCodec.class);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy