1extern crate libc;
13#[macro_use]
14extern crate bitflags;
15
16pub mod egl;
17pub mod ffi;
18pub mod error;
19
20mod display;
21mod context;
22mod window_surface;
23mod config_filter;
24mod frame_buffer_config;
25mod version;
26
27pub use display::{Display, ContextClientVersion};
28pub use context::Context;
29pub use window_surface::Surface;
30pub use config_filter::ConfigFilterRef;
31pub use frame_buffer_config::FrameBufferConfigRef;
32pub use version::Version;
33
34use std::mem;
35
36#[cfg(feature = "egl_1_5")]
46pub fn query_version() -> error::Result<&'static str> {
47 let cstr = egl::query_string(egl::EGL_NO_DISPLAY, egl::EGL_VERSION)?;
48 Ok(cstr.to_str()?)
49}
50
51pub fn query_extensions() -> error::Result<&'static str> {
55 let cstr = egl::query_string(egl::EGL_NO_DISPLAY, egl::EGL_EXTENSIONS)?;
56 Ok(cstr.to_str()?)
57}
58
59#[repr(i32)]
60#[derive(Copy, Clone, Debug)]
61pub enum ColorBufferType {
62 Rgb = 0x308E,
63 Luminance = 0x308F,
64}
65
66impl ColorBufferType {
67 pub unsafe fn from_raw(value: egl::EGLint) -> ColorBufferType {
68 mem::transmute(value as i32)
69 }
70}
71
72#[repr(i32)]
73#[derive(Copy, Clone, Debug)]
74pub enum ConfigCaveat {
75 None = 0x3038,
76 Slow = 0x3050,
77 NonConformant = 0x3051,
78}
79
80impl ConfigCaveat {
81 pub unsafe fn from_raw(value: egl::EGLint) -> ConfigCaveat {
82 mem::transmute(value as i32)
83 }
84}
85
86#[repr(i32)]
87#[derive(Copy, Clone, Debug)]
88pub enum TransparentType {
89 None = 0x3038,
90 TransparentRgb = 0x3052,
91}
92
93impl TransparentType {
94 pub unsafe fn from_raw(value: egl::EGLint) -> TransparentType {
95 mem::transmute(value as i32)
96 }
97}
98
99bitflags! {
100 pub struct RenderableType: i32 {
102 const OPENGL = 0x0008;
104 const OPENGL_ES = 0x0001;
106 const OPENGL_ES2 = 0x0004;
108 const OPENGL_ES3 = 0x00000040;
110 const OPENVG = 0x0002;
112 }
113}
114
115bitflags! {
116 pub struct SurfaceType: i32 {
118 const PBUFFER = 0x0001;
120 const PIXMAP = 0x0002;
122 const WINDOW = 0x0004;
124 const VG_COLORSPACE_LINEAR = 0x0020;
126 const VG_ALPHA_FORMAT_PRE = 0x0040;
128 const MULTISAMPLE_RESOLVE_BOX = 0x0200;
130 const SWAP_BEHAVIOR_PRESERVED = 0x0400;
132 }
133}