Start on image rendering
This commit is contained in:
parent
201b923248
commit
96ade8668f
13 changed files with 510 additions and 75 deletions
|
@ -21,7 +21,7 @@ use gpui::{
|
|||
json::to_string_pretty,
|
||||
keymap::Binding,
|
||||
platform::WindowOptions,
|
||||
AnyViewHandle, AppContext, ClipboardItem, Entity, ModelHandle, MutableAppContext,
|
||||
AnyViewHandle, AppContext, ClipboardItem, Entity, ImageData, ModelHandle, MutableAppContext,
|
||||
PathPromptOptions, PromptLevel, RenderContext, Task, View, ViewContext, ViewHandle,
|
||||
WeakModelHandle,
|
||||
};
|
||||
|
@ -354,10 +354,19 @@ pub struct Workspace {
|
|||
(usize, Arc<Path>),
|
||||
postage::watch::Receiver<Option<Result<Box<dyn ItemHandle>, Arc<anyhow::Error>>>>,
|
||||
>,
|
||||
image: Arc<ImageData>,
|
||||
}
|
||||
|
||||
impl Workspace {
|
||||
pub fn new(app_state: &AppState, cx: &mut ViewContext<Self>) -> Self {
|
||||
let image_bytes = crate::assets::Assets::get("images/as-cii.jpeg").unwrap();
|
||||
let image = image::io::Reader::new(std::io::Cursor::new(&*image_bytes.data))
|
||||
.with_guessed_format()
|
||||
.unwrap()
|
||||
.decode()
|
||||
.unwrap()
|
||||
.into_bgra8();
|
||||
|
||||
let pane = cx.add_view(|_| Pane::new(app_state.settings.clone()));
|
||||
let pane_id = pane.id();
|
||||
cx.subscribe(&pane, move |me, _, event, cx| {
|
||||
|
@ -401,6 +410,7 @@ impl Workspace {
|
|||
worktrees: Default::default(),
|
||||
items: Default::default(),
|
||||
loading_items: Default::default(),
|
||||
image: ImageData::new(image),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -954,17 +964,16 @@ impl View for Workspace {
|
|||
Flex::column()
|
||||
.with_child(
|
||||
ConstrainedBox::new(
|
||||
Container::new(
|
||||
Align::new(
|
||||
Label::new(
|
||||
"zed".into(),
|
||||
theme.workspace.titlebar.label.clone()
|
||||
).boxed()
|
||||
)
|
||||
.boxed()
|
||||
)
|
||||
.with_style(&theme.workspace.titlebar.container)
|
||||
.boxed(),
|
||||
Image::new(self.image.clone()).boxed()
|
||||
// Container::new(
|
||||
// Align::new(
|
||||
// Label::new("zed".into(), theme.workspace.titlebar.label.clone())
|
||||
// .boxed(),
|
||||
// )
|
||||
// .boxed(),
|
||||
// )
|
||||
// .with_style(&theme.workspace.titlebar.container)
|
||||
// .boxed(),
|
||||
)
|
||||
.with_height(32.)
|
||||
.named("titlebar"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue