Use the rust-bindgen crate properly
Using the changes from @gadomski along with some additional work, to get the generated bindings working again. Works on macOS and FreeBSD 11. A couple of hacks are needed for FreeBSD, but nothing too serious. Changed to use the libc prefix, and changed to use the generated enums. Fixes #22, #15, and #14 cargo test passes
This commit is contained in:
@ -16,6 +16,9 @@
|
||||
use std::fmt;
|
||||
use std::ffi::{CStr, CString};
|
||||
use ::bindings;
|
||||
#[cfg(target_os = "freebsd")]
|
||||
use libc::size_t;
|
||||
#[cfg(not(target_os = "freebsd"))]
|
||||
use ::size_t;
|
||||
|
||||
wand_common!(
|
||||
@ -50,30 +53,30 @@ impl DrawingWand {
|
||||
);
|
||||
|
||||
set_get_unchecked!(
|
||||
get_gravity, set_gravity, DrawGetGravity, DrawSetGravity, u32
|
||||
get_gravity, set_gravity, DrawGetGravity, DrawSetGravity, bindings::GravityType
|
||||
get_opacity, set_opacity, DrawGetOpacity, DrawSetOpacity, f64
|
||||
get_clip_rule, set_clip_rule, DrawGetClipRule, DrawSetClipRule, u32
|
||||
get_clip_units, set_clip_units, DrawGetClipUnits, DrawSetClipUnits, u32
|
||||
get_fill_rule, set_fill_rule, DrawGetFillRule, DrawSetFillRule, u32
|
||||
get_clip_rule, set_clip_rule, DrawGetClipRule, DrawSetClipRule, bindings::FillRule
|
||||
get_clip_units, set_clip_units, DrawGetClipUnits, DrawSetClipUnits, bindings::ClipPathUnits
|
||||
get_fill_rule, set_fill_rule, DrawGetFillRule, DrawSetFillRule, bindings::FillRule
|
||||
get_fill_opacity, set_fill_opacity, DrawGetFillOpacity, DrawSetFillOpacity, f64
|
||||
|
||||
get_font_size, set_font_size, DrawGetFontSize, DrawSetFontSize, f64
|
||||
get_font_style, set_font_style, DrawGetFontStyle, DrawSetFontStyle, u32
|
||||
get_font_style, set_font_style, DrawGetFontStyle, DrawSetFontStyle, bindings::StyleType
|
||||
get_font_weight, set_font_weight, DrawGetFontWeight, DrawSetFontWeight, size_t
|
||||
get_font_stretch, set_font_stretch, DrawGetFontStretch, DrawSetFontStretch, u32
|
||||
get_font_stretch, set_font_stretch, DrawGetFontStretch, DrawSetFontStretch, bindings::StretchType
|
||||
|
||||
get_stroke_dash_offset, set_stroke_dash_offset, DrawGetStrokeDashOffset, DrawSetStrokeDashOffset, f64
|
||||
get_stroke_line_cap, set_stroke_line_cap, DrawGetStrokeLineCap, DrawSetStrokeLineCap, u32
|
||||
get_stroke_line_join, set_stroke_line_join, DrawGetStrokeLineJoin, DrawSetStrokeLineJoin, u32
|
||||
get_stroke_line_cap, set_stroke_line_cap, DrawGetStrokeLineCap, DrawSetStrokeLineCap, bindings::LineCap
|
||||
get_stroke_line_join, set_stroke_line_join, DrawGetStrokeLineJoin, DrawSetStrokeLineJoin, bindings::LineJoin
|
||||
get_stroke_miter_limit, set_stroke_miter_limit, DrawGetStrokeMiterLimit, DrawSetStrokeMiterLimit, size_t
|
||||
get_stroke_opacity, set_stroke_opacity, DrawGetStrokeOpacity, DrawSetStrokeOpacity, f64
|
||||
get_stroke_width, set_stroke_width, DrawGetStrokeWidth, DrawSetStrokeWidth, f64
|
||||
get_stroke_antialias, set_stroke_antialias, DrawGetStrokeAntialias, DrawSetStrokeAntialias, u32
|
||||
get_stroke_antialias, set_stroke_antialias, DrawGetStrokeAntialias, DrawSetStrokeAntialias, bindings::MagickBooleanType
|
||||
|
||||
get_text_alignment, set_text_alignment, DrawGetTextAlignment, DrawSetTextAlignment, u32
|
||||
get_text_antialias, set_text_antialias, DrawGetTextAntialias, DrawSetTextAntialias, u32
|
||||
get_text_decoration, set_text_decoration, DrawGetTextDecoration, DrawSetTextDecoration, u32
|
||||
get_text_direction, set_text_direction, DrawGetTextDirection, DrawSetTextDirection, u32
|
||||
get_text_alignment, set_text_alignment, DrawGetTextAlignment, DrawSetTextAlignment, bindings::AlignType
|
||||
get_text_antialias, set_text_antialias, DrawGetTextAntialias, DrawSetTextAntialias, bindings::MagickBooleanType
|
||||
get_text_decoration, set_text_decoration, DrawGetTextDecoration, DrawSetTextDecoration, bindings::DecorationType
|
||||
get_text_direction, set_text_direction, DrawGetTextDirection, DrawSetTextDirection, bindings::DirectionType
|
||||
get_text_kerning, set_text_kerning, DrawGetTextKerning, DrawSetTextKerning, f64
|
||||
get_text_interline_spacing, set_text_interline_spacing, DrawGetTextInterlineSpacing, DrawSetTextInterlineSpacing, f64
|
||||
get_text_interword_spacing, set_text_interword_spacing, DrawGetTextInterwordSpacing, DrawSetTextInterwordSpacing, f64
|
||||
|
||||
Reference in New Issue
Block a user