Skip to content
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

Define structs and data types #2

Merged
merged 2 commits into from
Apr 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ BreakBeforeBraces: Attach
ColumnLimit: 160
SpaceAfterTemplateKeyword: true
Standard: c++20
TabWidth: 4
IndentWidth: 4
TabWidth: 2
IndentWidth: 2
UseTab: Always
AllowShortEnumsOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
Expand Down
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[*]
insert_final_newline = true
charset = utf-8
indent_size = 4
indent_size = 2
indent_style = tab
# Optional: git will commit as lf, this will only affect local files
end_of_line = lf
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ project(image-exporter)

add_executable(${PROJECT_NAME})
target_sources(${PROJECT_NAME} PRIVATE
src/export.h
src/export.cpp
src/main.cpp
)

Expand Down
1 change: 1 addition & 0 deletions src/export.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "export.h"
26 changes: 26 additions & 0 deletions src/export.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#pragma once

#include <vector>
#include <span>
#include <cstdint>

using std::uint8_t;
using std::uint32_t;

struct Rgba
{
uint8_t r{0}, g{0}, b{0}, a{0};
};

struct Extent
{
uint32_t width{0}, height{0};
};

struct Image
{
std::vector<Rgba> pixels;
Extent extent;
};

Image upscale(std::span<Rgba const> input, uint32_t scale);
12 changes: 11 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
int main() {}
#include "export.h"

constexpr uint32_t image_width_v = 512;
constexpr uint32_t image_height_v = 512;
constexpr uint32_t input_extent_v = 1;
constexpr uint32_t output_extent_v = 32;

int main()
{
return 0;
}