Skip to main content

Surf

Struct Surf 

Source
pub struct Surf(/* private fields */);

Implementations§

Source§

impl Surf

Source

pub fn retained(&self) -> R<Self>

Source§

impl Surf

Source

pub fn type_id() -> TypeId

use cidre::io;

let type_id = io::Surf::type_id();

assert_ne!(type_id, 0);
Source

pub fn create(properties: &Dictionary) -> Option<R<Surf>>

use cidre::{cf, io};


let width = cf::Number::from_i32(100);
let height = cf::Number::from_i32(200);

let properties = cf::Dictionary::with_keys_values(
  &[
    io::surface::key::width(),
    io::surface::key::height()
  ],
  &[
    &width,
    &height
  ]
).unwrap();

let surf = io::Surf::create(&properties).unwrap();

assert_eq!(100, surf.width());
assert_eq!(200, surf.height());
assert_eq!(0, surf.plane_count());
assert_ne!(0, surf.id());

let props = surf.all_values().unwrap();
props.show();
assert!(props.len() >= 1);
Source

pub fn id(&self) -> SurfId

Source

pub fn width(&self) -> usize

Source

pub fn height(&self) -> usize

Source

pub fn plane_count(&self) -> usize

Source

pub fn plane_width(&self, plane_index: usize) -> usize

Source

pub fn plane_height(&self, plane_index: usize) -> usize

Source

pub fn lookup(csid: SurfId) -> Option<R<Surf>>

use cidre::io;

let surf = io::Surf::lookup(0);

assert!(surf.is_none());
Source

pub fn all_values(&self) -> Option<R<DictionaryOf<String, Type>>>

Source

pub fn remove_all_values(&mut self)

Source

pub fn create_mach_port(&self) -> MachPort

Source

pub fn from_mach_port(port: MachPort) -> Option<R<Surf>>

This call takes a mach_port_t created via io::Surface::create_mach_port() and recreates an io::Surface from it.

This call does NOT destroy the port.

Source

pub fn is_in_use(&self) -> bool

Returns true of an io::Surface is in use by any process in the system, otherwise false.

Source

pub fn use_count(&self) -> i32

Source

pub fn inc_use_count(&mut self)

Source

pub fn dec_use_count(&mut self)

Source

pub fn allows_pixel_size_casting(&self) -> bool

Source

pub fn seed(&self) -> u32

This will return the current seed value of the buffer and is a cheap call to make to see if the contents of the buffer have changed since the last lock/unlock.

Source

pub fn alloc_size(&self) -> usize

Returns the total allocation size of the buffer including all planes.

Source

pub unsafe fn from_raw(ptr: *mut u8) -> R<Self>

Source

pub fn bytes_per_row(&self) -> usize

Source

pub fn pixel_format(&self) -> Type

Source

pub unsafe fn lock(&mut self, opts: LockOpts, seed: *mut u32) -> Result

Source

pub unsafe fn unlock(&mut self, opts: LockOpts, seed: *mut u32) -> Result

Methods from Deref<Target = Type>§

Source

pub fn get_type_id(&self) -> TypeId

Source

pub unsafe fn as_type_ptr(&self) -> *const c_void

Source

pub fn as_type_ref(&self) -> &Type

Source

pub fn is_tagged_ptr(&self) -> bool

Source

pub fn try_as_number(&self) -> Option<&Number>

Source

pub fn try_as_string(&self) -> Option<&String>

Source

pub fn show(&self)

Source

pub fn allocator(&self) -> Option<&Allocator>

Source

pub fn retain_count(&self) -> isize

Source

pub fn equal(&self, other: &Type) -> bool

use cidre::cf;

let n1 = cf::Number::from_i8(4);
let n2 = cf::Number::from_i32(4);
let n3 = cf::Number::from_f64(3.0);

assert!(n1.equal(&n2));
assert_eq!(false, n1.equal(&n3));
Source

pub fn hash(&self) -> usize

Source

pub fn desc(&self) -> R<String>

Trait Implementations§

Source§

impl AsRef<Type> for Surf

Source§

fn as_ref(&self) -> &Type

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Debug for Surf

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for Surf

Source§

type Target = Type

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for Surf

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl Release for Surf

Source§

unsafe fn release(&mut self)

Source§

impl Retain for Surf

Source§

fn retained(&self) -> R<Self>

Source§

impl Send for Surf

Auto Trait Implementations§

§

impl !Sync for Surf

§

impl Freeze for Surf

§

impl RefUnwindSafe for Surf

§

impl Unpin for Surf

§

impl UnsafeUnpin for Surf

§

impl UnwindSafe for Surf

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.