添加一张图片

@param imagePath 图片路径
@param pictureType 图片类型
@param width 宽度
@param height 长度
@param alignment 对齐方式

@throws IOException 异常
@throws InvalidFormatException 异常
424419
public static void appendImage(String imagePath, int pictureType, int width, int height, ParagraphAlignment
            alignment) throws IOException, InvalidFormatException {
        appendImage(getNewRun(alignment), imagePath, pictureType, width, height);
    }
926866
@Override
    public <V extends FileAttributeView> V getFileAttributeView(final Path path, final Class<V> type,
        final LinkOption... options) {
        if (path == null) {
            throw new IllegalArgumentException("path must be specified");
        }
        if (type == null) {
            throw new IllegalArgumentException("type must be specified");
        }
        if (!type.isAssignableFrom(ShrinkWrapFileAttributeView.class)) {
            // Nope, we don't support this view
            return null;
        }
        if (!(path instanceof ShrinkWrapPath)) {
            throw new IllegalArgumentException("Only " + ShrinkWrapPath.class.getSimpleName() + " is supported");
        }
        return type.cast(new ShrinkWrapFileAttributeView(new ShrinkWrapFileAttributes((ShrinkWrapPath) path,
                getArchive(path))));
    }
1096897
public static void generate(String content, int width, int height, String imageType, OutputStream out) {
		final BufferedImage image = generate(content, width, height);
		ImgUtil.write(image, imageType, out);
	}
