diff --git a/src/abr.cpp b/src/abr.cpp index ebb10a1..8fc01d5 100644 --- a/src/abr.cpp +++ b/src/abr.cpp @@ -116,7 +116,7 @@ std::vector> ABR::compute_brushes(const std::string& path b->m_tip_spacing = samp->value("Spcn") * 0.01f; b->m_tip_flow = .25f; b->m_tip_opacity = 1.f; - b->m_tip_angle = glm::radians(samp->value("Angl")); + b->m_tip_angle = samp->value("Angl") / 360.f + 0.5f; // [-180,180] -> [0, 1] //b->m_tip_mix = i.m_tip_mix; //b->m_tip_stencil = i.m_tip_stencil; b->m_tip_wet = p->value("Wtdg"); diff --git a/src/app_shaders.cpp b/src/app_shaders.cpp index 0c967d9..8e514f7 100644 --- a/src/app_shaders.cpp +++ b/src/app_shaders.cpp @@ -207,7 +207,7 @@ void App::initShaders() "uniform sampler2D tex;\n" "uniform sampler2D tex_stroke;\n" "uniform sampler2D tex_mask;\n" - "uniform sampler2D tex_stencil;\n" + //"uniform sampler2D tex_stencil;\n" "uniform mediump float alpha;\n" "uniform mediump float stroke_alpha;\n" "uniform mediump int blend_mode;\n" diff --git a/src/image.cpp b/src/image.cpp index 897398b..f098573 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -120,7 +120,7 @@ Image Image::resize_power2() const return resize(w, h); } -Image Image::resize_squared() const +Image Image::resize_squared(const glm::u8vec4& bg) const { Image ret; if (width == height) @@ -146,7 +146,7 @@ Image Image::resize_squared() const ret.create(size, size); auto ptr_src = reinterpret_cast(m_data.get()); auto ptr_dst = reinterpret_cast(ret.m_data.get()); - std::fill_n(ptr_dst, size * size, glm::u8vec4(0)); + std::fill_n(ptr_dst, size * size, bg); for (int y = 0; y < height; y++) std::copy_n(ptr_src + y * width, width, ptr_dst + pad_x + (y + pad_y) * ret.width); } diff --git a/src/image.h b/src/image.h index 5aa8b00..479f85f 100644 --- a/src/image.h +++ b/src/image.h @@ -36,5 +36,5 @@ public: void create() { m_data = std::make_unique(size()); } Image resize(int w, int h) const; Image resize_power2() const; - Image resize_squared() const; + Image resize_squared(const glm::u8vec4& bg) const; }; diff --git a/src/node_panel_brush.cpp b/src/node_panel_brush.cpp index b7af258..58b81af 100644 --- a/src/node_panel_brush.cpp +++ b/src/node_panel_brush.cpp @@ -77,8 +77,10 @@ void NodePanelBrush::init() { std::string path_high = App::I.data_path + "/brushes/" + samp.first + ".png"; std::string path_thumb = App::I.data_path + "/brushes/thumbs/" + samp.first + ".png"; - samp.second->save(path_high); - auto thumb = samp.second->resize(64, 64); + auto padded = samp.second->resize_squared(glm::u8vec4(255)); + auto high = padded.resize_power2(); + high.save(path_high); + auto thumb = padded.resize(64, 64); thumb.save(path_thumb); async_start(); @@ -123,7 +125,7 @@ void NodePanelBrush::init() std::string path_high = App::I.data_path + "/brushes/" + name + ".png"; std::string path_thumb = App::I.data_path + "/brushes/thumbs/" + name + ".png"; - img = img.resize_squared(); + img = img.resize_squared(glm::u8vec4(255)); img.gayscale_alpha(); auto thumb = img.resize(64, 64);