Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A library to read .ico files in Java. Chingón.

License

NotificationsYou must be signed in to change notification settings

miko3k/mejico

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A library to read.ico/.cur files in Java. Chingón.

Overview

Themejico a small library to read Microsoft.ico or.cur format in java.

  • a commercial-friendly license
  • no dependencies on third-party libraries
  • comprehensively unit tested
  • fully compatible with .ico format

All versions should be supported. Hopefully. Please file a bug and help to improve this libraryif you find an.ico or.cur file in the wild, which can be read by any version of Windowsand this library fails to do so.

Artifcats

I decided to stop publishing to Maven Central, coz it is annoying.

Simply snatch this from it fromjitpack. Do not forget toselect correct subproject in the dropdown menu!

Should this project find heavy use, I might consider publishing to Maven Central again.

Structure

This project is split into multiple subprojects. Your application should depend on one of the first two.

  • mejico-awt - decoder which returnsjava.awt.image.BufferedImage
  • mejico-andorid - decoder which returnsandroid.graphics.Bitmap
  • mejico-core - core decoding routines, mostly coming fromimage4j
  • mejico-test - utility classes for unit testing, not intended for public use

Loading of PNG data is delegated to native facilities. This is the main reason why we haveseparate Android and AWT artifacts. You might want to depend onmejico-core only, if you wantto supply your own PNG (or even BMP) decoder.

Usage

There are two classes with static factory methods to obtain anIconParser, depending on the platform:

CheckIconParserto see the high level API. It can return aList of images contained in.ico file.

Lower level API is in theIconReaderclass and allows to retrieve image metadata first (including the hotspot position for.cur files) and decodeselected images afterwards.

Examples

// AWT exampleimportjava.awt.image.BufferedImage;importjava.io.IOException;importjava.io.InputStream;importjava.util.List;importorg.deletethis.mejico.awt.AwtMejico;classMain {publicstaticvoidmain(String[]args)throwsIOException {InputStreamstream =Main.class.getResourceAsStream("bundled_icon.ico");List<BufferedImage>images =AwtMejico.getIconParser().getIcons(Main.class.getResourceAsStream("bundled_icon.ico"));// do something with images    }    }
// Android exampleimportjava.io.IOException;importjava.io.InputStream;importjava.util.List;importandroid.graphics.Bitmap;importandroid.app.Activity;importandroid.os.Bundle;importorg.deletethis.mejico.android.AndroidMejico;classMyActivityextendsActivity {@OverridepublicvoidonCreate(BundlesavedInstanceState) {super.onCreate(savedInstanceState);try {InputStreamstream =getResources().openRawResource(R.raw.resource_id);List<Bitmap>images =AndroidMejico.getIconParser().getIcons(stream);// do something with images                    }catch(IOExceptionex) {thrownewIllegalStateException("Cannot open resource");        }    }}

License

Themejico library is licensed under the GNU LGPL v2.1 so you are free to use it inyour Free Software and Open Source projects, as well as commercial projects,under the terms of the LGPL v2.1.

History

This is a fork ofimage4j. I changed the codebeyond recognition, added a battery of unit tests, ditched many parts includingencoding and general purpose BMP decoder.

Future

I plan to maintain this library. More or less.

If you encounter bugs, please do not hesitate to report them.

Credits

Disclaimer

To my or original author knowledge, there are no patents on either the BMP or ICO formats.

Packages

No packages published

Languages

  • Java100.0%

[8]ページ先頭

©2009-2025 Movatter.jp