949654
public static Bitmap getBitmapBySize(String path, int width, int height) {
        BitmapFactory.Options option = new BitmapFactory.Options();
        option.inJustDecodeBounds = true;
        BitmapFactory.decodeFile(path, option);
        option.inSampleSize = computeSampleSize(option, -1, width * height);

        option.inJustDecodeBounds = false;
        Bitmap bitmap = null;
        try {
            bitmap = BitmapFactory.decodeFile(path, option);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return bitmap;
    }
180139
public void setColorizeFile (File path)
    {
        try {
            if (path.getName().endsWith("xml")) {
                ColorPositoryParser parser = new ColorPositoryParser();
                _colRepo = (ColorPository)(parser.parseConfig(path));
            } else {
                _colRepo = ColorPository.loadColorPository(new FileInputStream(path));
            }

            _classList.removeAllItems();
            _classList1.removeAllItems();
            _classList1.addActionListener(new ActionListener() {
                public void actionPerformed (ActionEvent event) {
                    setupColors(_colorList1, (String)_classList1.getSelectedItem());
                }
            });
            _classList2.removeAllItems();
            _classList2.addActionListener(new ActionListener() {
                public void actionPerformed (ActionEvent event) {
                    setupColors(_colorList2, (String)_classList2.getSelectedItem());
                }
            });
            _classList3.removeAllItems();
            _classList3.addActionListener(new ActionListener() {
                public void actionPerformed (ActionEvent event) {
                    setupColors(_colorList3, (String)_classList3.getSelectedItem());
                }
            });
            _classList4.removeAllItems();
            _classList4.addActionListener(new ActionListener() {
                public void actionPerformed (ActionEvent event) {
                    setupColors(_colorList4, (String)_classList4.getSelectedItem());
                }
            });
            Iterator<ColorPository.ClassRecord> iter = _colRepo.enumerateClasses();
            ArrayList<String> names = Lists.newArrayList();
            while (iter.hasNext()) {
                String str = iter.next().name;
                names.add(str);
            }

            _classList1.addItem(NONE);
            _classList2.addItem(NONE);
            _classList3.addItem(NONE);
            _classList4.addItem(NONE);

            Collections.sort(names);
            for (String name : names) {
                _classList.addItem(name);
                _classList1.addItem(name);
                _classList2.addItem(name);
                _classList3.addItem(name);
                _classList4.addItem(name);
            }

            _classList.setSelectedIndex(0);
            _classList1.setSelectedIndex(0);
            _classList2.setSelectedIndex(0);
            _classList3.setSelectedIndex(0);
            _classList4.setSelectedIndex(0);
            _colFilePath.setText(path.getPath());

            CONFIG.setValue(LAST_COLORIZATION_KEY, path.getAbsolutePath());
        }  catch (Exception ex) {
            _status.setText("Error opening colorization file: " + ex);
        }
    }
1069072
private void init(String xmlPath) throws MalformedURLException, IOException{
		
		XML xml = new XML(true, xmlPath);
		if(!xml.isInheritedMapped(configuredClass))
			Error.classNotMapped(configuredClass);
		
		for (Class<?> classe :getClasses(xml)){
			relationalManyToOneMapper.put(classe.getName(), new JMapper(configuredClass, classe,ChooseConfig.DESTINATION, xmlPath));
			relationalOneToManyMapper.put(classe.getName(), new JMapper(classe, configuredClass,ChooseConfig.SOURCE, xmlPath));
		}
	}
318667
public static Typeface load(final AssetManager assetManager, final String filePath) {
        synchronized (sCachedFonts) {
            try {
                if (!sCachedFonts.containsKey(filePath)) {
                    final Typeface typeface = Typeface.createFromAsset(assetManager, filePath);
                    sCachedFonts.put(filePath, typeface);
                    return typeface;
                }
            } catch (Exception e) {
                Log.w("Calligraphy", "Can't create asset from " + filePath + ". Make sure you have passed in the correct path and file name.", e);
                sCachedFonts.put(filePath, null);
                return null;
            }
            return sCachedFonts.get(filePath);
        }
    }
786079
public static <T extends ImageInterleaved<T>> ImageBorder<T> interleavedValue(Class<T> imageType, double value) {
		if( imageType == InterleavedF32.class ) {
			return (ImageBorder<T>) new ImageBorderValue.Value_IL_F32((float) value);
		} else if( imageType == InterleavedF64.class ) {
				return (ImageBorder<T>)new ImageBorderValue.Value_IL_F64(value);
		} else if( InterleavedInteger.class.isAssignableFrom(imageType) ) {
			return (ImageBorder<T>)new ImageBorderValue.Value_IL_S32((int)value);
		} else if( imageType == InterleavedS64.class ) {
			return (ImageBorder<T>)new ImageBorderValue.Value_IL_S64((long)value);
		} else {
			throw new IllegalArgumentException("Unknown image type: "+imageType.getSimpleName());
		}
	}
849351
public static<T extends ImageGray<T>, D extends ImageGray<D>>
	void detectLineSegments( BufferedImage image ,
							 Class<T> imageType ,
							 Class<D> derivType )
	{
		// convert the line into a single band image
		T input = ConvertBufferedImage.convertFromSingle(image, null, imageType );

		// Comment/uncomment to try a different type of line detector
		DetectLineSegmentsGridRansac<T,D> detector = FactoryDetectLineAlgs.lineRansac(40, 30, 2.36, true, imageType, derivType);

		List<LineSegment2D_F32> found = detector.detect(input);

		// display the results
		ImageLinePanel gui = new ImageLinePanel();
		gui.setImage(image);
		gui.setLineSegments(found);
		gui.setPreferredSize(new Dimension(image.getWidth(),image.getHeight()));

		listPanel.addItem(gui, "Found Line Segments");
	}
526416
static void put(final TypePath typePath, final ByteVector output) {
    if (typePath == null) {
      output.putByte(0);
    } else {
      int length = typePath.typePathContainer[typePath.typePathOffset] * 2 + 1;
      output.putByteArray(typePath.typePathContainer, typePath.typePathOffset, length);
    }
  }
957170
public void setTo( ImageType o ) {
		this.family = o.family;
		this.dataType = o.dataType;
		this.numBands = o.numBands;
	}
883565
@SuppressWarnings("static-method")
	protected ImageDescriptor getImageDescriptor(String imagePath) {
		final LangActivator activator = LangActivator.getInstance();
		final ImageRegistry registry = activator.getImageRegistry();
		ImageDescriptor descriptor = registry.getDescriptor(imagePath);
		if (descriptor == null) {
			descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(activator.getBundle().getSymbolicName(), imagePath);
			if (descriptor != null) {
				registry.put(imagePath, descriptor);
			}
		}
		return descriptor;
	}
1051529
static boolean deleteImageFile(String imagePath) {
        // Get the file
        File imageFile = new File(imagePath);

        boolean deleted = false;
        // Delete the image
        if (imageFile.exists()) {
            deleted = imageFile.delete();
        }

        return deleted;
    }
1282248
@Nullable
  public <V extends FileAttributeView> V getFileAttributeView(
      final JimfsPath path, Class<V> type, final Set<? super LinkOption> options) {
    return store.getFileAttributeView(
        new FileLookup() {
          @Override
          public File lookup() throws IOException {
            return lookUpWithLock(path, options).requireExists(path).file();
          }
        },
        type);
  }
82011
public void addClassPath(String classpath)
  {
    char sep = CauchoUtil.getPathSeparatorChar();
    int head = 0;
    int tail = 0;
    while (head < classpath.length()) {
      tail = classpath.indexOf(sep, head);

      String segment = null;
      if (tail < 0) {
        segment = classpath.substring(head);
        head = classpath.length();
      }
      else {
        segment = classpath.substring(head, tail);
        head = tail + 1;
      }

      if (segment.equals(""))
        continue;
      else if (segment.endsWith(".jar") || segment.endsWith(".zip"))
        addMergePath(JarPath.create(VfsOld.lookup(segment)));
      else
        addMergePath(VfsOld.lookup(segment));
    }
  }
1146996
public BufferedImage buildBufferedImageOfIconInOS(Path path) {
		path = JMOptional
				.getNullableAndFilteredOptional(path, JMPath.NotExistFilter)
				.flatMap(JMPathOperation::createTempFilePathAsOpt).orElse(path);
		Icon iconInOS = os.getIcon(path.toFile());
		BufferedImage bufferedImage = new BufferedImage(iconInOS.getIconWidth(),
				iconInOS.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
		iconInOS.paintIcon(null, bufferedImage.getGraphics(), 0, 0);
		return bufferedImage;
	}
727719
@Override
    public <X extends Archive<X>> X getAsType(Class<X> type, ArchivePath path) {
        Validate.notNull(type, "Type must be specified");
        Validate.notNull(path, "ArchivePath must be specified");

        Node content = get(path);
        if (content == null) {
            return null;
        }
        Asset asset = content.getAsset();
        if (asset == null) {
            return null;
        }

        if (asset instanceof ArchiveAsset) {
            ArchiveAsset archiveAsset = (ArchiveAsset) asset;
            return archiveAsset.getArchive().as(type);
        }

        ArchiveFormat archiveFormat = this.configuration.getExtensionLoader()
            .getArchiveFormatFromExtensionMapping(type);
        return getAsType(type, path, archiveFormat);
    }