-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IV Kitten Development - A Dynamically Recursive Image Grid Layout for Kitty Terminal #7674
base: master
Are you sure you want to change the base?
IV Kitten Development - A Dynamically Recursive Image Grid Layout for Kitty Terminal #7674
Conversation
Signed-off-by: swastik <[email protected]>
- Add PlaceImageInGrid function to handle image positioning in grid - Integrate with globalImageBound and globalWindowParameters - Implement coordinate conversion from logical to actual grid positions - Calculate grid cell dimensions based on window size and grid parameters - Add image loading and decoding functionality - Integrate ScaleAndCenterImage for proper image sizing and centering - Calculate final image position within the grid - Handle errors for file operations and image processing - Return scaled image and its final position for rendering This commit introduces the core functionality for placing images in a grid layout. PlaceImageInGrid dynamically calculates image positions, handles scaling and centering, and prepares images for display in the terminal. It forms the foundation for the image viewing functionality in our kitty-based image viewer.
Implement PlaceImageInGrid for dynamic image placement
added: /kittens/iv/main_test.go
Cool, congrats on getting to an MVP in the two days. Now if you want this to become mergeable into kitty, you will need to refactor various parts of it to use the kitty kittens infrastructure.
When you run make kitty build system will automatically generate the code to parse the command line and provide you with a parsed options object.
|
Here this commit shows you how to integrate a kitten into the kitty kittens CLI parsing framework. Run it with kitten notify -h |
Great Thanks alot for the feedback Kovid :) ... |
Thanks, Kovid for the feedback. It was awesome working on the MVP, will keep working on it. Also thanks for the detailed instructions. |
No I dont have any deadline in mind. To me its far more important it be done well than done fast. |
@kovidgoyal Is there any documentation on how /kitty/cli works and how it's interfaced properly? I have seen the icat's source code and it's somewhat clearer but some resources to define it and explain it would help a lot. Also, let me know where are the same resources for others like keyboard and mouse interactions. |
There is no documentation for internal kitty interfaces I'm afraid. If As my commit above shows, all you need to above is define the options in |
Okay @kovidgoyal, I will refer to the source code for it. Would you also like for me to create some docs once I understand this procedure into official docs for future reference to other developers? |
On Thu, Aug 01, 2024 at 03:49:09AM -0700, Aditya Patil wrote:
Okay @kovidgoyal, I will refer to the source code for it. Would you also like for me to create some docs once I understand this procedure into official docs for future reference to other developers?
Sure docs are always good :)
|
dc27691
to
63df210
Compare
Introduction to IV Kitten - Project by Team /dev/null
IV kitten is fully implemented in Golang which recursively searches for images in the given directory and prints them on the kitty terminal using Kitty Graphical Protocol as mentioned in the kovidgoyal/kitty-fosshack2024#4 for FOSSHack 2024 by Team /dev/null.
The IV kitten is a highly productive image-searching kitten for Kitty Terminal for Power Users. It harnesses the power of Golang with the speed and security of code. We have taken references from Game Development and knowledge of Computer Graphics because of the highly dynamic parameters that change in the background. We have made use of multi-threaded programming to keep keyboard input controls and terminal window size responsive in the background with Golang's powerful Concurrency and Unix's system calls to interrupt the main thread with handlers.
Concurrent Programming with Golang
We believe in multi-threaded code for faster performance in terminals like Kitty and made sure that we harness the goroutines. Since keyboard and window sizes are variable and have unexpected inputs at any time, having a handler to acknowledge these inputs and interrupt the main thread is necessary. So we did low-level interactions with kernel drivers for keyboard input as well as used system calls for interrupts related to resizing the window.
Globally defined Data-Structures
Since we have taken inspiration from computer graphics and game development, we have heavily defined data structures to be accessible globally by any function where it's required which helps in acknowledging variations in the program. We have made use of structs for keeping track of various parameters like Grid Parameters, Window Parameters, Configuration files, Navigation Parameters, Image Boundaries, etc.
Functional Programming Paradigm
Unix Philosophy is "Do one thing and do it right" and by adhering to the principle, we made all the functions to one task at a time. This allows almost all functionalities to have access to the globally declared data. Also, wherever we can (in future), can get these functions in goroutines.
Grid Implementation and Rendering
Rendering had a huge deal of mathematics and geometry in it. We have tried implementing them in the form of code, which in 2 days was not feasible even for 4 of us. A large amount of work has been accomplished in this term, but we would be continuing the make efforts to ensure we complete it till the end.
Future Development
This was a heavy project to complete in 2 days. So we have planned to dedicate time to further expand on and develop the current code base. Since it's MVP, we would be working on fixing bugs and issues, making sure that this kitten reaches the production environment.
Signed-off-Aditya [email protected]