Class ImageProcessor

java.lang.Object
io.leandev.appfuse.image.ImageProcessor

public class ImageProcessor extends Object

圖片處理器

提供有狀態的圖片處理功能,支援鏈式操作

所有縮放操作委託給 ImageScaler 執行

  • Constructor Details

    • ImageProcessor

      public ImageProcessor()
    • ImageProcessor

      public ImageProcessor(int ppi)
  • Method Details

    • scale

      public BufferedImage scale(BufferedImage image, int width, int height)
      縮放圖片到指定尺寸(保持長寬比)
      Parameters:
      image - 原始圖片
      width - 目標寬度
      height - 目標高度
      Returns:
      縮放後的圖片
    • scale

      public BufferedImage scale(BufferedImage image, Length width, Length height)
      縮放圖片到指定尺寸(支援物理單位)
      Parameters:
      image - 原始圖片
      width - 目標寬度
      height - 目標高度
      Returns:
      縮放後的圖片
    • scaleByWidth

      public BufferedImage scaleByWidth(BufferedImage image, int width)
      依寬度等比縮放圖片
      Parameters:
      image - 原始圖片
      width - 目標寬度
      Returns:
      縮放後的圖片
    • scaleByWidth

      public BufferedImage scaleByWidth(BufferedImage image, Length width)
      依寬度等比縮放圖片(支援物理單位)
      Parameters:
      image - 原始圖片
      width - 目標寬度
      Returns:
      縮放後的圖片
    • scaleByHeight

      public BufferedImage scaleByHeight(BufferedImage image, int height)
      依高度等比縮放圖片
      Parameters:
      image - 原始圖片
      height - 目標高度
      Returns:
      縮放後的圖片
    • scaleByHeight

      public BufferedImage scaleByHeight(BufferedImage image, Length height)
      依高度等比縮放圖片(支援物理單位)
      Parameters:
      image - 原始圖片
      height - 目標高度
      Returns:
      縮放後的圖片
    • getPpi

      public int getPpi()
      取得處理器的 PPI 設定
      Returns:
      PPI 值