Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
708b6bdb1b | ||
|
|
520c7c45fb | ||
|
|
b9f905e04c | ||
|
|
431fcf9c58 | ||
|
|
9fb4428a3b | ||
|
|
7d122ddd6c | ||
|
|
536b8620ea |
@@ -5,3 +5,7 @@ compile_commands.json
|
|||||||
__pycache__/
|
__pycache__/
|
||||||
*.o
|
*.o
|
||||||
*.a
|
*.a
|
||||||
|
packaging/arch/effector/
|
||||||
|
packaging/arch/src/
|
||||||
|
packaging/arch/pkg/
|
||||||
|
packaging/arch/*.pkg.tar*
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
Every release of Effector, newest first. The version lives in one place, the
|
||||||
|
`project()` line of `CMakeLists.txt`, and each release is a `vX.Y.Z` tag on the
|
||||||
|
commit that made it. The interface shows this file under Changelog in its menu.
|
||||||
|
|
||||||
|
## [0.5.2] - 2026-09-26
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Effector is free software under the GNU General Public License, version 3
|
||||||
|
or later; the `LICENSE` file holds the text, and About Effector says so.
|
||||||
|
|
||||||
|
## [0.5.1] - 2026-09-26
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- An Arch Linux `PKGBUILD` in `packaging/arch`: `makepkg -si` there builds and
|
||||||
|
installs the tagged release with pacman.
|
||||||
|
- A desktop entry, so an installed Effector shows up in the app menu.
|
||||||
|
|
||||||
|
## [0.5.0] - 2026-09-26
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- A version number: `effector --version` prints it, and About Effector in the
|
||||||
|
menu shows it.
|
||||||
|
- This changelog, readable from the interface under Changelog in the menu.
|
||||||
|
- Open Recent in the project menu, listing the projects opened or saved here.
|
||||||
|
- An optional shadow or glow under the image overlay, with an offset, size,
|
||||||
|
spread, colour and opacity.
|
||||||
|
- Reordering the chain by dragging a row.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- The params' scrollbar no longer covers the spin buttons.
|
||||||
|
|
||||||
|
## [0.4.0] - 2026-09-23
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Eight chaotic effects: slit shift, channel split, pixel sort, corruption,
|
||||||
|
shatter, warp, bit crush and feedback. None needs sources, so any of them can
|
||||||
|
lead a chain.
|
||||||
|
- The sidebar split into Chain and Setup tabs.
|
||||||
|
- A rotation for the text effect's placement.
|
||||||
|
- Text stages labelled in the chain list with their words.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- The preview stays centred however long the status line gets.
|
||||||
|
- The status line stays short, with the full chain and setup in its tooltip.
|
||||||
|
- The chain/params split fits the chain's rows until it is dragged; a
|
||||||
|
double-click on the handle fits it again.
|
||||||
|
- The mouse wheel scrolls past spin buttons that do not have the focus.
|
||||||
|
|
||||||
|
## [0.3.0] - 2026-09-19
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Named styles: several text stages can share one font and colour, and editing
|
||||||
|
the style moves every stage that follows it.
|
||||||
|
- Switching a chain stage off without taking it apart, in the interface and
|
||||||
|
with `--disable NAME` on the command line.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- The interface opens on an empty chain, and shows the sources only when the
|
||||||
|
chain uses them.
|
||||||
|
|
||||||
|
## [0.2.0] - 2026-09-18
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Effect chains: stages cascade, each handed the previous one's output, built in
|
||||||
|
the sidebar or with repeated `-e`.
|
||||||
|
- Blur, film grain, black and white, image overlay, text and tiles effects.
|
||||||
|
- Projects saved and opened as plain JSON.
|
||||||
|
- Standard web and print canvas formats (`--format`, `--dpi`).
|
||||||
|
- Effects declare whether they need source images, so a chain led by blur
|
||||||
|
renders with none loaded.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- The chain comes first in the sidebar.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- The canvas size is checked before it is narrowed to an int.
|
||||||
|
- Projects are written and read in the C locale, and keep the seed whole.
|
||||||
|
|
||||||
|
## [0.1.0] - 2026-09-18
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- The C++20 port of the Python prototype: a GTK 4 interface and a headless
|
||||||
|
command line over pluggable effects, starting with scanlines.
|
||||||
|
- Source images load in the background, with a progress window and Cancel.
|
||||||
@@ -33,6 +33,22 @@ Headless render (no display needed, the fastest end-to-end smoke test):
|
|||||||
build/effector -o /tmp/out.png -s 800x600 --strip-height 6 --seed 1 a.jpg b.png
|
build/effector -o /tmp/out.png -s 800x600 --strip-height 6 --seed 1 a.jpg b.png
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Versions and the changelog
|
||||||
|
|
||||||
|
The version is the `project()` line of `CMakeLists.txt`, and nowhere else.
|
||||||
|
CMake writes it, together with the text of `CHANGELOG.md`, into a generated
|
||||||
|
`core/version.hpp` (`kVersion`, `kChangelog`, from `src/core/version.hpp.in`)
|
||||||
|
in the build tree. `--version` prints it, and the header-bar menu shows it
|
||||||
|
under About Effector and the changelog under Changelog. The `version` core test
|
||||||
|
fails unless the newest `## [X.Y.Z]` entry in `CHANGELOG.md` is the current
|
||||||
|
version, so a bump and its changelog entry go in together, and it also fails unless
|
||||||
|
`pkgver` in `packaging/arch/PKGBUILD` matches (that PKGBUILD builds the
|
||||||
|
`vX.Y.Z` tag, so reset `pkgrel=1` on a bump). Each release is an
|
||||||
|
annotated `vX.Y.Z` tag on the commit that made it. When you add a user-visible
|
||||||
|
change, add a line to the newest changelog entry, or start a new entry if that
|
||||||
|
one is already tagged. The Changelog window reads only headings, `- ` bullets
|
||||||
|
(wrapped onto indented lines) and `` `code` ``, so keep the file to those.
|
||||||
|
|
||||||
### Running the GUI from this shell
|
### Running the GUI from this shell
|
||||||
|
|
||||||
GTK picks Wayland from an inherited `WAYLAND_DISPLAY` and will not draw into an
|
GTK picks Wayland from an inherited `WAYLAND_DISPLAY` and will not draw into an
|
||||||
@@ -113,7 +129,7 @@ both the style and the stage for that reason. `renderChain` takes the pool as a
|
|||||||
trailing argument; the command line builds no styles and passes none.
|
trailing argument; the command line builds no styles and passes none.
|
||||||
|
|
||||||
The interface builds the chain in the sidebar ("Effect chain": add from the
|
The interface builds the chain in the sidebar ("Effect chain": add from the
|
||||||
menu, reorder, remove, switch off with the check on the row, one stage selected
|
menu, reorder by dragging a row or with its arrows, remove, switch off with the check on the row, one stage selected
|
||||||
at a time with its params below), the CLI builds it from repeated `-e`:
|
at a time with its params below), the CLI builds it from repeated `-e`:
|
||||||
`-e scanlines --strip-height 6 -e blur --radius 5`, with `--disable NAME`
|
`-e scanlines --strip-height 6 -e blur --radius 5`, with `--disable NAME`
|
||||||
leaving a stage in place but skipping it. Flags share one namespace across all effects, so `buildChain`
|
leaving a stage in place but skipping it. Flags share one namespace across all effects, so `buildChain`
|
||||||
@@ -148,7 +164,10 @@ can be moved or shared whole.
|
|||||||
|
|
||||||
The interface opens and saves projects from the header-bar menu (New, Open,
|
The interface opens and saves projects from the header-bar menu (New, Open,
|
||||||
Save, Save As, with the usual Ctrl+N/O/S accelerators); the window title shows
|
Save, Save As, with the usual Ctrl+N/O/S accelerators); the window title shows
|
||||||
the project name. Opening one replaces the sources, so a decode still in flight
|
the project name. Open Recent lists the projects opened or saved here, kept in
|
||||||
|
GTK's shared `RecentManager` list and told apart from other programs' files by
|
||||||
|
the `effector` application name on each entry; the GUI tests point
|
||||||
|
`XDG_DATA_HOME` at a temporary folder so they never touch the user's list. Opening one replaces the sources, so a decode still in flight
|
||||||
is discarded rather than mixed into the new project (`dropLoadedImages_`).
|
is discarded rather than mixed into the new project (`dropLoadedImages_`).
|
||||||
|
|
||||||
### Two link targets, deliberately
|
### Two link targets, deliberately
|
||||||
|
|||||||
+12
-2
@@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
project(effector VERSION 0.1.0 LANGUAGES CXX)
|
project(effector VERSION 0.5.2 LANGUAGES CXX)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
@@ -21,6 +21,14 @@ pkg_check_modules(PANGOCAIRO REQUIRED IMPORTED_TARGET pangocairo)
|
|||||||
|
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
|
# --- version: the one number, and the changelog that goes with it ------------
|
||||||
|
# The version is the project() line above; each release is a vX.Y.Z tag on the
|
||||||
|
# commit that set it. CHANGELOG.md is baked in so the interface can show it,
|
||||||
|
# and editing it re-runs the configure step.
|
||||||
|
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/CHANGELOG.md EFFECTOR_CHANGELOG)
|
||||||
|
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS CHANGELOG.md)
|
||||||
|
configure_file(src/core/version.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/generated/core/version.hpp @ONLY)
|
||||||
|
|
||||||
# --- core: effects and image handling, no GUI ---------------------------------
|
# --- core: effects and image handling, no GUI ---------------------------------
|
||||||
add_library(effector_core STATIC
|
add_library(effector_core STATIC
|
||||||
src/core/canvas.cpp
|
src/core/canvas.cpp
|
||||||
@@ -48,7 +56,7 @@ add_library(effector_core STATIC
|
|||||||
src/effects/tiles.cpp
|
src/effects/tiles.cpp
|
||||||
src/effects/warp.cpp
|
src/effects/warp.cpp
|
||||||
)
|
)
|
||||||
target_include_directories(effector_core PUBLIC src)
|
target_include_directories(effector_core PUBLIC src ${CMAKE_CURRENT_BINARY_DIR}/generated)
|
||||||
# The core is GUI-free: it only needs gdk-pixbuf for decoding and encoding,
|
# The core is GUI-free: it only needs gdk-pixbuf for decoding and encoding,
|
||||||
# so headless rendering works without a display.
|
# so headless rendering works without a display.
|
||||||
target_link_libraries(effector_core PUBLIC PkgConfig::GDKPIXBUF PkgConfig::PANGOCAIRO Threads::Threads)
|
target_link_libraries(effector_core PUBLIC PkgConfig::GDKPIXBUF PkgConfig::PANGOCAIRO Threads::Threads)
|
||||||
@@ -69,6 +77,8 @@ target_link_libraries(effector PRIVATE effector_gui)
|
|||||||
target_compile_options(effector PRIVATE -Wall -Wextra -Wpedantic)
|
target_compile_options(effector PRIVATE -Wall -Wextra -Wpedantic)
|
||||||
|
|
||||||
install(TARGETS effector RUNTIME DESTINATION bin)
|
install(TARGETS effector RUNTIME DESTINATION bin)
|
||||||
|
# The launcher entry, so the interface shows up in the desktop's app menu.
|
||||||
|
install(FILES data/org.effector.Effector.desktop DESTINATION share/applications)
|
||||||
|
|
||||||
# --- tests --------------------------------------------------------------------
|
# --- tests --------------------------------------------------------------------
|
||||||
include(CTest)
|
include(CTest)
|
||||||
|
|||||||
@@ -0,0 +1,232 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
“This License” refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||||
|
|
||||||
|
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
|
||||||
|
|
||||||
|
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
|
||||||
|
|
||||||
|
A “covered work” means either the unmodified Program or a work based on the Program.
|
||||||
|
|
||||||
|
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
|
||||||
|
|
||||||
|
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||||
|
|
||||||
|
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||||
|
|
||||||
|
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
|
||||||
|
|
||||||
|
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||||
|
|
||||||
|
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||||
@@ -19,12 +19,20 @@ ctest --test-dir build --output-on-failure
|
|||||||
The binary lands at `build/effector`; `cmake --install build --prefix ~/.local`
|
The binary lands at `build/effector`; `cmake --install build --prefix ~/.local`
|
||||||
installs it to `~/.local/bin`.
|
installs it to `~/.local/bin`.
|
||||||
|
|
||||||
|
On Arch, `packaging/arch/PKGBUILD` builds the release tagged `v<version>` from
|
||||||
|
this repository and installs it with pacman, desktop entry included:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd packaging/arch && makepkg -si
|
||||||
|
```
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
build/effector # GTK interface
|
build/effector # GTK interface
|
||||||
build/effector --list-effects
|
build/effector --list-effects
|
||||||
build/effector --help
|
build/effector --help
|
||||||
|
build/effector --version
|
||||||
```
|
```
|
||||||
|
|
||||||
Headless rendering, no display needed:
|
Headless rendering, no display needed:
|
||||||
@@ -60,6 +68,17 @@ batch. Small batches finish before the window would be drawn, so it only appears
|
|||||||
if the decode is still going after 250 ms. On a terminal the headless mode keeps
|
if the decode is still going after 250 ms. On a terminal the headless mode keeps
|
||||||
a single `reading n/total` line updated on stderr; redirected output stays clean.
|
a single `reading n/total` line updated on stderr; redirected output stays clean.
|
||||||
|
|
||||||
|
## Versions
|
||||||
|
|
||||||
|
Releases are listed in [CHANGELOG.md](CHANGELOG.md) and tagged `vX.Y.Z`
|
||||||
|
(`git tag -l 'v*'`). `effector --version` prints the version, and the menu in
|
||||||
|
the interface has Changelog and About Effector.
|
||||||
|
|
||||||
|
To cut a release: bump the `project()` version in `CMakeLists.txt`, move the
|
||||||
|
changes into a new `## [X.Y.Z] - date` entry at the top of `CHANGELOG.md` (the
|
||||||
|
core tests fail until the two agree), commit, and tag it:
|
||||||
|
`git tag -a vX.Y.Z -m "Effector X.Y.Z"`.
|
||||||
|
|
||||||
## Effects
|
## Effects
|
||||||
|
|
||||||
### scanlines
|
### scanlines
|
||||||
@@ -140,3 +159,14 @@ render time of the current preview in its status line.
|
|||||||
Decoding threads take the next file from a shared cursor rather than a fixed
|
Decoding threads take the next file from a shared cursor rather than a fixed
|
||||||
slice of the list, so one very large file cannot stall the files queued behind
|
slice of the list, so one very large file cannot stall the files queued behind
|
||||||
it and progress advances at a steady rate.
|
it and progress advances at a steady rate.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Copyright © 2026 Si.
|
||||||
|
|
||||||
|
Effector is free software: you can redistribute it and/or modify it under the
|
||||||
|
terms of the GNU General Public License as published by the Free Software
|
||||||
|
Foundation, either version 3 of the License, or (at your option) any later
|
||||||
|
version. It is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; see `LICENSE` for the full text. Images you render with it are yours
|
||||||
|
and are not covered by the license.
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=Effector
|
||||||
|
GenericName=Image Effects
|
||||||
|
Comment=Cascade glitch and collage effects over your photographs
|
||||||
|
Exec=effector %F
|
||||||
|
Icon=applications-graphics
|
||||||
|
Terminal=false
|
||||||
|
Categories=Graphics;2DGraphics;RasterGraphics;GTK;
|
||||||
|
MimeType=image/jpeg;image/png;image/webp;image/tiff;image/bmp;
|
||||||
|
Keywords=glitch;collage;scanlines;photo;effect;
|
||||||
|
StartupNotify=true
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
# Builds the release tagged v$pkgver from the repository this file sits in,
|
||||||
|
# so pkgver must follow the project() line of CMakeLists.txt (the version core
|
||||||
|
# test checks it). From this folder: makepkg -si
|
||||||
|
pkgname=effector
|
||||||
|
pkgver=0.5.2
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc='Image effects app: a GTK4 interface and a headless CLI over pluggable effects'
|
||||||
|
arch=('x86_64' 'aarch64')
|
||||||
|
url='https://git.plan9.uber.space/hans/effector'
|
||||||
|
license=('GPL-3.0-or-later')
|
||||||
|
depends=('gtkmm-4.0' 'gdk-pixbuf2' 'pango' 'cairo' 'glib2' 'glibc' 'gcc-libs')
|
||||||
|
makedepends=('cmake' 'ninja' 'git')
|
||||||
|
checkdepends=('xorg-server-xvfb')
|
||||||
|
source=("$pkgname::git+file://${startdir%/packaging/arch}#tag=v$pkgver")
|
||||||
|
sha256sums=('SKIP')
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cmake -S "$pkgname" -B build -G Ninja \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=/usr
|
||||||
|
cmake --build build
|
||||||
|
}
|
||||||
|
|
||||||
|
check() {
|
||||||
|
ctest --test-dir build --output-on-failure
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
DESTDIR="$pkgdir" cmake --install build
|
||||||
|
}
|
||||||
@@ -61,6 +61,8 @@ Options parseOptions(int argc, char** argv) {
|
|||||||
|
|
||||||
if (arg == "-h" || arg == "--help") {
|
if (arg == "-h" || arg == "--help") {
|
||||||
options.showHelp = true;
|
options.showHelp = true;
|
||||||
|
} else if (arg == "-V" || arg == "--version") {
|
||||||
|
options.showVersion = true;
|
||||||
} else if (arg == "--list-effects") {
|
} else if (arg == "--list-effects") {
|
||||||
options.listEffects = true;
|
options.listEffects = true;
|
||||||
} else if (arg == "-e" || arg == "--effect") {
|
} else if (arg == "-e" || arg == "--effect") {
|
||||||
@@ -184,6 +186,7 @@ std::string usage(const char* programName) {
|
|||||||
<< " --disable NAME keep this effect in the chain but skip it\n"
|
<< " --disable NAME keep this effect in the chain but skip it\n"
|
||||||
<< " --seed N random seed (default: random)\n"
|
<< " --seed N random seed (default: random)\n"
|
||||||
<< " --list-effects list available effects and exit\n"
|
<< " --list-effects list available effects and exit\n"
|
||||||
|
<< " -V, --version show the version and exit\n"
|
||||||
<< " -h, --help show this help and exit\n";
|
<< " -h, --help show this help and exit\n";
|
||||||
|
|
||||||
out << "\nCanvas formats (--format):\n";
|
out << "\nCanvas formats (--format):\n";
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ struct Options {
|
|||||||
ParamValues params; // only the keys the user actually passed
|
ParamValues params; // only the keys the user actually passed
|
||||||
bool listEffects = false;
|
bool listEffects = false;
|
||||||
bool showHelp = false;
|
bool showHelp = false;
|
||||||
|
bool showVersion = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Throws EffectError on bad input. Effect flags are generated from the
|
// Throws EffectError on bad input. Effect flags are generated from the
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
// Generated by CMake from src/core/version.hpp.in; edit that, not the copy in
|
||||||
|
// the build tree. The version comes from the project() line of CMakeLists.txt
|
||||||
|
// and the changelog from CHANGELOG.md, both read at configure time.
|
||||||
|
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
|
namespace effector {
|
||||||
|
|
||||||
|
inline constexpr std::string_view kVersion = "@PROJECT_VERSION@";
|
||||||
|
|
||||||
|
// CHANGELOG.md as it stood when the build was configured, as Markdown.
|
||||||
|
inline constexpr std::string_view kChangelog = R"changelog(@EFFECTOR_CHANGELOG@)changelog";
|
||||||
|
|
||||||
|
} // namespace effector
|
||||||
+151
-2
@@ -32,6 +32,28 @@ const std::vector<ParamSpec>& OverlayEffect::params() const {
|
|||||||
ParamSpec::makeDouble("overlay_opacity", "Opacity", 1.0, 0.0, 1.0,
|
ParamSpec::makeDouble("overlay_opacity", "Opacity", 1.0, 0.0, 1.0,
|
||||||
"How strongly the image is mixed over the input; its own "
|
"How strongly the image is mixed over the input; its own "
|
||||||
"transparency is taken into account as well."),
|
"transparency is taken into account as well."),
|
||||||
|
ParamSpec::makeChoice("overlay_halo", "Halo", "none", {"none", "shadow", "glow"},
|
||||||
|
"Draws a soft copy of the image's outline beneath it: a shadow, "
|
||||||
|
"moved by the shadow offset, or a glow all around it."),
|
||||||
|
ParamSpec::makeColor("overlay_shadow_color", "Shadow colour", "#000000",
|
||||||
|
"The colour of the shadow."),
|
||||||
|
ParamSpec::makeColor("overlay_glow_color", "Glow colour", "#ffffff",
|
||||||
|
"The colour of the glow."),
|
||||||
|
ParamSpec::makeInt("overlay_halo_size", "Halo size", 12, 0, 500,
|
||||||
|
"How far the shadow or glow fades out, in pixels; 0 gives a hard "
|
||||||
|
"edge."),
|
||||||
|
ParamSpec::makeDouble("overlay_halo_spread", "Halo spread", 0.0, 0.0, 0.9,
|
||||||
|
"Pushes the full strength of the shadow or glow out from the "
|
||||||
|
"image's edge before it starts to fade; a glow usually wants some."),
|
||||||
|
ParamSpec::makeDouble("overlay_halo_opacity", "Halo opacity", 0.75, 0.0, 1.0,
|
||||||
|
"How strongly the shadow or glow is drawn, on top of the image's "
|
||||||
|
"own opacity."),
|
||||||
|
ParamSpec::makeInt("overlay_shadow_x", "Shadow X", 8, -2000, 2000,
|
||||||
|
"Moves the shadow right by this many pixels (left when negative); "
|
||||||
|
"a glow stays centred."),
|
||||||
|
ParamSpec::makeInt("overlay_shadow_y", "Shadow Y", 8, -2000, 2000,
|
||||||
|
"Moves the shadow down by this many pixels (up when negative); a "
|
||||||
|
"glow stays centred."),
|
||||||
};
|
};
|
||||||
return specs;
|
return specs;
|
||||||
}
|
}
|
||||||
@@ -123,6 +145,44 @@ void sampleOverlay(const Image& src, const std::uint8_t* alpha, double u, double
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// One box blur pass over a line of the halo mask. Unlike the blur effect's the
|
||||||
|
// window counts zero beyond both ends, so the halo fades out at the edge of
|
||||||
|
// the mask instead of smearing its last value outwards. Integers throughout,
|
||||||
|
// so a seed reproduces the halo byte for byte on any machine.
|
||||||
|
void maskPass(const std::int32_t* in, std::int32_t* out, int count, std::size_t stride,
|
||||||
|
int radius) {
|
||||||
|
const int window = 2 * radius + 1;
|
||||||
|
std::int32_t sum = 0;
|
||||||
|
for (int i = 0; i <= radius && i < count; ++i) sum += in[static_cast<std::size_t>(i) * stride];
|
||||||
|
for (int i = 0; i < count; ++i) {
|
||||||
|
out[static_cast<std::size_t>(i) * stride] = (sum + window / 2) / window;
|
||||||
|
if (i + radius + 1 < count) sum += in[static_cast<std::size_t>(i + radius + 1) * stride];
|
||||||
|
if (i - radius >= 0) sum -= in[static_cast<std::size_t>(i - radius) * stride];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Three box passes each way, which is close enough to a gaussian: `size` is
|
||||||
|
// roughly how far the result reaches past the edge of what was covered.
|
||||||
|
void blurMask(std::vector<std::int32_t>& mask, int width, int height, int size) {
|
||||||
|
if (size <= 0) return;
|
||||||
|
const int radius = std::max(1, (size + 2) / 3);
|
||||||
|
std::vector<std::int32_t> scratch(mask.size());
|
||||||
|
for (int pass = 0; pass < 3; ++pass) {
|
||||||
|
parallelFor(static_cast<std::size_t>(height), [&](std::size_t begin, std::size_t end) {
|
||||||
|
for (std::size_t y = begin; y < end; ++y) {
|
||||||
|
const std::size_t offset = y * static_cast<std::size_t>(width);
|
||||||
|
maskPass(mask.data() + offset, scratch.data() + offset, width, 1, radius);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
parallelFor(static_cast<std::size_t>(width), [&](std::size_t begin, std::size_t end) {
|
||||||
|
for (std::size_t x = begin; x < end; ++x) {
|
||||||
|
maskPass(scratch.data() + x, mask.data() + x, height,
|
||||||
|
static_cast<std::size_t>(width), radius);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void OverlayEffect::loadOverlay(const std::string& path, Image& image,
|
void OverlayEffect::loadOverlay(const std::string& path, Image& image,
|
||||||
@@ -187,11 +247,100 @@ Image OverlayEffect::render(const std::vector<Image>& sources, int width, int he
|
|||||||
const int lastRow = tiling ? height : std::min(height, place.y + place.height);
|
const int lastRow = tiling ? height : std::min(height, place.y + place.height);
|
||||||
const int firstCol = tiling ? 0 : std::max(0, place.x);
|
const int firstCol = tiling ? 0 : std::max(0, place.x);
|
||||||
const int lastCol = tiling ? width : std::min(width, place.x + place.width);
|
const int lastCol = tiling ? width : std::min(width, place.x + place.width);
|
||||||
if (firstRow >= lastRow || firstCol >= lastCol) return canvas; // entirely off the canvas
|
|
||||||
|
|
||||||
const int mix = static_cast<int>(opacity * 255.0 + 0.5);
|
const int mix = static_cast<int>(opacity * 255.0 + 0.5);
|
||||||
const std::uint8_t* alphaData = alpha.data();
|
const std::uint8_t* alphaData = alpha.data();
|
||||||
|
|
||||||
|
// The halo goes down first, so that the image covers it wherever it is
|
||||||
|
// opaque and shows it through wherever it is not.
|
||||||
|
const std::string halo = paramChoice(values, "overlay_halo", "none");
|
||||||
|
const double haloOpacity =
|
||||||
|
std::clamp(paramDouble(values, "overlay_halo_opacity", 0.75), 0.0, 1.0);
|
||||||
|
if ((halo == "shadow" || halo == "glow") && haloOpacity > 0.0) {
|
||||||
|
const bool shadow = halo == "shadow";
|
||||||
|
const int size =
|
||||||
|
static_cast<int>(std::clamp<long>(paramInt(values, "overlay_halo_size", 12), 0, 500));
|
||||||
|
const int reach = 3 * std::max(1, (size + 2) / 3);
|
||||||
|
const int shiftX = shadow ? static_cast<int>(paramInt(values, "overlay_shadow_x", 8)) : 0;
|
||||||
|
const int shiftY = shadow ? static_cast<int>(paramInt(values, "overlay_shadow_y", 8)) : 0;
|
||||||
|
std::uint8_t colour[3];
|
||||||
|
paramColor(values, shadow ? "overlay_shadow_color" : "overlay_glow_color",
|
||||||
|
shadow ? "#000000" : "#ffffff", colour);
|
||||||
|
|
||||||
|
// The mask covers the canvas as the shadow sees it (moved back by the
|
||||||
|
// offset) plus the blur's reach, so that parts of the image lying off
|
||||||
|
// the canvas still cast onto it. Outside the image nothing is covered,
|
||||||
|
// so the mask is cut down to the image plus that reach as well.
|
||||||
|
int left = -shiftX - reach;
|
||||||
|
int top = -shiftY - reach;
|
||||||
|
int right = width - shiftX + reach;
|
||||||
|
int bottom = height - shiftY + reach;
|
||||||
|
if (!tiling) {
|
||||||
|
left = std::max(left, place.x - reach);
|
||||||
|
top = std::max(top, place.y - reach);
|
||||||
|
right = std::min(right, place.x + place.width + reach);
|
||||||
|
bottom = std::min(bottom, place.y + place.height + reach);
|
||||||
|
}
|
||||||
|
if (left < right && top < bottom) {
|
||||||
|
const int maskWidth = right - left;
|
||||||
|
const int maskHeight = bottom - top;
|
||||||
|
std::vector<std::int32_t> mask(static_cast<std::size_t>(maskWidth) * maskHeight, 0);
|
||||||
|
parallelFor(static_cast<std::size_t>(maskHeight), [&](std::size_t begin,
|
||||||
|
std::size_t end) {
|
||||||
|
int rgb[3];
|
||||||
|
int pixelAlpha = 255;
|
||||||
|
for (std::size_t i = begin; i < end; ++i) {
|
||||||
|
const int y = top + static_cast<int>(i);
|
||||||
|
if (!tiling && (y < place.y || y >= place.y + place.height)) continue;
|
||||||
|
const double v = (y - place.y + 0.5) * stepY - 0.5;
|
||||||
|
std::int32_t* out = mask.data() + i * static_cast<std::size_t>(maskWidth);
|
||||||
|
for (int x = left; x < right; ++x) {
|
||||||
|
if (!tiling && (x < place.x || x >= place.x + place.width)) continue;
|
||||||
|
const double u = (x - place.x + 0.5) * stepX - 0.5;
|
||||||
|
sampleOverlay(overlay, alphaData, u, v, tiling, rgb, pixelAlpha);
|
||||||
|
out[x - left] = pixelAlpha;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
blurMask(mask, maskWidth, maskHeight, size);
|
||||||
|
|
||||||
|
const int haloMix = static_cast<int>(haloOpacity * mix + 0.5);
|
||||||
|
// Spread amplifies the blurred mask, so the part near the edge
|
||||||
|
// saturates and only the outer rim still fades.
|
||||||
|
const double spread =
|
||||||
|
std::clamp(paramDouble(values, "overlay_halo_spread", 0.0), 0.0, 0.9);
|
||||||
|
const std::int32_t gain = static_cast<std::int32_t>(256.0 / (1.0 - spread) + 0.5);
|
||||||
|
const int fromRow = std::max(0, top + shiftY);
|
||||||
|
const int toRow = std::min(height, bottom + shiftY);
|
||||||
|
const int fromCol = std::max(0, left + shiftX);
|
||||||
|
const int toCol = std::min(width, right + shiftX);
|
||||||
|
if (fromRow < toRow && fromCol < toCol) {
|
||||||
|
parallelFor(static_cast<std::size_t>(toRow - fromRow), [&](std::size_t begin,
|
||||||
|
std::size_t end) {
|
||||||
|
for (std::size_t i = begin; i < end; ++i) {
|
||||||
|
const int y = fromRow + static_cast<int>(i);
|
||||||
|
const std::int32_t* in =
|
||||||
|
mask.data() + static_cast<std::size_t>(y - shiftY - top) * maskWidth;
|
||||||
|
std::uint8_t* out = canvas.row(y);
|
||||||
|
for (int x = fromCol; x < toCol; ++x) {
|
||||||
|
const int weight =
|
||||||
|
std::clamp<int>(in[x - shiftX - left] * gain / 256, 0, 255) *
|
||||||
|
haloMix / 255;
|
||||||
|
if (weight == 0) continue;
|
||||||
|
std::uint8_t* px = out + static_cast<std::size_t>(x) * 3;
|
||||||
|
for (int c = 0; c < 3; ++c) {
|
||||||
|
px[c] = static_cast<std::uint8_t>(
|
||||||
|
px[c] + (colour[c] - px[c]) * weight / 255);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// A shadow can reach the canvas from an image lying wholly beside it.
|
||||||
|
if (firstRow >= lastRow || firstCol >= lastCol) return canvas;
|
||||||
|
|
||||||
parallelFor(static_cast<std::size_t>(lastRow - firstRow), [&](std::size_t begin,
|
parallelFor(static_cast<std::size_t>(lastRow - firstRow), [&](std::size_t begin,
|
||||||
std::size_t end) {
|
std::size_t end) {
|
||||||
int rgb[3];
|
int rgb[3];
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ namespace effector {
|
|||||||
|
|
||||||
// Lays one picture from disk over its input: a logo, a texture, a frame. The
|
// Lays one picture from disk over its input: a logo, a texture, a frame. The
|
||||||
// overlay is fitted to the canvas in the chosen way, placed from the top left
|
// overlay is fitted to the canvas in the chosen way, placed from the top left
|
||||||
// or from the centre, nudged by an offset and mixed in by its opacity. Like the
|
// or from the centre, nudged by an offset and mixed in by its opacity, with a
|
||||||
|
// soft shadow or glow cut from its own outline beneath it if asked. Like the
|
||||||
// blur it needs no source images of its own, so it can lead a chain; given
|
// blur it needs no source images of its own, so it can lead a chain; given
|
||||||
// sources it fills the canvas from a randomly chosen one first.
|
// sources it fills the canvas from a randomly chosen one first.
|
||||||
class OverlayEffect : public Effect {
|
class OverlayEffect : public Effect {
|
||||||
@@ -20,7 +21,8 @@ public:
|
|||||||
std::string title() const override { return "Image overlay"; }
|
std::string title() const override { return "Image overlay"; }
|
||||||
std::string description() const override {
|
std::string description() const override {
|
||||||
return "Lays a single image from disk over its input, fitted to the canvas, centred or "
|
return "Lays a single image from disk over its input, fitted to the canvas, centred or "
|
||||||
"not, nudged by an offset and mixed in by its opacity.";
|
"not, nudged by an offset and mixed in by its opacity, optionally with a shadow or "
|
||||||
|
"a glow around it.";
|
||||||
}
|
}
|
||||||
const std::vector<ParamSpec>& params() const override;
|
const std::vector<ParamSpec>& params() const override;
|
||||||
bool needsSources() const override { return false; }
|
bool needsSources() const override { return false; }
|
||||||
|
|||||||
+328
-7
@@ -13,6 +13,7 @@
|
|||||||
#include "core/project.hpp"
|
#include "core/project.hpp"
|
||||||
#include "core/registry.hpp"
|
#include "core/registry.hpp"
|
||||||
#include "core/rng.hpp"
|
#include "core/rng.hpp"
|
||||||
|
#include "core/version.hpp"
|
||||||
|
|
||||||
namespace effector {
|
namespace effector {
|
||||||
namespace {
|
namespace {
|
||||||
@@ -21,6 +22,11 @@ const char* const kImagePatterns[] = {"*.png", "*.jpg", "*.jpeg", "*.webp", "*
|
|||||||
"*.tif", "*.tiff", "*.gif", "*.ppm", "*.PNG",
|
"*.tif", "*.tiff", "*.gif", "*.ppm", "*.PNG",
|
||||||
"*.JPG", "*.JPEG", "*.WEBP"};
|
"*.JPG", "*.JPEG", "*.WEBP"};
|
||||||
|
|
||||||
|
// How this program signs the entries it adds to the shared recent list, so
|
||||||
|
// Open Recent lists its projects and nothing else.
|
||||||
|
const char* const kRecentApp = "effector";
|
||||||
|
const std::size_t kRecentCount = 10;
|
||||||
|
|
||||||
Glib::RefPtr<Gio::ListStore<Gtk::FileFilter>> projectFilters() {
|
Glib::RefPtr<Gio::ListStore<Gtk::FileFilter>> projectFilters() {
|
||||||
auto filter = Gtk::FileFilter::create();
|
auto filter = Gtk::FileFilter::create();
|
||||||
filter->set_name("Effector projects");
|
filter->set_name("Effector projects");
|
||||||
@@ -108,6 +114,7 @@ EffectorWindow::EffectorWindow(const Options& initial) {
|
|||||||
EffectorWindow::~EffectorWindow() {
|
EffectorWindow::~EffectorWindow() {
|
||||||
debounce_.disconnect();
|
debounce_.disconnect();
|
||||||
chainSplitFit_.disconnect();
|
chainSplitFit_.disconnect();
|
||||||
|
recentChanged_.disconnect();
|
||||||
loadWindowDelay_.disconnect();
|
loadWindowDelay_.disconnect();
|
||||||
loadCancel_.store(true, std::memory_order_relaxed);
|
loadCancel_.store(true, std::memory_order_relaxed);
|
||||||
if (loader_.joinable()) loader_.join();
|
if (loader_.joinable()) loader_.join();
|
||||||
@@ -192,6 +199,9 @@ Gtk::Widget& EffectorWindow::buildChainTab() {
|
|||||||
params->append(paramHeading_);
|
params->append(paramHeading_);
|
||||||
paramGrid_.set_column_spacing(8);
|
paramGrid_.set_column_spacing(8);
|
||||||
paramGrid_.set_row_spacing(6);
|
paramGrid_.set_row_spacing(6);
|
||||||
|
// A gutter for the overlay scrollbar, which otherwise sits over the spin
|
||||||
|
// buttons' "+" and takes the clicks meant for it.
|
||||||
|
paramGrid_.set_margin_end(14);
|
||||||
auto* paramScroller = Gtk::make_managed<Gtk::ScrolledWindow>();
|
auto* paramScroller = Gtk::make_managed<Gtk::ScrolledWindow>();
|
||||||
paramScroller->set_policy(Gtk::PolicyType::NEVER, Gtk::PolicyType::AUTOMATIC);
|
paramScroller->set_policy(Gtk::PolicyType::NEVER, Gtk::PolicyType::AUTOMATIC);
|
||||||
paramScroller->set_child(paramGrid_);
|
paramScroller->set_child(paramGrid_);
|
||||||
@@ -1300,6 +1310,12 @@ row.stage-row:selected .stage-action,
|
|||||||
row.stage-row:focus-within .stage-action {
|
row.stage-row:focus-within .stage-action {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
row.stage-row.drop-before {
|
||||||
|
box-shadow: inset 0 2px @theme_fg_color;
|
||||||
|
}
|
||||||
|
row.stage-row.drop-after {
|
||||||
|
box-shadow: inset 0 -2px @theme_fg_color;
|
||||||
|
}
|
||||||
)css";
|
)css";
|
||||||
|
|
||||||
Gtk::Widget& EffectorWindow::buildChainSection() {
|
Gtk::Widget& EffectorWindow::buildChainSection() {
|
||||||
@@ -1330,6 +1346,34 @@ Gtk::Widget& EffectorWindow::buildChainSection() {
|
|||||||
chainList_.signal_row_selected().connect(
|
chainList_.signal_row_selected().connect(
|
||||||
[this](Gtk::ListBoxRow*) { onStageSelected(); });
|
[this](Gtk::ListBoxRow*) { onStageSelected(); });
|
||||||
|
|
||||||
|
// A row is dragged by its index (see rebuildChainRows) and dropped between
|
||||||
|
// two rows, which a line along the edge of the row below or above shows.
|
||||||
|
auto drop = Gtk::DropTarget::create(Glib::Value<int>::value_type(), Gdk::DragAction::MOVE);
|
||||||
|
drop->signal_motion().connect(
|
||||||
|
[this](double, double y) {
|
||||||
|
showChainDropSlot(chainDropSlot(y));
|
||||||
|
return Gdk::DragAction::MOVE;
|
||||||
|
},
|
||||||
|
false);
|
||||||
|
drop->signal_leave().connect([this] { showChainDropSlot(-1); });
|
||||||
|
drop->signal_drop().connect(
|
||||||
|
[this](const Glib::ValueBase& value, double, double y) {
|
||||||
|
showChainDropSlot(-1);
|
||||||
|
Glib::Value<int> from;
|
||||||
|
from.init(value.gobj());
|
||||||
|
const int index = from.get();
|
||||||
|
const int slot = chainDropSlot(y);
|
||||||
|
// The slot counts the dragged row itself, which leaves its place
|
||||||
|
// before it takes the new one.
|
||||||
|
const int to = slot > index ? slot - 1 : slot;
|
||||||
|
// Not while the drag is still finishing: the move rebuilds the
|
||||||
|
// rows, the dragged one and its drag source with them.
|
||||||
|
Glib::signal_idle().connect_once([this, index, to] { moveStage(index, to); });
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
false);
|
||||||
|
chainList_.add_controller(drop);
|
||||||
|
|
||||||
auto* scroller = Gtk::make_managed<Gtk::ScrolledWindow>();
|
auto* scroller = Gtk::make_managed<Gtk::ScrolledWindow>();
|
||||||
scroller->set_policy(Gtk::PolicyType::NEVER, Gtk::PolicyType::AUTOMATIC);
|
scroller->set_policy(Gtk::PolicyType::NEVER, Gtk::PolicyType::AUTOMATIC);
|
||||||
scroller->set_child(chainList_);
|
scroller->set_child(chainList_);
|
||||||
@@ -1409,12 +1453,13 @@ void EffectorWindow::removeStage(int index) {
|
|||||||
requestRender();
|
requestRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectorWindow::moveStage(int index, int delta) {
|
void EffectorWindow::moveStage(int from, int to) {
|
||||||
const int target = index + delta;
|
const auto count = static_cast<int>(stages_.size());
|
||||||
if (index < 0 || static_cast<std::size_t>(index) >= stages_.size()) return;
|
if (from < 0 || from >= count || to < 0 || to >= count || from == to) return;
|
||||||
if (target < 0 || static_cast<std::size_t>(target) >= stages_.size()) return;
|
ChainStage stage = std::move(stages_[static_cast<std::size_t>(from)]);
|
||||||
std::swap(stages_[static_cast<std::size_t>(index)], stages_[static_cast<std::size_t>(target)]);
|
stages_.erase(stages_.begin() + from);
|
||||||
selectedStage_ = target;
|
stages_.insert(stages_.begin() + to, std::move(stage));
|
||||||
|
selectedStage_ = to;
|
||||||
rebuildChainRows();
|
rebuildChainRows();
|
||||||
buildParamWidgets();
|
buildParamWidgets();
|
||||||
requestRender();
|
requestRender();
|
||||||
@@ -1488,7 +1533,7 @@ void EffectorWindow::rebuildChainRows() {
|
|||||||
if (delta == 0) {
|
if (delta == 0) {
|
||||||
removeStage(index);
|
removeStage(index);
|
||||||
} else {
|
} else {
|
||||||
moveStage(index, delta);
|
moveStage(index, index + delta);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (delta == -1) button->set_sensitive(index > 0);
|
if (delta == -1) button->set_sensitive(index > 0);
|
||||||
@@ -1497,6 +1542,23 @@ void EffectorWindow::rebuildChainRows() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
row->set_child(*box);
|
row->set_child(*box);
|
||||||
|
|
||||||
|
// The row itself is what is dragged, under the pointer where it was
|
||||||
|
// picked up; a press that goes nowhere is still a click on the row.
|
||||||
|
auto drag = Gtk::DragSource::create();
|
||||||
|
drag->set_actions(Gdk::DragAction::MOVE);
|
||||||
|
drag->signal_prepare().connect(
|
||||||
|
[source = drag.get(), row, index](double x, double y) {
|
||||||
|
source->set_icon(Gtk::WidgetPaintable::create(*row), static_cast<int>(x),
|
||||||
|
static_cast<int>(y));
|
||||||
|
Glib::Value<int> value;
|
||||||
|
value.init(Glib::Value<int>::value_type());
|
||||||
|
value.set(index);
|
||||||
|
return Gdk::ContentProvider::create(value);
|
||||||
|
},
|
||||||
|
false);
|
||||||
|
row->add_controller(drag);
|
||||||
|
|
||||||
chainList_.append(*row);
|
chainList_.append(*row);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1506,6 +1568,39 @@ void EffectorWindow::rebuildChainRows() {
|
|||||||
scheduleChainSplitFit();
|
scheduleChainSplitFit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Where a row dropped at `y` goes: before the row whose upper half `y` is in,
|
||||||
|
// or after the last row.
|
||||||
|
int EffectorWindow::chainDropSlot(double y) const {
|
||||||
|
for (int i = 0;; ++i) {
|
||||||
|
auto* row = chainList_.get_row_at_index(i);
|
||||||
|
if (row == nullptr) return i;
|
||||||
|
graphene_rect_t bounds;
|
||||||
|
if (!gtk_widget_compute_bounds(GTK_WIDGET(row->gobj()), GTK_WIDGET(chainList_.gobj()),
|
||||||
|
&bounds))
|
||||||
|
continue;
|
||||||
|
if (y < bounds.origin.y + bounds.size.height / 2) return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Marks the edge a drop into `slot` lands on; -1 clears the mark.
|
||||||
|
void EffectorWindow::showChainDropSlot(int slot) {
|
||||||
|
const int count = static_cast<int>(stages_.size());
|
||||||
|
for (int i = 0; auto* row = chainList_.get_row_at_index(i); ++i) {
|
||||||
|
const bool before = i == slot;
|
||||||
|
const bool after = slot == count && i == count - 1;
|
||||||
|
if (before) {
|
||||||
|
row->add_css_class("drop-before");
|
||||||
|
} else {
|
||||||
|
row->remove_css_class("drop-before");
|
||||||
|
}
|
||||||
|
if (after) {
|
||||||
|
row->add_css_class("drop-after");
|
||||||
|
} else {
|
||||||
|
row->remove_css_class("drop-after");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Once the rows are laid out, not in the middle of a rebuild or of an
|
// Once the rows are laid out, not in the middle of a rebuild or of an
|
||||||
// allocation, where moving the split would ask for another one.
|
// allocation, where moving the split would ask for another one.
|
||||||
void EffectorWindow::scheduleChainSplitFit() {
|
void EffectorWindow::scheduleChainSplitFit() {
|
||||||
@@ -1789,16 +1884,37 @@ Gtk::Widget& EffectorWindow::buildMainMenu() {
|
|||||||
add_action("open-project", sigc::mem_fun(*this, &EffectorWindow::onOpenProject));
|
add_action("open-project", sigc::mem_fun(*this, &EffectorWindow::onOpenProject));
|
||||||
add_action("save-project", sigc::mem_fun(*this, &EffectorWindow::onSaveProject));
|
add_action("save-project", sigc::mem_fun(*this, &EffectorWindow::onSaveProject));
|
||||||
add_action("save-project-as", sigc::mem_fun(*this, &EffectorWindow::onSaveProjectAs));
|
add_action("save-project-as", sigc::mem_fun(*this, &EffectorWindow::onSaveProjectAs));
|
||||||
|
// The entry carries the file's URI rather than its path: a target must be
|
||||||
|
// UTF-8, and a file name need not be.
|
||||||
|
add_action_with_parameter("open-recent", Glib::VARIANT_TYPE_STRING,
|
||||||
|
[this](const Glib::VariantBase& target) {
|
||||||
|
const auto uri =
|
||||||
|
Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::ustring>>(target).get();
|
||||||
|
openProject(Glib::filename_from_uri(uri));
|
||||||
|
});
|
||||||
|
// Never enabled: it only stands in for an empty list.
|
||||||
|
add_action("no-recent")->set_enabled(false);
|
||||||
|
add_action("show-changelog", sigc::mem_fun(*this, &EffectorWindow::showChangelog));
|
||||||
|
add_action("about", sigc::mem_fun(*this, &EffectorWindow::showAbout));
|
||||||
|
|
||||||
auto menu = Gio::Menu::create();
|
auto menu = Gio::Menu::create();
|
||||||
auto open = Gio::Menu::create();
|
auto open = Gio::Menu::create();
|
||||||
open->append("New Project", "win.new-project");
|
open->append("New Project", "win.new-project");
|
||||||
open->append("Open Project…", "win.open-project");
|
open->append("Open Project…", "win.open-project");
|
||||||
|
recentMenu_ = Gio::Menu::create();
|
||||||
|
open->append_submenu("Open Recent", recentMenu_);
|
||||||
|
rebuildRecentMenu();
|
||||||
|
recentChanged_ = Gtk::RecentManager::get_default()->signal_changed().connect(
|
||||||
|
sigc::mem_fun(*this, &EffectorWindow::rebuildRecentMenu));
|
||||||
menu->append_section(open);
|
menu->append_section(open);
|
||||||
auto save = Gio::Menu::create();
|
auto save = Gio::Menu::create();
|
||||||
save->append("Save Project", "win.save-project");
|
save->append("Save Project", "win.save-project");
|
||||||
save->append("Save Project As…", "win.save-project-as");
|
save->append("Save Project As…", "win.save-project-as");
|
||||||
menu->append_section(save);
|
menu->append_section(save);
|
||||||
|
auto help = Gio::Menu::create();
|
||||||
|
help->append("Changelog", "win.show-changelog");
|
||||||
|
help->append("About Effector", "win.about");
|
||||||
|
menu->append_section(help);
|
||||||
|
|
||||||
// The shortcuts hang off the window rather than the application, which the
|
// The shortcuts hang off the window rather than the application, which the
|
||||||
// window does not belong to yet while it is being built.
|
// window does not belong to yet while it is being built.
|
||||||
@@ -1900,11 +2016,215 @@ void EffectorWindow::onProjectChosen(const Glib::RefPtr<Gio::AsyncResult>& resul
|
|||||||
return; // cancelled
|
return; // cancelled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openProject(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EffectorWindow::openProject(const std::string& path) {
|
||||||
try {
|
try {
|
||||||
applyProject(loadProject(path), path);
|
applyProject(loadProject(path), path);
|
||||||
} catch (const std::exception& error) {
|
} catch (const std::exception& error) {
|
||||||
showError(std::string("Could not open the project: ") + error.what());
|
showError(std::string("Could not open the project: ") + error.what());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
rememberProject(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EffectorWindow::rememberProject(const std::string& path) {
|
||||||
|
Gtk::RecentManager::Data data;
|
||||||
|
data.app_name = kRecentApp;
|
||||||
|
data.app_exec = "effector";
|
||||||
|
data.mime_type = "application/json";
|
||||||
|
try {
|
||||||
|
Gtk::RecentManager::get_default()->add_item(
|
||||||
|
Glib::filename_to_uri(std::filesystem::absolute(path).string()), data);
|
||||||
|
} catch (const Glib::Error&) {
|
||||||
|
// Not a path a URI can name; the project is open all the same.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EffectorWindow::rebuildRecentMenu() {
|
||||||
|
std::vector<Glib::RefPtr<Gtk::RecentInfo>> recent;
|
||||||
|
for (const auto& info : Gtk::RecentManager::get_default()->get_items()) {
|
||||||
|
if (info->has_application(kRecentApp) && info->exists()) recent.push_back(info);
|
||||||
|
}
|
||||||
|
std::sort(recent.begin(), recent.end(), [](const auto& a, const auto& b) {
|
||||||
|
return a->get_modified().compare(b->get_modified()) > 0;
|
||||||
|
});
|
||||||
|
if (recent.size() > kRecentCount) recent.resize(kRecentCount);
|
||||||
|
|
||||||
|
// A project is listed by its name, and by its folder too only where two
|
||||||
|
// of the same name would otherwise read alike.
|
||||||
|
std::vector<std::filesystem::path> paths;
|
||||||
|
for (const auto& info : recent) paths.emplace_back(Glib::filename_from_uri(info->get_uri()));
|
||||||
|
recentMenu_->remove_all();
|
||||||
|
for (std::size_t i = 0; i < recent.size(); ++i) {
|
||||||
|
std::string label = paths[i].stem().string();
|
||||||
|
const auto sameName = std::count_if(paths.begin(), paths.end(), [&](const auto& other) {
|
||||||
|
return other.stem() == paths[i].stem();
|
||||||
|
});
|
||||||
|
if (sameName > 1) label += " (" + paths[i].parent_path().filename().string() + ")";
|
||||||
|
// The menu reads an underscore as a mnemonic.
|
||||||
|
const std::string display = Glib::filename_display_name(label);
|
||||||
|
std::string escaped;
|
||||||
|
for (const char c : display) {
|
||||||
|
escaped += c;
|
||||||
|
if (c == '_') escaped += '_';
|
||||||
|
}
|
||||||
|
auto item = Gio::MenuItem::create(escaped, "");
|
||||||
|
item->set_action_and_target("win.open-recent",
|
||||||
|
Glib::Variant<Glib::ustring>::create(recent[i]->get_uri()));
|
||||||
|
recentMenu_->append_item(item);
|
||||||
|
}
|
||||||
|
if (recent.empty()) recentMenu_->append("No Recent Projects", "win.no-recent");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ changelog ---
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
// Lays CHANGELOG.md out in a text buffer. It reads only the little Markdown
|
||||||
|
// the file uses -- headings, bullets wrapped onto indented lines, and `code`
|
||||||
|
// -- which is all a changelog needs.
|
||||||
|
void fillChangelog(const Glib::RefPtr<Gtk::TextBuffer>& buffer, std::string_view markdown) {
|
||||||
|
auto tags = buffer->get_tag_table();
|
||||||
|
auto tag = [&](const char* name, auto&& configure) {
|
||||||
|
auto made = Gtk::TextTag::create(name);
|
||||||
|
configure(*made);
|
||||||
|
tags->add(made);
|
||||||
|
};
|
||||||
|
tag("title", [](Gtk::TextTag& t) {
|
||||||
|
t.property_weight() = Pango::Weight::BOLD;
|
||||||
|
t.property_scale() = 1.6;
|
||||||
|
t.property_pixels_below_lines() = 6;
|
||||||
|
});
|
||||||
|
tag("release", [](Gtk::TextTag& t) {
|
||||||
|
t.property_weight() = Pango::Weight::BOLD;
|
||||||
|
t.property_scale() = 1.3;
|
||||||
|
t.property_pixels_above_lines() = 18;
|
||||||
|
t.property_pixels_below_lines() = 2;
|
||||||
|
});
|
||||||
|
tag("section", [](Gtk::TextTag& t) {
|
||||||
|
t.property_weight() = Pango::Weight::BOLD;
|
||||||
|
t.property_pixels_above_lines() = 8;
|
||||||
|
t.property_pixels_below_lines() = 2;
|
||||||
|
});
|
||||||
|
tag("item", [](Gtk::TextTag& t) {
|
||||||
|
t.property_left_margin() = 28;
|
||||||
|
t.property_indent() = -14;
|
||||||
|
t.property_pixels_below_lines() = 3;
|
||||||
|
});
|
||||||
|
tag("para", [](Gtk::TextTag& t) { t.property_pixels_below_lines() = 6; });
|
||||||
|
tag("code", [](Gtk::TextTag& t) { t.property_family() = "monospace"; });
|
||||||
|
|
||||||
|
// Gather each block -- a heading, a bullet, a paragraph -- whole first,
|
||||||
|
// since a bullet or a paragraph goes on over several lines.
|
||||||
|
struct Block {
|
||||||
|
std::string kind;
|
||||||
|
std::string text;
|
||||||
|
};
|
||||||
|
std::vector<Block> blocks;
|
||||||
|
bool open = false; // the last block still takes continuation lines
|
||||||
|
std::size_t pos = 0;
|
||||||
|
while (pos <= markdown.size()) {
|
||||||
|
auto end = markdown.find('\n', pos);
|
||||||
|
if (end == std::string_view::npos) end = markdown.size();
|
||||||
|
std::string line(markdown.substr(pos, end - pos));
|
||||||
|
pos = end + 1;
|
||||||
|
|
||||||
|
const auto first = line.find_first_not_of(' ');
|
||||||
|
if (first == std::string::npos) {
|
||||||
|
open = false;
|
||||||
|
} else if (line.rfind("# ", 0) == 0) {
|
||||||
|
blocks.push_back({"title", line.substr(2)});
|
||||||
|
open = false;
|
||||||
|
} else if (line.rfind("## ", 0) == 0) {
|
||||||
|
// "[0.5.0] - 2026-09-26" reads as "0.5.0 — 2026-09-26".
|
||||||
|
std::string text = line.substr(3);
|
||||||
|
std::erase(text, '[');
|
||||||
|
std::erase(text, ']');
|
||||||
|
if (const auto dash = text.find(" - "); dash != std::string::npos) {
|
||||||
|
text.replace(dash, 3, " — ");
|
||||||
|
}
|
||||||
|
blocks.push_back({"release", text});
|
||||||
|
open = false;
|
||||||
|
} else if (line.rfind("### ", 0) == 0) {
|
||||||
|
blocks.push_back({"section", line.substr(4)});
|
||||||
|
open = false;
|
||||||
|
} else if (line.rfind("- ", 0) == 0) {
|
||||||
|
blocks.push_back({"item", "• " + line.substr(2)});
|
||||||
|
open = true;
|
||||||
|
} else if (open) {
|
||||||
|
blocks.back().text += " " + line.substr(first);
|
||||||
|
} else {
|
||||||
|
blocks.push_back({"para", line.substr(first)});
|
||||||
|
open = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto at = buffer->end();
|
||||||
|
for (std::size_t i = 0; i < blocks.size(); ++i) {
|
||||||
|
const auto& block = blocks[i];
|
||||||
|
// Split on the backticks: every odd piece is code.
|
||||||
|
std::size_t start = 0;
|
||||||
|
bool code = false;
|
||||||
|
while (start <= block.text.size()) {
|
||||||
|
auto tick = block.text.find('`', start);
|
||||||
|
if (tick == std::string::npos) tick = block.text.size();
|
||||||
|
if (tick > start) {
|
||||||
|
std::vector<Glib::ustring> names{block.kind};
|
||||||
|
if (code) names.emplace_back("code");
|
||||||
|
at = buffer->insert_with_tags_by_name(at, block.text.substr(start, tick - start), names);
|
||||||
|
}
|
||||||
|
start = tick + 1;
|
||||||
|
code = !code;
|
||||||
|
}
|
||||||
|
if (i + 1 < blocks.size()) at = buffer->insert_with_tag(at, "\n", block.kind);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
void EffectorWindow::showChangelog() {
|
||||||
|
if (!changelogWindow_) {
|
||||||
|
changelogWindow_ = std::make_unique<Gtk::Window>();
|
||||||
|
changelogWindow_->set_title("Changelog");
|
||||||
|
changelogWindow_->set_transient_for(*this);
|
||||||
|
changelogWindow_->set_default_size(560, 640);
|
||||||
|
changelogWindow_->set_hide_on_close(true);
|
||||||
|
|
||||||
|
auto* text = Gtk::make_managed<Gtk::TextView>();
|
||||||
|
text->set_name("changelog");
|
||||||
|
text->set_editable(false);
|
||||||
|
text->set_cursor_visible(false);
|
||||||
|
text->set_wrap_mode(Gtk::WrapMode::WORD);
|
||||||
|
text->set_left_margin(18);
|
||||||
|
text->set_right_margin(18);
|
||||||
|
text->set_top_margin(12);
|
||||||
|
text->set_bottom_margin(18);
|
||||||
|
fillChangelog(text->get_buffer(), kChangelog);
|
||||||
|
|
||||||
|
auto* scroller = Gtk::make_managed<Gtk::ScrolledWindow>();
|
||||||
|
scroller->set_policy(Gtk::PolicyType::NEVER, Gtk::PolicyType::AUTOMATIC);
|
||||||
|
scroller->set_child(*text);
|
||||||
|
changelogWindow_->set_child(*scroller);
|
||||||
|
}
|
||||||
|
changelogWindow_->present();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EffectorWindow::showAbout() {
|
||||||
|
if (!aboutDialog_) {
|
||||||
|
aboutDialog_ = std::make_unique<Gtk::AboutDialog>();
|
||||||
|
aboutDialog_->set_transient_for(*this);
|
||||||
|
aboutDialog_->set_modal(true);
|
||||||
|
aboutDialog_->set_hide_on_close(true);
|
||||||
|
aboutDialog_->set_program_name("Effector");
|
||||||
|
aboutDialog_->set_version(std::string(kVersion));
|
||||||
|
aboutDialog_->set_comments("Image effects, cascaded through a chain.");
|
||||||
|
aboutDialog_->set_logo_icon_name("applications-graphics");
|
||||||
|
aboutDialog_->set_copyright("Copyright © 2026 Si");
|
||||||
|
aboutDialog_->set_license_type(Gtk::License::GPL_3_0);
|
||||||
|
}
|
||||||
|
aboutDialog_->present();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectorWindow::onSaveProject() {
|
void EffectorWindow::onSaveProject() {
|
||||||
@@ -1951,6 +2271,7 @@ void EffectorWindow::writeProject(const std::string& path) {
|
|||||||
clearError();
|
clearError();
|
||||||
projectPath_ = path;
|
projectPath_ = path;
|
||||||
updateTitle();
|
updateTitle();
|
||||||
|
rememberProject(path);
|
||||||
status_.set_text("Saved " + path);
|
status_.set_text("Saved " + path);
|
||||||
status_.set_tooltip_text("Saved " + path);
|
status_.set_tooltip_text("Saved " + path);
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-1
@@ -91,7 +91,11 @@ private:
|
|||||||
Gtk::Widget& buildAddMenu(); // the menu of effects that can be appended
|
Gtk::Widget& buildAddMenu(); // the menu of effects that can be appended
|
||||||
void appendStage(const EffectPtr& effect);
|
void appendStage(const EffectPtr& effect);
|
||||||
void removeStage(int index);
|
void removeStage(int index);
|
||||||
void moveStage(int index, int delta);
|
void moveStage(int from, int to); // `to` is the index it ends up at
|
||||||
|
// Dragging a row: the slot between rows it would drop into, and the line
|
||||||
|
// that shows it.
|
||||||
|
int chainDropSlot(double y) const;
|
||||||
|
void showChainDropSlot(int slot);
|
||||||
// The check on a chain row: the stage stays where it is, and is skipped.
|
// The check on a chain row: the stage stays where it is, and is skipped.
|
||||||
void setStageEnabled(int index, bool enabled);
|
void setStageEnabled(int index, bool enabled);
|
||||||
void rebuildChainRows();
|
void rebuildChainRows();
|
||||||
@@ -104,11 +108,18 @@ private:
|
|||||||
void selectStage(int index);
|
void selectStage(int index);
|
||||||
void onStageSelected();
|
void onStageSelected();
|
||||||
Gtk::Widget& buildMainMenu(); // the header menu: new, open, save project
|
Gtk::Widget& buildMainMenu(); // the header menu: new, open, save project
|
||||||
|
void showChangelog();
|
||||||
|
void showAbout();
|
||||||
Project currentProject() const;
|
Project currentProject() const;
|
||||||
void applyProject(const Project& project, const std::string& path);
|
void applyProject(const Project& project, const std::string& path);
|
||||||
void clearSources();
|
void clearSources();
|
||||||
void onNewProject();
|
void onNewProject();
|
||||||
void onOpenProject();
|
void onOpenProject();
|
||||||
|
void openProject(const std::string& path);
|
||||||
|
// Open Recent: the projects this program opened or saved, newest first,
|
||||||
|
// kept in the desktop's shared list of recently used files.
|
||||||
|
void rememberProject(const std::string& path);
|
||||||
|
void rebuildRecentMenu();
|
||||||
void onProjectChosen(const Glib::RefPtr<Gio::AsyncResult>& result,
|
void onProjectChosen(const Glib::RefPtr<Gio::AsyncResult>& result,
|
||||||
const Glib::RefPtr<Gtk::FileDialog>& dialog);
|
const Glib::RefPtr<Gtk::FileDialog>& dialog);
|
||||||
void onSaveProject(); // falls back to Save As while the project is untitled
|
void onSaveProject(); // falls back to Save As while the project is untitled
|
||||||
@@ -163,6 +174,8 @@ private:
|
|||||||
Image result_;
|
Image result_;
|
||||||
std::uint64_t seed_ = 0;
|
std::uint64_t seed_ = 0;
|
||||||
std::string projectPath_; // empty until the project has been saved once
|
std::string projectPath_; // empty until the project has been saved once
|
||||||
|
Glib::RefPtr<Gio::Menu> recentMenu_;
|
||||||
|
sigc::connection recentChanged_; // the recent list outlives the window
|
||||||
bool suspendRender_ = true;
|
bool suspendRender_ = true;
|
||||||
|
|
||||||
// Source loading. Decoding a batch of large photographs takes seconds, so
|
// Source loading. Decoding a batch of large photographs takes seconds, so
|
||||||
@@ -198,6 +211,9 @@ private:
|
|||||||
Gtk::Button* addButton_ = nullptr;
|
Gtk::Button* addButton_ = nullptr;
|
||||||
// Built fresh with the progress window, and null whenever it is closed.
|
// Built fresh with the progress window, and null whenever it is closed.
|
||||||
std::unique_ptr<Gtk::Window> loadWindow_;
|
std::unique_ptr<Gtk::Window> loadWindow_;
|
||||||
|
// Opened from the menu on first use, then shown again rather than rebuilt.
|
||||||
|
std::unique_ptr<Gtk::Window> changelogWindow_;
|
||||||
|
std::unique_ptr<Gtk::AboutDialog> aboutDialog_;
|
||||||
Gtk::ProgressBar* loadBar_ = nullptr;
|
Gtk::ProgressBar* loadBar_ = nullptr;
|
||||||
Gtk::Label* loadFileLabel_ = nullptr;
|
Gtk::Label* loadFileLabel_ = nullptr;
|
||||||
Gtk::Box sourcesSection_; // hidden while the chain needs no sources
|
Gtk::Box sourcesSection_; // hidden while the chain needs no sources
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "core/image.hpp"
|
#include "core/image.hpp"
|
||||||
#include "core/registry.hpp"
|
#include "core/registry.hpp"
|
||||||
#include "core/rng.hpp"
|
#include "core/rng.hpp"
|
||||||
|
#include "core/version.hpp"
|
||||||
#include "gui/app.hpp"
|
#include "gui/app.hpp"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -78,6 +79,10 @@ int main(int argc, char** argv) {
|
|||||||
std::cout << effector::usage(argv[0]);
|
std::cout << effector::usage(argv[0]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (options.showVersion) {
|
||||||
|
std::cout << "effector " << effector::kVersion << "\n";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (options.listEffects) {
|
if (options.listEffects) {
|
||||||
for (const auto& effect : effector::effects()) {
|
for (const auto& effect : effector::effects()) {
|
||||||
std::cout << effect->name() << "\t" << effect->title() << " - "
|
std::cout << effect->name() << "\t" << effect->title() << " - "
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
add_executable(effector_tests core_tests.cpp ../src/cli/options.cpp)
|
add_executable(effector_tests core_tests.cpp ../src/cli/options.cpp)
|
||||||
target_link_libraries(effector_tests PRIVATE effector_core)
|
target_link_libraries(effector_tests PRIVATE effector_core)
|
||||||
target_compile_options(effector_tests PRIVATE -Wall -Wextra -Wpedantic)
|
target_compile_options(effector_tests PRIVATE -Wall -Wextra -Wpedantic)
|
||||||
|
# The version test reads the Arch PKGBUILD to keep its pkgver in step.
|
||||||
|
target_compile_definitions(effector_tests PRIVATE EFFECTOR_SOURCE_DIR="${PROJECT_SOURCE_DIR}")
|
||||||
|
|
||||||
add_test(NAME core COMMAND effector_tests)
|
add_test(NAME core COMMAND effector_tests)
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "core/registry.hpp"
|
#include "core/registry.hpp"
|
||||||
#include "core/rng.hpp"
|
#include "core/rng.hpp"
|
||||||
#include "core/style.hpp"
|
#include "core/style.hpp"
|
||||||
|
#include "core/version.hpp"
|
||||||
#include "effects/blur.hpp"
|
#include "effects/blur.hpp"
|
||||||
#include "effects/grain.hpp"
|
#include "effects/grain.hpp"
|
||||||
#include "effects/monochrome.hpp"
|
#include "effects/monochrome.hpp"
|
||||||
@@ -638,6 +639,49 @@ int main() {
|
|||||||
solid(100, 100, 0, 0, 255)),
|
solid(100, 100, 0, 0, 255)),
|
||||||
"zero opacity leaves the input untouched");
|
"zero opacity leaves the input untouched");
|
||||||
|
|
||||||
|
// Halo: none by default, a shadow moved by its offset, a glow all round.
|
||||||
|
check(sameBytes(renderOverlay(blue, 100, 100, at),
|
||||||
|
renderOverlay(blue, 100, 100, [&] {
|
||||||
|
ParamValues none = at;
|
||||||
|
none["overlay_halo"] = std::string("none");
|
||||||
|
return none;
|
||||||
|
}())),
|
||||||
|
"no halo is the default");
|
||||||
|
ParamValues shadowed = at;
|
||||||
|
shadowed["overlay_halo"] = std::string("shadow");
|
||||||
|
shadowed["overlay_halo_size"] = 0L;
|
||||||
|
shadowed["overlay_halo_opacity"] = 1.0;
|
||||||
|
shadowed["overlay_shadow_x"] = 5L;
|
||||||
|
shadowed["overlay_shadow_y"] = 5L;
|
||||||
|
const auto shadow = renderOverlay(blue, 100, 100, shadowed);
|
||||||
|
const auto dark = pixel(shadow, 72, 62); // past the logo's bottom right corner (70, 60)
|
||||||
|
check(dark[0] == 0 && dark[1] == 0 && dark[2] == 0,
|
||||||
|
"a hard shadow is cast down and right by its offset");
|
||||||
|
check(isBlue(pixel(shadow, 28, 50)) && isRed(pixel(shadow, 50, 50)),
|
||||||
|
"it leaves the other side alone and stays beneath the image");
|
||||||
|
shadowed["overlay_halo_size"] = 12L;
|
||||||
|
const auto soft = pixel(renderOverlay(blue, 100, 100, shadowed), 78, 50);
|
||||||
|
check(soft[2] > 0 && soft[2] < 255, "a soft shadow fades out past the edge");
|
||||||
|
|
||||||
|
ParamValues glowing = at;
|
||||||
|
glowing["overlay_halo"] = std::string("glow");
|
||||||
|
const auto glow = renderOverlay(blue, 100, 100, glowing);
|
||||||
|
const auto left = pixel(glow, 27, 50);
|
||||||
|
const auto right = pixel(glow, 72, 50);
|
||||||
|
check(left[0] > 0 && left[0] == right[0] && left[1] == right[1],
|
||||||
|
"a glow lightens both sides alike");
|
||||||
|
check(isBlue(pixel(glow, 2, 2)), "and fades out before the far corners");
|
||||||
|
glowing["overlay_halo_spread"] = 0.5;
|
||||||
|
check(pixel(renderOverlay(blue, 100, 100, glowing), 27, 50)[0] > left[0],
|
||||||
|
"spread strengthens the halo near the edge");
|
||||||
|
|
||||||
|
ParamValues offCanvas = shadowed;
|
||||||
|
offCanvas["overlay_halo_size"] = 0L;
|
||||||
|
offCanvas["overlay_offset_x"] = -70L; // the logo ends just left of the canvas
|
||||||
|
offCanvas["overlay_shadow_x"] = 20L;
|
||||||
|
const auto cast = pixel(renderOverlay(blue, 100, 100, offCanvas), 5, 50);
|
||||||
|
check(cast[2] == 0, "an image off the canvas still casts its shadow onto it");
|
||||||
|
|
||||||
// No image chosen is the state the interface starts in: a pass through.
|
// No image chosen is the state the interface starts in: a pass through.
|
||||||
check(sameBytes(renderOverlay(blue, 100, 100, {}), solid(100, 100, 0, 0, 255)),
|
check(sameBytes(renderOverlay(blue, 100, 100, {}), solid(100, 100, 0, 0, 255)),
|
||||||
"with no image chosen the stage passes its input through");
|
"with no image chosen the stage passes its input through");
|
||||||
@@ -1672,6 +1716,28 @@ int main() {
|
|||||||
std::filesystem::remove_all(dir);
|
std::filesystem::remove_all(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cout << "version\n";
|
||||||
|
{
|
||||||
|
// A release is the version in CMakeLists.txt and its entry at the top
|
||||||
|
// of CHANGELOG.md; bumping one without the other fails here.
|
||||||
|
const std::string_view log = kChangelog;
|
||||||
|
const auto newest = log.find("\n## [");
|
||||||
|
check(newest != std::string_view::npos &&
|
||||||
|
log.substr(newest + 5).starts_with(std::string(kVersion) + "]"),
|
||||||
|
"the newest changelog entry is this version");
|
||||||
|
std::ifstream pkgbuild(std::string(EFFECTOR_SOURCE_DIR) + "/packaging/arch/PKGBUILD");
|
||||||
|
std::string line;
|
||||||
|
std::string pkgver;
|
||||||
|
while (std::getline(pkgbuild, line)) {
|
||||||
|
if (line.starts_with("pkgver=")) pkgver = line.substr(7);
|
||||||
|
}
|
||||||
|
check(pkgver == kVersion, "the Arch PKGBUILD packages this version");
|
||||||
|
const auto options = parsedOptions({"--version"});
|
||||||
|
check(options && options->showVersion, "--version is understood");
|
||||||
|
const auto shortOptions = parsedOptions({"-V"});
|
||||||
|
check(shortOptions && shortOptions->showVersion, "and so is -V");
|
||||||
|
}
|
||||||
|
|
||||||
std::cout << (failures == 0 ? "\nall checks passed\n" : "\n" + std::to_string(failures) + " failed\n");
|
std::cout << (failures == 0 ? "\nall checks passed\n" : "\n" + std::to_string(failures) + " failed\n");
|
||||||
return failures == 0 ? 0 : 1;
|
return failures == 0 ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|||||||
+178
-1
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <filesystem>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -13,7 +14,9 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "cli/options.hpp"
|
#include "cli/options.hpp"
|
||||||
|
#include "core/project.hpp"
|
||||||
#include "core/registry.hpp"
|
#include "core/registry.hpp"
|
||||||
|
#include "core/version.hpp"
|
||||||
#include "gui/window.hpp"
|
#include "gui/window.hpp"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -122,6 +125,30 @@ bool addFromMenu(Gtk::MenuButton& add, const std::string& title) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The drop target the chain list reorders its rows with.
|
||||||
|
GtkDropTarget* chainDropTarget(Gtk::Widget& list) {
|
||||||
|
GListModel* controllers = gtk_widget_observe_controllers(list.gobj());
|
||||||
|
GtkDropTarget* found = nullptr;
|
||||||
|
for (guint i = 0; i < g_list_model_get_n_items(controllers) && found == nullptr; ++i) {
|
||||||
|
auto* controller = g_list_model_get_item(controllers, i);
|
||||||
|
if (GTK_IS_DROP_TARGET(controller)) found = GTK_DROP_TARGET(controller);
|
||||||
|
g_object_unref(controller);
|
||||||
|
}
|
||||||
|
g_object_unref(controllers);
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
// What dropping the row of stage `index` at `y` does; a real drag needs a
|
||||||
|
// pointer, which the tests do not have.
|
||||||
|
void dropStage(GtkDropTarget* drop, int index, double y) {
|
||||||
|
GValue value = G_VALUE_INIT;
|
||||||
|
g_value_init(&value, G_TYPE_INT);
|
||||||
|
g_value_set_int(&value, index);
|
||||||
|
gboolean handled = FALSE;
|
||||||
|
g_signal_emit_by_name(drop, "drop", &value, 1.0, y, &handled);
|
||||||
|
g_value_unset(&value);
|
||||||
|
}
|
||||||
|
|
||||||
void runTests(Gtk::Window& window) {
|
void runTests(Gtk::Window& window) {
|
||||||
const auto& effects = effector::effects();
|
const auto& effects = effector::effects();
|
||||||
|
|
||||||
@@ -239,6 +266,43 @@ void runTests(Gtk::Window& window) {
|
|||||||
"Remove drops the stage and renumbers the rest");
|
"Remove drops the stage and renumbers the rest");
|
||||||
check(!sources->get_visible(), "and the sources hide again");
|
check(!sources->get_visible(), "and the sources hide again");
|
||||||
|
|
||||||
|
std::cout << "drag and drop\n";
|
||||||
|
addFromMenu(*add, "Scanlines");
|
||||||
|
for (const auto& effect : effects) {
|
||||||
|
if (effect->title() != "Blur" && effect->title() != "Scanlines") {
|
||||||
|
addFromMenu(*add, effect->title());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GtkDropTarget* drop = chainDropTarget(*chainList);
|
||||||
|
check(drop != nullptr, "the chain list takes drops");
|
||||||
|
if (drop != nullptr && rowCount(*chainList) == 3) {
|
||||||
|
const std::string first = rowTitle(*chainList, 0).substr(3);
|
||||||
|
const std::string second = rowTitle(*chainList, 1).substr(3);
|
||||||
|
const std::string third = rowTitle(*chainList, 2).substr(3);
|
||||||
|
const double bottom = chainList->get_row_at_index(2)->get_height() * 3.0;
|
||||||
|
GdkDragAction action = GDK_ACTION_NONE;
|
||||||
|
g_signal_emit_by_name(drop, "motion", 1.0, bottom, &action);
|
||||||
|
check(chainList->get_row_at_index(2)->has_css_class("drop-after"),
|
||||||
|
"dragging past the last row marks its bottom edge");
|
||||||
|
dropStage(drop, 0, bottom);
|
||||||
|
pump();
|
||||||
|
check(rowTitle(*chainList, 0) == "1. " + second && rowTitle(*chainList, 1) == "2. " + third &&
|
||||||
|
rowTitle(*chainList, 2) == "3. " + first,
|
||||||
|
"dropping the first stage past the last moves it to the end");
|
||||||
|
check(chainList->get_selected_row() == chainList->get_row_at_index(2),
|
||||||
|
"and selects it");
|
||||||
|
check(!chainList->get_row_at_index(2)->has_css_class("drop-after"),
|
||||||
|
"and clears the mark");
|
||||||
|
dropStage(drop, 2, 1.0);
|
||||||
|
pump();
|
||||||
|
check(rowTitle(*chainList, 0) == "1. " + first && rowTitle(*chainList, 1) == "2. " + second,
|
||||||
|
"dropping on the top edge of the first row moves it to the front");
|
||||||
|
}
|
||||||
|
for (int i = rowCount(*chainList) - 1; i > 0; --i) {
|
||||||
|
if (auto* removeRow = withTooltip(*chainList->get_row_at_index(i), "Remove")) press(*removeRow);
|
||||||
|
}
|
||||||
|
|
||||||
std::cout << "many stages\n";
|
std::cout << "many stages\n";
|
||||||
for (int i = 0; i < 4; ++i) addFromMenu(*add, effects[static_cast<std::size_t>(i) % effects.size()]->title());
|
for (int i = 0; i < 4; ++i) addFromMenu(*add, effects[static_cast<std::size_t>(i) % effects.size()]->title());
|
||||||
pump();
|
pump();
|
||||||
@@ -271,6 +335,111 @@ void runTests(Gtk::Window& window) {
|
|||||||
pump();
|
pump();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The labels of the entries under the "Open Recent" submenu of `model`, or
|
||||||
|
// nothing when there is no such submenu.
|
||||||
|
void recentLabels(GMenuModel* model, std::vector<std::string>& out, bool& found) {
|
||||||
|
for (int i = 0; i < g_menu_model_get_n_items(model); ++i) {
|
||||||
|
char* label = nullptr;
|
||||||
|
g_menu_model_get_item_attribute(model, i, G_MENU_ATTRIBUTE_LABEL, "s", &label);
|
||||||
|
const std::string text = label != nullptr ? label : "";
|
||||||
|
g_free(label);
|
||||||
|
if (GMenuModel* section = g_menu_model_get_item_link(model, i, G_MENU_LINK_SECTION)) {
|
||||||
|
recentLabels(section, out, found);
|
||||||
|
g_object_unref(section);
|
||||||
|
}
|
||||||
|
if (GMenuModel* submenu = g_menu_model_get_item_link(model, i, G_MENU_LINK_SUBMENU)) {
|
||||||
|
if (text == "Open Recent") {
|
||||||
|
found = true;
|
||||||
|
for (int j = 0; j < g_menu_model_get_n_items(submenu); ++j) {
|
||||||
|
char* entry = nullptr;
|
||||||
|
g_menu_model_get_item_attribute(submenu, j, G_MENU_ATTRIBUTE_LABEL, "s", &entry);
|
||||||
|
out.emplace_back(entry != nullptr ? entry : "");
|
||||||
|
g_free(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g_object_unref(submenu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> recentEntries(Gtk::Window& window) {
|
||||||
|
std::vector<Gtk::MenuButton*> buttons;
|
||||||
|
collect<Gtk::MenuButton>(window, [](Gtk::MenuButton& b) { return b.get_tooltip_text() == "Project menu"; },
|
||||||
|
buttons);
|
||||||
|
std::vector<std::string> labels;
|
||||||
|
bool found = false;
|
||||||
|
if (buttons.empty()) return labels;
|
||||||
|
auto* popover = dynamic_cast<Gtk::PopoverMenu*>(buttons.front()->get_popover());
|
||||||
|
if (popover == nullptr || !popover->get_menu_model()) return labels;
|
||||||
|
recentLabels(popover->get_menu_model()->gobj(), labels, found);
|
||||||
|
if (!found) labels.emplace_back("<no Open Recent submenu>");
|
||||||
|
return labels;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The version and the changelog, each a menu entry away.
|
||||||
|
void testHelpWindows(Gtk::Window& window) {
|
||||||
|
std::cout << "changelog and about\n";
|
||||||
|
auto toplevel = [](const std::string& title) -> Gtk::Window* {
|
||||||
|
for (auto* w : Gtk::Window::list_toplevels()) {
|
||||||
|
if (w->get_title() == title && w->get_visible()) return w;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
window.activate_action("win.show-changelog");
|
||||||
|
pump(200);
|
||||||
|
auto* changelog = toplevel("Changelog");
|
||||||
|
check(changelog != nullptr, "Changelog opens a window");
|
||||||
|
auto* text = changelog != nullptr ? named<Gtk::TextView>(*changelog, "changelog") : nullptr;
|
||||||
|
const std::string shown = text != nullptr ? std::string(text->get_buffer()->get_text()) : "";
|
||||||
|
check(shown.find(std::string(effector::kVersion) + " — ") != std::string::npos,
|
||||||
|
"listing this version as a release");
|
||||||
|
check(shown.find("[") == std::string::npos && shown.find("`") == std::string::npos &&
|
||||||
|
shown.find("### ") == std::string::npos,
|
||||||
|
"with the Markdown laid out rather than shown");
|
||||||
|
if (changelog != nullptr) changelog->close();
|
||||||
|
pump(50);
|
||||||
|
check(toplevel("Changelog") == nullptr, "and closes");
|
||||||
|
|
||||||
|
window.activate_action("win.about");
|
||||||
|
pump(200);
|
||||||
|
Gtk::AboutDialog* about = nullptr;
|
||||||
|
for (auto* w : Gtk::Window::list_toplevels()) {
|
||||||
|
if (auto* dialog = dynamic_cast<Gtk::AboutDialog*>(w); dialog != nullptr && dialog->get_visible()) {
|
||||||
|
about = dialog;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
check(about != nullptr && about->get_version() == std::string(effector::kVersion),
|
||||||
|
"About Effector shows the version");
|
||||||
|
if (about != nullptr) about->close();
|
||||||
|
pump(50);
|
||||||
|
}
|
||||||
|
|
||||||
|
void testRecentProjects(Gtk::Window& window, const std::filesystem::path& dir) {
|
||||||
|
std::cout << "recent projects\n";
|
||||||
|
check(recentEntries(window) == std::vector<std::string>{"No Recent Projects"},
|
||||||
|
"Open Recent starts out empty");
|
||||||
|
|
||||||
|
// Two projects of the same name in different folders, and a third.
|
||||||
|
std::filesystem::create_directories(dir / "first");
|
||||||
|
std::filesystem::create_directories(dir / "second");
|
||||||
|
const std::filesystem::path paths[] = {dir / "first" / "my_look.json", dir / "second" / "my_look.json",
|
||||||
|
dir / "other.json"};
|
||||||
|
effector::Project project;
|
||||||
|
project.stages.push_back({effector::effectByName("blur"), {}}); // renders with no sources
|
||||||
|
for (const auto& path : paths) {
|
||||||
|
effector::saveProject(path.string(), project);
|
||||||
|
window.activate_action("win.open-recent",
|
||||||
|
Glib::Variant<Glib::ustring>::create(Glib::filename_to_uri(path.string())));
|
||||||
|
pump(50);
|
||||||
|
}
|
||||||
|
pump(500); // the recent list is written, and announced, from an idle
|
||||||
|
check(window.get_title() == "other — Effector", "an entry opens its project");
|
||||||
|
const auto labels = recentEntries(window);
|
||||||
|
check(labels == std::vector<std::string>{"other", "my__look (second)", "my__look (first)"},
|
||||||
|
"opened projects are listed newest first, a shared name with its folder");
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
@@ -283,17 +452,25 @@ int main(int argc, char** argv) {
|
|||||||
return 77;
|
return 77;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keep the projects the tests open out of the user's own recent list.
|
||||||
|
std::string dataTemplate = (std::filesystem::temp_directory_path() / "effector-gui-XXXXXX").string();
|
||||||
|
const std::filesystem::path dataDir = g_mkdtemp(dataTemplate.data());
|
||||||
|
g_setenv("XDG_DATA_HOME", dataDir.c_str(), TRUE);
|
||||||
|
|
||||||
auto app = Gtk::Application::create("org.effector.GuiTests",
|
auto app = Gtk::Application::create("org.effector.GuiTests",
|
||||||
Gio::Application::Flags::NON_UNIQUE);
|
Gio::Application::Flags::NON_UNIQUE);
|
||||||
app->signal_activate().connect([&app] {
|
app->signal_activate().connect([&app, &dataDir] {
|
||||||
auto window = std::make_unique<effector::EffectorWindow>(effector::Options{});
|
auto window = std::make_unique<effector::EffectorWindow>(effector::Options{});
|
||||||
app->add_window(*window);
|
app->add_window(*window);
|
||||||
window->present();
|
window->present();
|
||||||
pump(300);
|
pump(300);
|
||||||
runTests(*window);
|
runTests(*window);
|
||||||
|
testHelpWindows(*window);
|
||||||
|
testRecentProjects(*window, dataDir / "projects");
|
||||||
app->remove_window(*window);
|
app->remove_window(*window);
|
||||||
});
|
});
|
||||||
const int status = app->run(argc > 0 ? 1 : 0, argv);
|
const int status = app->run(argc > 0 ? 1 : 0, argv);
|
||||||
|
std::filesystem::remove_all(dataDir);
|
||||||
if (status != 0) return status;
|
if (status != 0) return status;
|
||||||
std::cout << (failures == 0 ? "all passed\n" : std::to_string(failures) + " failed\n");
|
std::cout << (failures == 0 ? "all passed\n" : std::to_string(failures) + " failed\n");
|
||||||
return failures;
|
return failures;
|
||||||
|
|||||||
Reference in New Issue
Block a user