gr/gr/
attributes.rs

1use super::util::{impl_primitive_function, textx_opts};
2use super::GrError;
3use crate::util::f64range::F64Range;
4use crate::util::region::Region;
5use core::ffi::{c_int, c_uint, CStr};
6use core::mem;
7use core::mem::MaybeUninit;
8use core::ptr;
9use gr_sys::gks::{GKS_K_CLIP, GKS_K_NOCLIP};
10use gr_sys::gkscore::MAX_COLOR;
11use gr_sys::gr::*;
12use gr_sys::strlib::*;
13use paste::paste;
14
15#[rustfmt::skip]
16macro_rules! impl_primitive_set {
17    ($name:ident, $t:ty)                         => { impl_primitive_function! { $name(val: $t) } };
18    ($name:ident, $t:ty, $t2:ty)                 => { impl_primitive_function! { $name(val: $t, val2: $t2) } };
19    ($name:ident, $t:ty, $t2:ty, $t3:ty)         => { impl_primitive_function! { $name(val: $t, val2: $t2, val3: $t3) } };
20    ($name:ident, $t:ty, $t2:ty, $t3:ty, $t4:ty) => { impl_primitive_function! { $name(val: $t, val2: $t2, val3: $t3, val4: $t4) } };
21}
22
23macro_rules! impl_primitive_inq {
24    ($name:ident, $type:ty) => {
25        pub fn $name() -> $type {
26            let mut val = MaybeUninit::uninit();
27            let p = val.as_mut_ptr();
28            unsafe {
29                paste!([<gr_$name>])(p);
30                val.assume_init()
31            }
32        }
33    };
34
35    ($name:ident 3f64) => {
36        pub fn $name() -> (f64, f64, f64) {
37            let mut x = MaybeUninit::uninit();
38            let mut y = MaybeUninit::uninit();
39            let mut z = MaybeUninit::uninit();
40            let xp = x.as_mut_ptr();
41            let yp = y.as_mut_ptr();
42            let zp = z.as_mut_ptr();
43            unsafe {
44                paste!([<gr_$name>])(xp, yp, zp);
45                (x.assume_init(), y.assume_init(), z.assume_init())
46            }
47        }
48    };
49}
50
51macro_rules! impl_primitive_set_inq {
52    ($name:ident, $type:ty) => {
53        paste! {
54            impl_primitive_set! { [<set$name>], $type }
55            impl_primitive_inq! { [<inq$name>], $type }
56        }
57    };
58
59    ($name:ident 3f64) => {
60        paste! {
61            impl_primitive_set! { [<set$name>], f64, f64, f64 }
62            impl_primitive_inq! { [<inq$name>] 3f64 }
63        }
64    };
65}
66
67// TODO move to appropriate location
68pub fn startlistener() -> Result<(), GrError> {
69    match unsafe { gr_startlistener() } {
70        -1 => Err(GrError),
71        _ => Ok(()),
72    }
73}
74
75pub fn inqtext((x, y): (f64, f64), s: impl AsRef<CStr>) -> ([f64; 4], [f64; 4]) {
76    let s = s.as_ref().as_ptr().cast_mut();
77    let mut tbx = MaybeUninit::<[f64; 4]>::uninit();
78    let mut tby = MaybeUninit::<[f64; 4]>::uninit();
79    let tbx_ptr = tbx.as_mut_ptr().cast();
80    let tby_ptr = tby.as_mut_ptr().cast();
81    unsafe {
82        gr_inqtext(x, y, s, tbx_ptr, tby_ptr);
83        (tbx.assume_init(), tby.assume_init())
84    }
85}
86
87pub fn inqtextx(
88    (x, y): (f64, f64),
89    s: impl AsRef<CStr>,
90    world_cooridnates: bool,
91    inline_math: bool,
92) -> ([f64; 4], [f64; 4]) {
93    let s = s.as_ref().as_ptr().cast_mut();
94    let f = textx_opts(world_cooridnates, inline_math);
95    let mut tbx = MaybeUninit::<[f64; 4]>::uninit();
96    let mut tby = MaybeUninit::<[f64; 4]>::uninit();
97    let tbx_ptr = tbx.as_mut_ptr().cast();
98    let tby_ptr = tby.as_mut_ptr().cast();
99    unsafe {
100        gr_inqtextx(x, y, s, f, tbx_ptr, tby_ptr);
101        (tbx.assume_init(), tby.assume_init())
102    }
103}
104
105pub fn inqtextext((x, y): (f64, f64), s: impl AsRef<CStr>) -> ([f64; 4], [f64; 4]) {
106    let s = s.as_ref().as_ptr().cast_mut();
107    let mut tbx = MaybeUninit::<[f64; 4]>::uninit();
108    let mut tby = MaybeUninit::<[f64; 4]>::uninit();
109    let tbx_ptr = tbx.as_mut_ptr().cast();
110    let tby_ptr = tby.as_mut_ptr().cast();
111    unsafe {
112        gr_inqtextext(x, y, s, tbx_ptr, tby_ptr);
113        (tbx.assume_init(), tby.assume_init())
114    }
115}
116
117/// `axis` specifies, in which direction the text is drawn (1: YX-plane, 2: XY plane, 3: YZ plane, 4: XZ plane). Negative values invert shearing.
118pub fn inqtext3d(
119    (x, y, z): (f64, f64, f64),
120    s: impl AsRef<CStr>,
121    axis: impl Into<c_int>,
122) -> ([f64; 16], [f64; 16]) {
123    // [MaybeUninit::<f64>::uninit(); 16] compiles but is wrong!
124    let mut xout: [MaybeUninit<f64>; 16] = unsafe { MaybeUninit::uninit().assume_init() };
125    let mut yout: [MaybeUninit<f64>; 16] = unsafe { MaybeUninit::uninit().assume_init() };
126    let p = s.as_ref().as_ptr().cast_mut();
127    let axis = axis.into();
128    let xp = xout.as_mut_ptr().cast();
129    let yp = yout.as_mut_ptr().cast();
130    unsafe {
131        gr_inqtext3d(x, y, z, p, axis, xp, yp);
132        #[allow(clippy::missing_transmute_annotations)]
133        (mem::transmute(xout), mem::transmute(yout))
134    }
135}
136
137pub fn inqmathtex((x, y): (f64, f64), s: impl AsRef<CStr>) -> (f64, f64) {
138    let s = s.as_ref().as_ptr().cast_mut();
139    let mut tbx = MaybeUninit::uninit();
140    let mut tby = MaybeUninit::uninit();
141    let tbx_ptr = tbx.as_mut_ptr();
142    let tby_ptr = tby.as_mut_ptr();
143    unsafe {
144        gr_inqmathtex(x, y, s, tbx_ptr, tby_ptr);
145        (tbx.assume_init(), tby.assume_init())
146    }
147}
148
149#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
150pub enum ScientificFormatOption {
151    E = SCIENTIFIC_FORMAT_OPTION_E as _,
152    TexTex = SCIENTIFIC_FORMAT_OPTION_TEXTEX as _,
153    MathTex = SCIENTIFIC_FORMAT_OPTION_MATHTEX as _,
154}
155
156pub fn setscientificformat(opt: ScientificFormatOption) {
157    let opt = opt as _;
158    unsafe { gr_setscientificformat(opt) };
159}
160
161pub fn setscale(val: impl Into<c_int>) -> Result<(), GrError> {
162    let val = val.into();
163    let result = unsafe { gr_setscale(val) };
164    match result {
165        0 => Ok(()),
166        _ => Err(GrError),
167    }
168}
169
170pub fn setspace(z: F64Range, rotation: c_int, tilt: c_int) -> Result<(), GrError> {
171    let (zmin, zmax) = z.into();
172    let err = unsafe { gr_setspace(zmin, zmax, rotation, tilt) };
173    match err {
174        0 => Ok(()),
175        -1 => Err(GrError),
176        _ => unreachable!(),
177    }
178}
179
180pub fn inqspace() -> (F64Range, c_int, c_int) {
181    let mut zmin = MaybeUninit::uninit();
182    let mut zmax = MaybeUninit::uninit();
183    let mut rotation = MaybeUninit::uninit();
184    let mut tilt = MaybeUninit::uninit();
185    let zmin_ptr = zmin.as_mut_ptr();
186    let zmax_ptr = zmax.as_mut_ptr();
187    let rotation_ptr = rotation.as_mut_ptr();
188    let tilt_ptr = tilt.as_mut_ptr();
189    unsafe {
190        gr_inqspace(zmin_ptr, zmax_ptr, rotation_ptr, tilt_ptr);
191        (
192            F64Range::new_unchecked(zmin.assume_init(), zmax.assume_init()),
193            rotation.assume_init(),
194            tilt.assume_init(),
195        )
196    }
197}
198
199pub fn inqspace3d() -> Option<(f64, f64, f64, f64)> {
200    let mut used = MaybeUninit::uninit();
201    let mut azimuth = MaybeUninit::uninit();
202    let mut polar = MaybeUninit::uninit();
203    let mut fov = MaybeUninit::uninit();
204    let mut cam = MaybeUninit::uninit();
205    let used_ptr = used.as_mut_ptr();
206    let azimuth_ptr = azimuth.as_mut_ptr();
207    let polar_ptr = polar.as_mut_ptr();
208    let fov_ptr = fov.as_mut_ptr();
209    let cam_ptr = cam.as_mut_ptr();
210    unsafe { gr_inqspace3d(used_ptr, azimuth_ptr, polar_ptr, fov_ptr, cam_ptr) }
211    let used = unsafe { used.assume_init() };
212    match used {
213        1 => Some(unsafe {
214            (
215                azimuth.assume_init(),
216                polar.assume_init(),
217                fov.assume_init(),
218                cam.assume_init(),
219            )
220        }),
221        0 => None,
222        _ => unreachable!(),
223    }
224}
225
226#[allow(clippy::unit_arg)]
227pub fn setcolormapfromrgb(
228    n: usize,
229    r: &[f64],
230    g: &[f64],
231    b: &[f64],
232    x: Option<&[f64]>,
233) -> Result<(), GrError> {
234    if n > r.len() || n > g.len() || n > b.len() || x.map_or(false, |x| n > x.len()) {
235        return Err(GrError);
236    }
237    let n = n.try_into()?;
238    let r = r.as_ptr().cast_mut();
239    let g = g.as_ptr().cast_mut();
240    let b = b.as_ptr().cast_mut();
241    let x = x.map_or(ptr::null(), |x| x.as_ptr()).cast_mut();
242    Ok(unsafe { gr_setcolormapfromrgb(n, r, g, b, x) })
243}
244
245pub fn inqcolor(n: usize) -> Result<c_int, GrError> {
246    match n.try_into() {
247        Ok(n) if n < MAX_COLOR => {
248            let mut col = MaybeUninit::uninit();
249            let cp = col.as_mut_ptr();
250            Ok(unsafe {
251                gr_inqcolor(n, cp);
252                col.assume_init()
253            })
254        }
255        _ => Err(GrError),
256    }
257}
258
259pub fn inqcolormapinds() -> (c_int, c_int) {
260    let mut fst = MaybeUninit::uninit();
261    let mut snd = MaybeUninit::uninit();
262    let fp = fst.as_mut_ptr();
263    let sp = snd.as_mut_ptr();
264    unsafe {
265        gr_inqcolormapinds(fp, sp);
266        (fst.assume_init(), snd.assume_init())
267    }
268}
269
270pub fn inqcolorfromrgb(r: f64, g: f64, b: f64) -> c_int {
271    unsafe { gr_inqcolorfromrgb(r, g, b) }
272}
273
274pub fn hsvtorgb(h: f64, s: f64, v: f64) -> (f64, f64, f64) {
275    let mut r = MaybeUninit::uninit();
276    let mut g = MaybeUninit::uninit();
277    let mut b = MaybeUninit::uninit();
278    let rp = r.as_mut_ptr();
279    let gp = g.as_mut_ptr();
280    let bp = b.as_mut_ptr();
281    unsafe {
282        gr_hsvtorgb(h, s, v, rp, gp, bp);
283        (r.assume_init(), g.assume_init(), b.assume_init())
284    }
285}
286
287pub fn tick(range: F64Range) -> f64 {
288    let (min, max) = range.into();
289    unsafe { gr_tick(min, max) }
290}
291
292pub fn validaterange(min: f64, max: f64) -> bool {
293    0 != unsafe { gr_validaterange(min, max) }
294}
295
296pub fn adjustlimits(limits: F64Range) -> F64Range {
297    let (mut min, mut max) = limits.into();
298    unsafe {
299        gr_adjustrange(&mut min, &mut max);
300        F64Range::new_unchecked(min, max)
301    }
302}
303
304pub fn adjustrange(mut min: f64, mut max: f64) -> (f64, f64) {
305    unsafe { gr_adjustrange(&mut min, &mut max) }
306    (min, max)
307}
308
309pub fn version() -> &'static CStr {
310    unsafe { CStr::from_ptr(gr_version()) }
311}
312
313pub fn beginprint(pathname: impl AsRef<CStr>) {
314    let p = pathname.as_ref().as_ptr().cast_mut();
315    unsafe { gr_beginprint(p) }
316}
317
318#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
319pub enum GrColorMode {
320    GrayScale,
321    Color,
322}
323
324#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
325pub enum GrOrientation {
326    Landscape,
327    Portrait,
328}
329
330pub fn beginprintext(
331    pathname: impl AsRef<CStr>,
332    mode: GrColorMode,
333    format: impl AsRef<CStr>,
334    orientation: GrOrientation,
335) {
336    let p = pathname.as_ref().as_ptr().cast_mut();
337    let m = match mode {
338        GrColorMode::GrayScale => c"GrayScale",
339        GrColorMode::Color => c"Color",
340    }
341    .as_ptr()
342    .cast_mut();
343    let f = format.as_ref().as_ptr().cast_mut();
344    let o = match orientation {
345        GrOrientation::Landscape => c"Landscape",
346        GrOrientation::Portrait => c"Portrait",
347    }
348    .as_ptr()
349    .cast_mut();
350    unsafe { gr_beginprintext(p, m, f, o) }
351}
352
353pub fn endprint() {
354    unsafe { gr_endprint() }
355}
356
357pub fn ndctowc(mut x: f64, mut y: f64) -> (f64, f64) {
358    unsafe { gr_ndctowc(&mut x, &mut y) }
359    (x, y)
360}
361
362pub fn wctondc(mut x: f64, mut y: f64) -> (f64, f64) {
363    unsafe { gr_wctondc(&mut x, &mut y) }
364    (x, y)
365}
366
367pub fn wc3towc(mut x: f64, mut y: f64, mut z: f64) -> (f64, f64, f64) {
368    unsafe { gr_wc3towc(&mut x, &mut y, &mut z) }
369    (x, y, z)
370}
371
372pub fn setbboxcallback(id: impl Into<c_int>, f: unsafe extern "C" fn(c_int, f64, f64, f64, f64)) {
373    let id = id.into();
374    let f = Some(f);
375    unsafe { gr_setbboxcallback(id, f) }
376}
377
378pub fn uselinespec(linespec: impl AsRef<CStr>) -> c_int {
379    let s = linespec.as_ref().as_ptr().cast_mut();
380    unsafe { gr_uselinespec(s) }
381}
382
383pub fn setwindows3d(x: (f64, f64), y: (f64, f64), z: (f64, f64)) {
384    let (xmin, xmax) = x;
385    let (ymin, ymax) = y;
386    let (zmin, zmax) = z;
387    unsafe { gr_setwindow3d(xmin, xmax, ymin, ymax, zmin, zmax) }
388}
389
390pub fn inqwindows3d() -> ((f64, f64), (f64, f64), (f64, f64)) {
391    let mut xmin = MaybeUninit::uninit();
392    let mut xmax = MaybeUninit::uninit();
393    let mut ymin = MaybeUninit::uninit();
394    let mut ymax = MaybeUninit::uninit();
395    let mut zmin = MaybeUninit::uninit();
396    let mut zmax = MaybeUninit::uninit();
397    let xmin_ptr = xmin.as_mut_ptr();
398    let xmax_ptr = xmax.as_mut_ptr();
399    let ymin_ptr = ymin.as_mut_ptr();
400    let ymax_ptr = ymax.as_mut_ptr();
401    let zmin_ptr = zmin.as_mut_ptr();
402    let zmax_ptr = zmax.as_mut_ptr();
403    unsafe { gr_inqwindow3d(xmin_ptr, xmax_ptr, ymin_ptr, ymax_ptr, zmin_ptr, zmax_ptr) }
404    unsafe {
405        (
406            (xmin.assume_init(), xmax.assume_init()),
407            (ymin.assume_init(), ymax.assume_init()),
408            (zmin.assume_init(), zmax.assume_init()),
409        )
410    }
411}
412
413#[derive(Clone, Copy, Debug, PartialEq)]
414pub struct GrTransformationParameters {
415    camera_pos: (f64, f64, f64),
416    up: (f64, f64, f64),
417    focus_point: (f64, f64, f64),
418}
419
420pub fn settransformationparameters(tp: GrTransformationParameters) {
421    let (cpx, cpy, cpz) = tp.camera_pos;
422    let (upx, upy, upz) = tp.up;
423    let (fpx, fpy, fpz) = tp.focus_point;
424    unsafe { gr_settransformationparameters(cpx, cpy, cpz, upx, upy, upz, fpx, fpy, fpz) }
425}
426
427pub fn inqtransformationparameters() -> GrTransformationParameters {
428    let mut arr: [MaybeUninit<f64>; 9] = unsafe { MaybeUninit::uninit().assume_init() };
429    let arr: [f64; 9] = unsafe {
430        gr_inqtransformationparameters(
431            arr[0].as_mut_ptr(),
432            arr[1].as_mut_ptr(),
433            arr[2].as_mut_ptr(),
434            arr[3].as_mut_ptr(),
435            arr[4].as_mut_ptr(),
436            arr[5].as_mut_ptr(),
437            arr[6].as_mut_ptr(),
438            arr[7].as_mut_ptr(),
439            arr[7].as_mut_ptr(),
440        );
441        mem::transmute(arr)
442    };
443    GrTransformationParameters {
444        camera_pos: (arr[0], arr[1], arr[2]),
445        up: (arr[3], arr[4], arr[5]),
446        focus_point: (arr[6], arr[7], arr[8]),
447    }
448}
449
450pub fn setorthographicprojection(
451    (left, right): (f64, f64),
452    (bottom, top): (f64, f64),
453    (near, far): (f64, f64),
454) {
455    unsafe { gr_setorthographicprojection(left, right, bottom, top, near, far) }
456}
457
458pub fn inqorthographicprojection() -> ((f64, f64), (f64, f64), (f64, f64)) {
459    let mut left = MaybeUninit::uninit();
460    let mut right = MaybeUninit::uninit();
461    let mut bottom = MaybeUninit::uninit();
462    let mut top = MaybeUninit::uninit();
463    let mut near = MaybeUninit::uninit();
464    let mut far = MaybeUninit::uninit();
465    let leftp = left.as_mut_ptr();
466    let rightp = right.as_mut_ptr();
467    let bottomp = bottom.as_mut_ptr();
468    let topp = top.as_mut_ptr();
469    let nearp = near.as_mut_ptr();
470    let farp = far.as_mut_ptr();
471    unsafe {
472        gr_inqorthographicprojection(leftp, rightp, bottomp, topp, nearp, farp);
473        (
474            (left.assume_init(), right.assume_init()),
475            (bottom.assume_init(), top.assume_init()),
476            (near.assume_init(), far.assume_init()),
477        )
478    }
479}
480
481pub fn inqvpsize() -> (c_int, c_int, f64) {
482    let mut width = MaybeUninit::uninit();
483    let mut height = MaybeUninit::uninit();
484    let mut device_pixel_ratio = MaybeUninit::uninit();
485    let wp = width.as_mut_ptr();
486    let hp = height.as_mut_ptr();
487    let dpr = device_pixel_ratio.as_mut_ptr();
488    unsafe {
489        gr_inqvpsize(wp, hp, dpr);
490        (
491            width.assume_init(),
492            height.assume_init(),
493            device_pixel_ratio.assume_init(),
494        )
495    }
496}
497
498#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
499pub struct VolumeFlags {
500    border: c_int,
501    max_threads: c_int,
502    picture_width: c_int,
503    picture_height: c_int,
504    approximative_calculation: c_int,
505}
506
507pub fn inqvolumeflags() -> VolumeFlags {
508    let mut vf = MaybeUninit::<VolumeFlags>::uninit();
509    unsafe {
510        gr_inqvolumeflags(
511            &raw mut (*vf.as_mut_ptr()).border,
512            &raw mut (*vf.as_mut_ptr()).max_threads,
513            &raw mut (*vf.as_mut_ptr()).picture_width,
514            &raw mut (*vf.as_mut_ptr()).picture_height,
515            &raw mut (*vf.as_mut_ptr()).approximative_calculation,
516        );
517        vf.assume_init()
518    }
519}
520
521pub fn inqclip() -> Option<Region> {
522    let mut clipping = MaybeUninit::<c_int>::uninit();
523    let mut region = MaybeUninit::<[f64; 4]>::uninit();
524    match unsafe {
525        gr_inqclip(clipping.as_mut_ptr(), region.as_mut_ptr().cast());
526        clipping.assume_init()
527    } {
528        no if no == GKS_K_NOCLIP => None,
529        yes if yes == GKS_K_CLIP => Some(unsafe { region.assume_init() }.into()),
530        _ => unreachable!(),
531    }
532}
533
534macro_rules! impl_set_size {
535    ($name:ident) => {
536        pub fn $name(x: F64Range, y: F64Range) {
537            let (xmin, xmax) = x.into();
538            let (ymin, ymax) = y.into();
539            unsafe { paste!([<gr_$name>])(xmin, xmax, ymin, ymax) }
540        }
541    };
542
543    ($($n:ident),+ $(,)?) => {
544        $(impl_set_size! { $n })+
545    };
546}
547
548macro_rules! impl_inq_size {
549    ($name:ident) => {
550        pub fn $name() -> (F64Range, F64Range) {
551            let mut xmin = MaybeUninit::uninit();
552            let mut xmax = MaybeUninit::uninit();
553            let mut ymin = MaybeUninit::uninit();
554            let mut ymax = MaybeUninit::uninit();
555            let xmin_ptr = xmin.as_mut_ptr();
556            let xmax_ptr = xmax.as_mut_ptr();
557            let ymin_ptr = ymin.as_mut_ptr();
558            let ymax_ptr = ymax.as_mut_ptr();
559            unsafe { paste!([<gr_$name>])(xmin_ptr, xmax_ptr, ymin_ptr, ymax_ptr) }
560            #[cfg(debug_assertions)]
561            {
562                let x = unsafe { F64Range::new_unchecked(xmin.assume_init(), xmax.assume_init()) };
563                let y = unsafe { F64Range::new_unchecked(ymin.assume_init(), ymax.assume_init()) };
564                (x, y)
565            }
566            #[cfg(not(debug_assertions))]
567            {
568                let x = F64Range::new(unsafe { xmin.assume_init() }, unsafe { xmax.assume_init() }).unwrap();
569                let y = F64Range::new(unsafe { ymin.assume_init() }, unsafe { ymax.assume_init() }).unwrap();
570                (x, y)
571            }
572        }
573    };
574
575    ($($n:ident),+ $(,)?) => {
576        $(impl_inq_size! { $n })+
577    };
578}
579
580impl_set_size! { setwindow, setviewport, setwswindow, setwsviewport }
581impl_inq_size! { inqwindow, inqviewport, inqbbox }
582
583pub use crate::gks::GksLinetype as GrLinetype;
584
585impl_primitive_set_inq! { linetype, c_int }
586impl_primitive_set_inq! { linewidth, f64 }
587impl_primitive_set_inq! { linecolorind, c_int }
588impl_primitive_set_inq! { markertype, c_int }
589impl_primitive_set_inq! { markersize, f64 }
590impl_primitive_set_inq! { markercolorind, c_int }
591impl_primitive_set_inq! { textcolorind, c_int }
592impl_primitive_set_inq! { fillintstyle, c_int }
593impl_primitive_set_inq! { fillstyle, c_int }
594impl_primitive_set_inq! { fillcolorind, c_int }
595impl_primitive_set_inq! { nominalsize, f64 }
596impl_primitive_set_inq! { colormap, c_int }
597impl_primitive_set_inq! { resamplemethod, c_uint }
598impl_primitive_set_inq! { borderwidth, f64 }
599impl_primitive_set_inq! { bordercolorind, c_int }
600impl_primitive_set_inq! { projectiontype, c_int }
601impl_primitive_set_inq! { textencoding, c_int }
602impl_primitive_set_inq! { charheight, f64 }
603impl_primitive_set_inq! { transparency, f64 }
604impl_primitive_set_inq! { scalefactors3d 3f64 }
605impl_primitive_set_inq! { perspectiveprojection 3f64 }
606impl_primitive_set! { selectclipxform, c_int }
607impl_primitive_inq! { inqclipxform, c_int }
608impl_primitive_set! { settextfontprec, c_int, c_int }
609impl_primitive_set! { setregenflags, c_int }
610impl_primitive_set! { setcharexpan, f64 }
611impl_primitive_set! { setcharspace, f64 }
612impl_primitive_set! { settextpath, c_int }
613impl_primitive_set! { selntran, c_int }
614impl_primitive_set! { setclip, c_int }
615impl_primitive_set! { setarrowstyle, c_int }
616impl_primitive_set! { setarrowsize, f64 }
617impl_primitive_set! { setwscharheight, f64, f64 }
618impl_primitive_set! { setcharup, f64, f64 }
619impl_primitive_set! { setcolorrep, c_int, f64, f64, f64 }
620impl_primitive_set! { setshadow, f64, f64, f64 }
621impl_primitive_set! { setthreadnumber, c_int }
622impl_primitive_set! { setpicturesizeforvolume, c_int, c_int }
623impl_primitive_set! { setvolumebordercalculation, c_int }
624impl_primitive_set! { setapproximativecalculation, c_int }
625impl_primitive_inq! { inqscale, c_int }
626impl_primitive_function! { inqregenflags() -> c_int }
627impl_primitive_function! { precision() -> f64 }
628impl_primitive_function! { text_maxsize() -> c_int }
629impl_primitive_function! { setspace3d(azimuth: f64, polar: f64, fov: f64, cam: f64) }
630impl_primitive_function! { beginselection(index: c_int, type_: c_int) }
631impl_primitive_function! { moveselection(x: f64, y: f64) }
632impl_primitive_function! { resizeselection(type_: c_int, x: f64, y: f64) }
633impl_primitive_function! { endselection() }
634impl_primitive_function! { savestate() }
635impl_primitive_function! { restorestate() }
636impl_primitive_function! { savecontext(context: c_int) }
637impl_primitive_function! { selectcontext(context: c_int) }
638impl_primitive_function! { destroycontext(context: c_int) }
639impl_primitive_function! { unselectcontext() }
640impl_primitive_function! { cancelbboxcallback() }