Sha256: 7ed84519dfb45aa060fb1faf946e1d6fe22af2f71bc53f44403a4532378497b4

Contents?: true

Size: 1.4 KB

Versions: 8

Compression:

Stored size: 1.4 KB

Contents

module FreeImage
  # DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsICCProfiles(FREE_IMAGE_FORMAT fif)
  attach_function(:icc_supported, 'FreeImage_FIFSupportsICCProfiles', [:format], FreeImage::Boolean)
  module_function :icc_supported

  module ICC
    class Profile < FFI::Struct
      layout :flags, :int,
             :size,  :uint,
             :data,  :pointer
    end

    # DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_GetICCProfile(FIBITMAP *dib)
    FreeImage.attach_function('FreeImage_GetICCProfile', [:pointer], FreeImage::ICC::Profile)

    def icc_profile
      result = FreeImage.FreeImage_GetICCProfile(self)
      FreeImage.check_last_error
      result
    end

    # DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_CreateICCProfile(FIBITMAP *dib, void *data, long size);
    FreeImage.attach_function('FreeImage_CreateICCProfile', [:pointer, :pointer, :long], FreeImage::ICC::Profile)
    # DLL_API void DLL_CALLCONV FreeImage_DestroyICCProfile(FIBITMAP *dib);
    FreeImage.attach_function('FreeImage_DestroyICCProfile', [:pointer], :void)

    def icc_profile=(value)
      result = if value
        FreeImage.FreeImage_CreateICCProfile(self, value[:data], value[:size])
      else
        FreeImage.FreeImage_DestroyICCProfile(self)
      end
      FreeImage.check_last_error
      result
    end

    def icc_supported?
      FreeImage.icc_supported(self)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
free-image-0.8.1 lib/free-image/modules/icc.rb
free-image-0.8.0 lib/free-image/modules/icc.rb
free-image-0.7.1 lib/free-image/modules/icc.rb
free-image-0.7.0 lib/free-image/modules/icc.rb
free-image-0.6.2 lib/free-image/modules/icc.rb
free-image-0.6.1 lib/free-image/modules/icc.rb
free-image-0.6.0 lib/free-image/modules/icc.rb
free-image-0.5.0 lib/free-image/modules/icc.rb