protected static int getFlagsFromAllowedIfds( int[] allowedIfds ) { if( allowedIfds == null || allowedIfds.length == 0 ) { return 0; } int flags = 0; int[] ifds = IfdData.getIfds(); for( int i = 0; i < IfdId.TYPE_IFD_COUNT; i++ ) { for( int j : allowedIfds ) { if( ifds[i] == j ) { flags |= 1 << i; break; } } } return flags; }
protected static int getFlagsFromAllowedIfds( int[] allowedIfds ) { if( allowedIfds == null || allowedIfds.length == 0 ) { return 0; } int flags = 0; int[] ifds = IfdData.getIfds(); for( int i = 0; i < IfdId.TYPE_IFD_COUNT; i++ ) { for( int j : allowedIfds ) { if( ifds[i] == j ) { flags |= 1 << i; break; } } } return flags; }
protected static boolean isIfdAllowed( int info, int ifd ) { int[] ifds = IfdData.getIfds(); int ifdFlags = getAllowedIfdFlagsFromInfo( info ); for( int i = 0; i < ifds.length; i++ ) { if( ifd == ifds[i] && ( ( ifdFlags >> i ) & 1 ) == 1 ) { return true; } } return false; }
protected static boolean isIfdAllowed( int info, int ifd ) { int[] ifds = IfdData.getIfds(); int ifdFlags = getAllowedIfdFlagsFromInfo( info ); for( int i = 0; i < ifds.length; i++ ) { if( ifd == ifds[i] && ( ( ifdFlags >> i ) & 1 ) == 1 ) { return true; } } return false; }
protected static int[] getAllowedIfdsFromInfo( int info ) { int ifdFlags = getAllowedIfdFlagsFromInfo( info ); int[] ifds = IfdData.getIfds(); ArrayList<Integer> l = new ArrayList<Integer>(); for( int i = 0; i < IfdId.TYPE_IFD_COUNT; i++ ) { int flag = ( ifdFlags >> i ) & 1; if( flag == 1 ) { l.add( ifds[i] ); } } if( l.size() <= 0 ) { return null; } int[] ret = new int[l.size()]; int j = 0; for( int i : l ) { ret[j++] = i; } return ret; }
protected static int[] getAllowedIfdsFromInfo( int info ) { int ifdFlags = getAllowedIfdFlagsFromInfo( info ); int[] ifds = IfdData.getIfds(); ArrayList<Integer> l = new ArrayList<Integer>(); for( int i = 0; i < IfdId.TYPE_IFD_COUNT; i++ ) { int flag = ( ifdFlags >> i ) & 1; if( flag == 1 ) { l.add( ifds[i] ); } } if( l.size() <= 0 ) { return null; } int[] ret = new int[l.size()]; int j = 0; for( int i : l ) { ret[j++] = i; } return ret; }
protected int[] getTagDefinitionsForTagId( short tagId ) { int[] ifds = IfdData.getIfds(); int[] defs = new int[ifds.length]; int counter = 0; SparseIntArray infos = getTagInfo(); for( int i : ifds ) { int def = defineTag( i, tagId ); if( infos.get( def ) != DEFINITION_NULL ) { defs[counter++] = def; } } if( counter == 0 ) { return null; } return Arrays.copyOfRange( defs, 0, counter ); }
protected int[] getTagDefinitionsForTagId( short tagId ) { int[] ifds = IfdData.getIfds(); int[] defs = new int[ifds.length]; int counter = 0; SparseIntArray infos = getTagInfo(); for( int i : ifds ) { int def = defineTag( i, tagId ); if( infos.get( def ) != DEFINITION_NULL ) { defs[counter++] = def; } } if( counter == 0 ) { return null; } return Arrays.copyOfRange( defs, 0, counter ); }