Skip to content

Commit 67f7087

Browse files
authored
Merge pull request #13 from VerzatileDev/main
[Add] / [FIX] > Image / Warnings / Alignment - Stable
2 parents 571222f + 332ccbf commit 67f7087

File tree

3 files changed

+174
-50
lines changed

3 files changed

+174
-50
lines changed

README.md

Lines changed: 103 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,37 @@
1-
# C Image Processing
1+
# Table of Contents
2+
3+
* [Introduction](#introduction)
4+
* [Software Information](#software-information)
5+
* [Examples](#examples)
6+
* [Contribution](#contribution)
7+
* [Installation](#installation)
8+
* [Cloning via Terminal](#cloning-via-terminal)
9+
* [Cloning via GitHub Desktop](#cloning-via-github-desktop)
10+
* [Prerequisites](#prerequisites)
11+
* [Project Requirements](#project-requirements)
12+
* [Fonts](#fonts)
13+
* [License](#license)
14+
15+
</br>
16+
17+
# Introduction
18+
19+
20+
This initiative aims to develop an extensive and robust library of image processing functions, implemented in the C programming language. The ultimate objective is to establish a versatile platform capable of ingesting PPM images, executing a range of filters and transformations, and subsequently generating a modified image file. It is important to note that this project is currently in active development, with ongoing efforts to enhance its capabilities.
21+
22+
</br>
23+
24+
### Software Information
25+
26+
* Developed with " C " Programming Language
27+
* Development Setup and Wiki built for Visual Studio Code
28+
* Uses Libraries such as " GTK4 ", " JpegLib ", "PngLib ", Additional added in the future.
29+
30+
</br>
31+
32+
### Examples
33+
34+
</br>
235

336
<p align="center">
437
<img src="readme_images/readme_image_0.png" width="200" height="300"/>
@@ -11,24 +44,83 @@
1144
<img src="readme_images/readme_image_7.png" width="200" height="300"/>
1245
</p>
1346

14-
This program is to builds a simple library of image processing functions in C. The library is then used to create a program that can read in a PPM image, apply a filter to it, and then write the modified image to a new file.
47+
</br>
48+
49+
## Contribution
50+
51+
To contribute to `c_image_processing`, please follow these steps:
52+
53+
1. Fork the repository to your own account.
54+
2. Create a feature branch for your contributions.
55+
3. Make your desired changes and commit them to your feature branch.
56+
4. Read the comprehensive setup documentation available in the repository's wiki.
57+
5. Submit a pull request from your feature branch to the main repository.
58+
59+
60+
We appreciate your contributions and look forward to reviewing your pull request
61+
62+
</br>
1563

16-
# Fonts
1764

18-
The fonts used in this program, are available here:
65+
## Installation
1966

20-
<a href="https://www.dafont.com/bignoodletitling.font">
67+
### Cloning via Terminal:
68+
69+
```bash
70+
71+
Open your terminal and navigate to the directory where you want to clone the repository
72+
cd /desired/directory
73+
74+
Clone the repository
75+
git clone https://github.com/VerzatileDevOrg/C_image_processing
76+
77+
Move into the cloned directory
78+
cd C_image_processing
79+
80+
```
81+
82+
### Cloning via GitHub Desktop:
83+
84+
1. Open GitHub Desktop and ensure you're logged in to your GitHub account.
85+
2. Click on the "+" button in the top left corner and select "Clone Repository".
86+
3. In the "Clone a Repository" window, select the "URL" tab.
87+
4. Paste the repository URL: https://github.com/VerzatileDevOrg/C_image_processing.
88+
5. Choose a local path for the repository.
89+
6. Click on "Clone Repository" to complete the process.
90+
91+
This will clone the repository to your local machine, allowing you to work with the codebase.
92+
93+
</br>
94+
95+
## Prerequisites
96+
97+
### Project Requirements:
98+
99+
1. Visual studio Code.
100+
2. `Windows 10` or Newer.
101+
3. Installation of `C` Language.
102+
4. Setup of GTK4, Jpeg, Png Libraries.
103+
104+
</br>
105+
106+
### Fonts
107+
108+
The typefaces employed in this program can be obtained from the following source:
109+
110+
* <a href="https://www.dafont.com/bignoodletitling.font">
21111
Big Noodle Titling
22112
</a>
23113

24-
# Contribution
114+
</br>
115+
116+
## License
25117

26-
If you'd like to contribute to `c_image_processing` please submit a pull-request on a feature branch.
118+
MIT License
27119

28-
# Installing
120+
Copyright (c) 2023 VerzatileDevOrg (Sommos / Verzatildev )
29121

30-
Clone the repo:
122+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
31123

32-
git clone https://github.com/VerzatileDevOrg/C_image_processing
124+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
33125

34-
cd c_image_processing
126+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

src/assets/images/arrow.png

40.8 KB
Loading

src/gtk_gui.c

Lines changed: 71 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -106,27 +106,27 @@ static void activate(GtkApplication *app, gpointer user_data)
106106
*button_box0, *button_box1, *button0, *button1, *button2,
107107
*button3, *button4, *button5, *button6, *button7;
108108
const char *css = "window {"
109-
" background-color: #FFFFE4;"
110-
"}"
111-
"headerbar.titlebar {"
112-
" font-family: BigNoodleTitling;"
113-
" font-size: 36px;"
114-
" color: black;"
115-
" background-color: #4CAF50;"
116-
" border: none;"
117-
" padding: 10px 20px;"
118-
" text-decoration: none;"
119-
"}"
120-
"button {"
121-
" background-color: #4CAF50;"
122-
" color: black;"
123-
" 2px solid #008CBA;"
124-
" padding: 10px 20px;"
125-
" text-decoration: none;"
126-
" font-size: 22px;"
127-
" margin: 8px 5px;"
128-
" font-family: BigNoodleTitling;"
129-
"}";
109+
" background-color: #FFFFE4;"
110+
"}"
111+
"headerbar.titlebar {"
112+
" font-family: 'BigNoodleTitling', 'Sans';"
113+
" font-size: 36px;"
114+
" color: black;"
115+
" background-color: #4CAF50;"
116+
" border: none;"
117+
" padding: 10px 20px;"
118+
" text-decoration: none;"
119+
"}"
120+
"button {"
121+
" background-color: #4CAF50;"
122+
" color: black;"
123+
" border: 2px solid #008CBA;"
124+
" padding: 10px 20px;"
125+
" text-decoration: none;"
126+
" font-size: 22px;"
127+
" margin: 8px 5px;"
128+
" font-family: 'BigNoodleTitling', 'Sans';"
129+
"}";
130130
FilterButtonInfo filter_buttons[] = {
131131
{"Black And White Filter", black_and_white_filter_apply},
132132
{"Bright Filter", bright_filter_apply},
@@ -147,42 +147,74 @@ static void activate(GtkApplication *app, gpointer user_data)
147147
// create new vertical box container
148148
box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
149149
gtk_widget_set_halign(box, GTK_ALIGN_CENTER);
150-
gtk_widget_set_valign(box, GTK_ALIGN_END);
150+
gtk_widget_set_valign(box, GTK_ALIGN_CENTER);
151151
// include box container in window
152152
gtk_window_set_child(GTK_WINDOW(window), box);
153153

154-
// create new horizontal box container for user image
155-
user_image_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
154+
// create a horizontal box container for the images
155+
GtkWidget *image_container = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
156+
gtk_widget_set_halign(image_container, GTK_ALIGN_CENTER);
157+
gtk_widget_set_valign(image_container, GTK_ALIGN_CENTER);
158+
// append the image container to the main vertical box
159+
gtk_box_append(GTK_BOX(box), image_container);
160+
161+
// Create a vertical box container for the user image
162+
user_image_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
156163
gtk_widget_set_halign(user_image_box, GTK_ALIGN_CENTER);
157164
gtk_widget_set_valign(user_image_box, GTK_ALIGN_CENTER);
158-
gtk_widget_set_margin_bottom(user_image_box, 20);
159-
// append user image box to vertical box
160-
gtk_box_append(GTK_BOX(box), user_image_box);
161-
// create image widget
165+
// append the user image container to the horizontal image container
166+
gtk_box_append(GTK_BOX(image_container), user_image_box);
167+
168+
// create image widget for user image
162169
image = gtk_image_new_from_file("assets/images/test_image.bmp");
163170
gtk_image_set_pixel_size(GTK_IMAGE(image), 250);
164-
// append user image widget to user image box
171+
// set horizontal alignment to center for the image
172+
gtk_widget_set_halign(image, GTK_ALIGN_CENTER);
173+
// append the user image widget to the user image container
165174
gtk_box_append(GTK_BOX(user_image_box), image);
166175

167-
// create new horizontal box container for filtered image
168-
filtered_image_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
176+
// set a top margin for the user image to raise it within the layout
177+
gtk_widget_set_margin_top(image, 50);
178+
179+
GtkWidget *new_image = gtk_image_new_from_file("assets/images/arrow.png");
180+
gtk_image_set_pixel_size(GTK_IMAGE(new_image), 250);
181+
gtk_widget_set_halign(new_image, GTK_ALIGN_CENTER);
182+
183+
// create a new container for the new image
184+
GtkWidget *new_image_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
185+
gtk_widget_set_halign(new_image_box, GTK_ALIGN_CENTER);
186+
gtk_widget_set_valign(new_image_box, GTK_ALIGN_CENTER);
187+
gtk_box_append(GTK_BOX(image_container), new_image_box);
188+
189+
// append the new image widget to the new image container
190+
gtk_box_append(GTK_BOX(new_image_box), new_image);
191+
gtk_widget_set_margin_top(new_image, 50);
192+
193+
// create a vertical box container for the filtered image
194+
filtered_image_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
169195
gtk_widget_set_halign(filtered_image_box, GTK_ALIGN_CENTER);
170196
gtk_widget_set_valign(filtered_image_box, GTK_ALIGN_CENTER);
171-
gtk_widget_set_margin_bottom(filtered_image_box, 20);
172-
// append filtered image box to vertical box
173-
gtk_box_append(GTK_BOX(box), filtered_image_box);
174-
// create image widget
197+
// append the filtered image container to the horizontal image container
198+
gtk_box_append(GTK_BOX(image_container), filtered_image_box);
199+
200+
// create image widget for filtered image
175201
image = gtk_image_new_from_file("assets/images/test_image.bmp");
176202
gtk_image_set_pixel_size(GTK_IMAGE(image), 250);
177-
// append user image widget to filtered image box
203+
// set horizontal alignment to center for the image
204+
gtk_widget_set_halign(image, GTK_ALIGN_CENTER);
205+
// append the filtered image widget to the filtered image container
178206
gtk_box_append(GTK_BOX(filtered_image_box), image);
179207

208+
// set a top margin for the filtered image to raise it within the layout
209+
gtk_widget_set_margin_top(image, 50);
210+
180211
// create new horizontal box container for buttons
181212
button_box0 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
182213
gtk_widget_set_halign(button_box0, GTK_ALIGN_CENTER);
183214
gtk_widget_set_valign(button_box0, GTK_ALIGN_CENTER);
184215
// append button box to vertical box
185216
gtk_box_append(GTK_BOX(box), button_box0);
217+
gtk_widget_set_margin_top(button_box0, 100); // temp
186218

187219
// create new horizontal box container for buttons
188220
button_box1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
@@ -201,9 +233,9 @@ static void activate(GtkApplication *app, gpointer user_data)
201233
gtk_css_provider_load_from_string(provider, css);
202234
// add CSS provider to default display
203235
gtk_style_context_add_provider_for_display(
204-
gdk_display_get_default(),
205-
GTK_STYLE_PROVIDER(provider),
206-
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
236+
gdk_display_get_default(),
237+
GTK_STYLE_PROVIDER(provider),
238+
GTK_STYLE_PROVIDER_PRIORITY_USER);
207239

208240
// show window
209241
gtk_widget_set_visible(window, TRUE);

0 commit comments

Comments
 (0)