pub fn build(mut self) -> BoxedUiItem {
        let mut meta = self.meta.take().expect_log_err("UiImageBuilder: no meta.");

        // Convert relative position to absolute position.
        match meta.relative_size {
            Some(rsize) => {
                let abs_size = {
                    let extent = self.ctx.config().graphics().extent();
                    Vec2f::from(*extent).component_mul(&rsize)
                };
                meta.absolute_size = abs_size;
            }
            None => {}
        }

        // TODO: support relative size.

        // Create quad for this UiItem.
        meta.quad = Some(make_rectangle(&meta.absolute_position, &meta.absolute_size));

        // Load texture
        let image = self.image_path.expect_log_err(format!(
            "UiImage {}: does not have image path.",
            meta.id_str()
        ));

        let tex_handle = load_texture(self.ctx, &image).expect_log_err(format!(
            "UiImage {}: failed to load image {}.",
            meta.id_str(),
            image
        ));

        meta.texture = TextureEntry::Owned(tex_handle);

        let item = Box::new(UiImage { meta, border: 0 });

        item
    }
/// Consume this builder, make UiItem and UiRenderable.
Consume this builder, make UiItem and UiRenderable.
Consume this builder make UiItem and UiRenderable .
pub fn build(mut self) -> BoxedUiItem {
        let mut meta = self.meta.take().expect_log_err("UiImageBuilder: no meta.");
        // Convert relative position to absolute position.
        match meta.relative_size {
            Some(rsize) => {
                let abs_size = {
                    let extent = self.ctx.config().graphics().extent();
                    Vec2f::from(*extent).component_mul(&rsize)
                };
                meta.absolute_size = abs_size;
            }
            None => {}
        }
        // TODO: support relative size.
        // Create quad for this UiItem.
        meta.quad = Some(make_rectangle(&meta.absolute_position, &meta.absolute_size));
        // Load texture
        let image = self.image_path.expect_log_err(format!(
            "UiImage {}: does not have image path.",
            meta.id_str()
        ));
        let tex_handle = load_texture(self.ctx, &image).expect_log_err(format!(
            "UiImage {}: failed to load image {}.",
            meta.id_str(),
            image
        ));
        meta.texture = TextureEntry::Owned(tex_handle);
        let item = Box::new(UiImage { meta, border: 0 });
        item
    }
pub fn build ( mut self ) -> BoxedUiItem { let mut meta = self . meta . take ( ) . expect_log_err ( " " ) ; // Convert relative position to absolute position. match meta . relative_size { Some ( rsize ) => { let abs_size = { let extent = self . ctx . config ( ) . graphics ( ) . extent ( ) ; Vec2f :: from ( * extent ) . component_mul ( & rsize ) } ; meta . absolute_size = abs_size ; } None => { } } // TODO: support relative size. // Create quad for this UiItem. meta . quad = Some ( make_rectangle ( & meta . absolute_position , & meta . absolute_size ) ) ; // Load texture let image = self . image_path . expect_log_err ( format ! ( " " meta id_str ( ) ) ) ; let tex_handle = load_texture ( self . ctx , & image ) . expect_log_err ( format ! ( " " meta id_str ( ) image ) ) ; meta . texture = TextureEntry :: Owned ( tex_handle ) ; let item = Box :: new ( UiImage { meta , border : 0 } ) ; item }
Consume this builder, make UiItem and UiRenderable.
Consume this builder make UiItem and UiRenderable .
mut self
mut self