diff --git a/lib/brst/binding/ruby/asian.rb b/lib/brst/binding/ruby/asian.rb index bcfc02a..dfae8f2 100644 --- a/lib/brst/binding/ruby/asian.rb +++ b/lib/brst/binding/ruby/asian.rb @@ -32,14 +32,14 @@ def self.safe_attach(name, args, ret) MISSING_SYMBOLS << [name, e.message] end - safe_attach :BRST_UseJPFonts, [:Doc], :uint32 - safe_attach :BRST_UseKRFonts, [:Doc], :uint32 - safe_attach :BRST_UseCNSFonts, [:Doc], :uint32 - safe_attach :BRST_UseCNTFonts, [:Doc], :uint32 - safe_attach :BRST_UseJPEncodings, [:Doc], :uint32 - safe_attach :BRST_UseKREncodings, [:Doc], :uint32 - safe_attach :BRST_UseCNSEncodings, [:Doc], :uint32 - safe_attach :BRST_UseCNTEncodings, [:Doc], :uint32 + safe_attach :BRST_Doc_UseJPFonts, [:Doc], :uint32 + safe_attach :BRST_Doc_UseKRFonts, [:Doc], :uint32 + safe_attach :BRST_Doc_UseCNSFonts, [:Doc], :uint32 + safe_attach :BRST_Doc_UseCNTFonts, [:Doc], :uint32 + safe_attach :BRST_Doc_UseJPEncodings, [:Doc], :uint32 + safe_attach :BRST_Doc_UseKREncodings, [:Doc], :uint32 + safe_attach :BRST_Doc_UseCNSEncodings, [:Doc], :uint32 + safe_attach :BRST_Doc_UseCNTEncodings, [:Doc], :uint32 end end end diff --git a/lib/brst/binding/ruby/doc_page.rb b/lib/brst/binding/ruby/doc_page.rb index 83241c8..d4cf96f 100644 --- a/lib/brst/binding/ruby/doc_page.rb +++ b/lib/brst/binding/ruby/doc_page.rb @@ -41,7 +41,7 @@ def self.safe_attach(name, args, ret) safe_attach :BRST_Doc_Page_Current, [:Doc], :Page safe_attach :BRST_Doc_Page_Add, [:Doc], :Page safe_attach :BRST_Doc_Page_Insert, [:Doc, :Page], :Page - safe_attach :BRST_Doc_Page_AddLabel, [:Doc, :uint32, :PageNumStyle, :uint32, :string], :uint32 + safe_attach :BRST_Doc_Page_AddLabel, [:Doc, :uint32, :PageNum, :uint32, :string], :uint32 end end end diff --git a/lib/brst/binding/ruby/doc_xobject.rb b/lib/brst/binding/ruby/doc_xobject.rb index 0ad85da..45e3156 100644 --- a/lib/brst/binding/ruby/doc_xobject.rb +++ b/lib/brst/binding/ruby/doc_xobject.rb @@ -32,8 +32,6 @@ def self.safe_attach(name, args, ret) MISSING_SYMBOLS << [name, e.message] end - safe_attach :BRST_Doc_XObject_CreateFromImage, [:Doc, :Rect, :Image, :int32], :XObject - safe_attach :BRST_Doc_XObject_CreateAsWhiteRect, [:Doc, :Rect], :XObject safe_attach :BRST_Doc_XObject_Create, [:Doc, :float, :float, :float, :float], :XObject end end diff --git a/lib/brst/binding/ruby/image.rb b/lib/brst/binding/ruby/image.rb new file mode 100644 index 0000000..6743810 --- /dev/null +++ b/lib/brst/binding/ruby/image.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true +# +# AUTO-GENERATED by brst-binding-ruby's generator (generator/bin/brst-binding-ruby-gen). +# Source of truth: libBeresta gen/data/*.lsp (S-expression definitions). +# DO NOT EDIT BY HAND. Re-generate with `rake generate`. + +require "ffi" +require_relative "library" +require_relative "types" + +module Brst + module Binding + module Ruby + module Image + extend FFI::Library + ffi_lib Brst::Binding::Ruby::Library.lib_path + + Brst::Binding::Ruby::Types.apply(self) + + MISSING_SYMBOLS = [] + + # Wraps `attach_function` so that captions whose actual C symbol + # is missing from the loaded libBeresta build (e.g. caption / + # symbol drift in upstream .lsp data, or features compiled + # out) — or whose declared parameter types reference a struct + # / enum the .lsp data never declared — don't break the entire + # gem load. Each miss is recorded in MISSING_SYMBOLS for + # diagnostic surfaces. + def self.safe_attach(name, args, ret) + attach_function(name, args, ret) + rescue FFI::NotFoundError, TypeError => e + MISSING_SYMBOLS << [name, e.message] + end + + safe_attach :BRST_Image_AddSMask, [:Image, :Image], :uint32 + safe_attach :BRST_Image_Width, [:Image], :uint32 + safe_attach :BRST_Image_Height, [:Image], :uint32 + safe_attach :BRST_Image_BitsPerComponent, [:Image], :uint32 + safe_attach :BRST_Image_ColorSpace, [:Image], :string + safe_attach :BRST_Image_SetColorMask, [:Image, :uint32, :uint32, :uint32, :uint32, :uint32, :uint32], :uint32 + safe_attach :BRST_Image_SetMaskImage, [:Image, :Image], :uint32 + end + end + end +end diff --git a/lib/brst/binding/ruby/types.rb b/lib/brst/binding/ruby/types.rb index eeb2514..3ee1d2d 100644 --- a/lib/brst/binding/ruby/types.rb +++ b/lib/brst/binding/ruby/types.rb @@ -69,6 +69,7 @@ def apply_pointers(mod) mod.typedef :pointer, :Date mod.typedef :pointer, :Dict mod.typedef :pointer, :Doc + mod.typedef :pointer, :Encoder mod.typedef :pointer, :Error mod.typedef :pointer, :FontDef mod.typedef :pointer, :Matrix @@ -168,10 +169,13 @@ def apply_structs(mod) def apply_definitions(mod) mod.typedef :Dict, :Annotation mod.typedef :Array, :Destination + mod.typedef :Dict, :EmbeddedFile mod.typedef :Dict, :OutputIntent + mod.typedef :Dict, :PDFAType mod.typedef :Dict, :ExData mod.typedef :Dict, :ExtGState mod.typedef :Dict, :Font + mod.typedef :Dict, :Image mod.typedef :Dict, :JavaScript mod.typedef :Dict, :Page mod.typedef :Dict, :Pattern