Compare commits
1
Commits
master
..
42a2b08abf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42a2b08abf |
No files matched your search
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
# No backup files
|
||||
*.blend1
|
||||
*.*~
|
||||
*.kra~
|
||||
|
||||
# No binary assets should be submitted in Git
|
||||
# We may use Git LFS in future.
|
||||
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
# License
|
||||
|
||||
This project has mixed licencing.
|
||||
You are free to copy, redistribute and/or modify aspects of this work under the terms of each licence accordingly.
|
||||
|
||||
## Icon Set
|
||||
|
||||
The generated icon set as a whole is licensed under **CC-BY 4.0 license**.
|
||||
Individual files may have a different, but compatible license.
|
||||
|
||||
## Icon Set Builder
|
||||
|
||||
The builder of this icon set is under **MIT license**.
|
||||
@@ -1,396 +0,0 @@
|
||||
Attribution 4.0 International
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons Corporation ("Creative Commons") is not a law firm and
|
||||
does not provide legal services or legal advice. Distribution of
|
||||
Creative Commons public licenses does not create a lawyer-client or
|
||||
other relationship. Creative Commons makes its licenses and related
|
||||
information available on an "as-is" basis. Creative Commons gives no
|
||||
warranties regarding its licenses, any material licensed under their
|
||||
terms and conditions, or any related information. Creative Commons
|
||||
disclaims all liability for damages resulting from their use to the
|
||||
fullest extent possible.
|
||||
|
||||
Using Creative Commons Public Licenses
|
||||
|
||||
Creative Commons public licenses provide a standard set of terms and
|
||||
conditions that creators and other rights holders may use to share
|
||||
original works of authorship and other material subject to copyright
|
||||
and certain other rights specified in the public license below. The
|
||||
following considerations are for informational purposes only, are not
|
||||
exhaustive, and do not form part of our licenses.
|
||||
|
||||
Considerations for licensors: Our public licenses are
|
||||
intended for use by those authorized to give the public
|
||||
permission to use material in ways otherwise restricted by
|
||||
copyright and certain other rights. Our licenses are
|
||||
irrevocable. Licensors should read and understand the terms
|
||||
and conditions of the license they choose before applying it.
|
||||
Licensors should also secure all rights necessary before
|
||||
applying our licenses so that the public can reuse the
|
||||
material as expected. Licensors should clearly mark any
|
||||
material not subject to the license. This includes other CC-
|
||||
licensed material, or material used under an exception or
|
||||
limitation to copyright. More considerations for licensors:
|
||||
wiki.creativecommons.org/Considerations_for_licensors
|
||||
|
||||
Considerations for the public: By using one of our public
|
||||
licenses, a licensor grants the public permission to use the
|
||||
licensed material under specified terms and conditions. If
|
||||
the licensor's permission is not necessary for any reason--for
|
||||
example, because of any applicable exception or limitation to
|
||||
copyright--then that use is not regulated by the license. Our
|
||||
licenses grant only permissions under copyright and certain
|
||||
other rights that a licensor has authority to grant. Use of
|
||||
the licensed material may still be restricted for other
|
||||
reasons, including because others have copyright or other
|
||||
rights in the material. A licensor may make special requests,
|
||||
such as asking that all changes be marked or described.
|
||||
Although not required by our licenses, you are encouraged to
|
||||
respect those requests where reasonable. More considerations
|
||||
for the public:
|
||||
wiki.creativecommons.org/Considerations_for_licensees
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons Attribution 4.0 International Public License
|
||||
|
||||
By exercising the Licensed Rights (defined below), You accept and agree
|
||||
to be bound by the terms and conditions of this Creative Commons
|
||||
Attribution 4.0 International Public License ("Public License"). To the
|
||||
extent this Public License may be interpreted as a contract, You are
|
||||
granted the Licensed Rights in consideration of Your acceptance of
|
||||
these terms and conditions, and the Licensor grants You such rights in
|
||||
consideration of benefits the Licensor receives from making the
|
||||
Licensed Material available under these terms and conditions.
|
||||
|
||||
|
||||
Section 1 -- Definitions.
|
||||
|
||||
a. Adapted Material means material subject to Copyright and Similar
|
||||
Rights that is derived from or based upon the Licensed Material
|
||||
and in which the Licensed Material is translated, altered,
|
||||
arranged, transformed, or otherwise modified in a manner requiring
|
||||
permission under the Copyright and Similar Rights held by the
|
||||
Licensor. For purposes of this Public License, where the Licensed
|
||||
Material is a musical work, performance, or sound recording,
|
||||
Adapted Material is always produced where the Licensed Material is
|
||||
synched in timed relation with a moving image.
|
||||
|
||||
b. Adapter's License means the license You apply to Your Copyright
|
||||
and Similar Rights in Your contributions to Adapted Material in
|
||||
accordance with the terms and conditions of this Public License.
|
||||
|
||||
c. Copyright and Similar Rights means copyright and/or similar rights
|
||||
closely related to copyright including, without limitation,
|
||||
performance, broadcast, sound recording, and Sui Generis Database
|
||||
Rights, without regard to how the rights are labeled or
|
||||
categorized. For purposes of this Public License, the rights
|
||||
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
||||
Rights.
|
||||
|
||||
d. Effective Technological Measures means those measures that, in the
|
||||
absence of proper authority, may not be circumvented under laws
|
||||
fulfilling obligations under Article 11 of the WIPO Copyright
|
||||
Treaty adopted on December 20, 1996, and/or similar international
|
||||
agreements.
|
||||
|
||||
e. Exceptions and Limitations means fair use, fair dealing, and/or
|
||||
any other exception or limitation to Copyright and Similar Rights
|
||||
that applies to Your use of the Licensed Material.
|
||||
|
||||
f. Licensed Material means the artistic or literary work, database,
|
||||
or other material to which the Licensor applied this Public
|
||||
License.
|
||||
|
||||
g. Licensed Rights means the rights granted to You subject to the
|
||||
terms and conditions of this Public License, which are limited to
|
||||
all Copyright and Similar Rights that apply to Your use of the
|
||||
Licensed Material and that the Licensor has authority to license.
|
||||
|
||||
h. Licensor means the individual(s) or entity(ies) granting rights
|
||||
under this Public License.
|
||||
|
||||
i. Share means to provide material to the public by any means or
|
||||
process that requires permission under the Licensed Rights, such
|
||||
as reproduction, public display, public performance, distribution,
|
||||
dissemination, communication, or importation, and to make material
|
||||
available to the public including in ways that members of the
|
||||
public may access the material from a place and at a time
|
||||
individually chosen by them.
|
||||
|
||||
j. Sui Generis Database Rights means rights other than copyright
|
||||
resulting from Directive 96/9/EC of the European Parliament and of
|
||||
the Council of 11 March 1996 on the legal protection of databases,
|
||||
as amended and/or succeeded, as well as other essentially
|
||||
equivalent rights anywhere in the world.
|
||||
|
||||
k. You means the individual or entity exercising the Licensed Rights
|
||||
under this Public License. Your has a corresponding meaning.
|
||||
|
||||
|
||||
Section 2 -- Scope.
|
||||
|
||||
a. License grant.
|
||||
|
||||
1. Subject to the terms and conditions of this Public License,
|
||||
the Licensor hereby grants You a worldwide, royalty-free,
|
||||
non-sublicensable, non-exclusive, irrevocable license to
|
||||
exercise the Licensed Rights in the Licensed Material to:
|
||||
|
||||
a. reproduce and Share the Licensed Material, in whole or
|
||||
in part; and
|
||||
|
||||
b. produce, reproduce, and Share Adapted Material.
|
||||
|
||||
2. Exceptions and Limitations. For the avoidance of doubt, where
|
||||
Exceptions and Limitations apply to Your use, this Public
|
||||
License does not apply, and You do not need to comply with
|
||||
its terms and conditions.
|
||||
|
||||
3. Term. The term of this Public License is specified in Section
|
||||
6(a).
|
||||
|
||||
4. Media and formats; technical modifications allowed. The
|
||||
Licensor authorizes You to exercise the Licensed Rights in
|
||||
all media and formats whether now known or hereafter created,
|
||||
and to make technical modifications necessary to do so. The
|
||||
Licensor waives and/or agrees not to assert any right or
|
||||
authority to forbid You from making technical modifications
|
||||
necessary to exercise the Licensed Rights, including
|
||||
technical modifications necessary to circumvent Effective
|
||||
Technological Measures. For purposes of this Public License,
|
||||
simply making modifications authorized by this Section 2(a)
|
||||
(4) never produces Adapted Material.
|
||||
|
||||
5. Downstream recipients.
|
||||
|
||||
a. Offer from the Licensor -- Licensed Material. Every
|
||||
recipient of the Licensed Material automatically
|
||||
receives an offer from the Licensor to exercise the
|
||||
Licensed Rights under the terms and conditions of this
|
||||
Public License.
|
||||
|
||||
b. No downstream restrictions. You may not offer or impose
|
||||
any additional or different terms or conditions on, or
|
||||
apply any Effective Technological Measures to, the
|
||||
Licensed Material if doing so restricts exercise of the
|
||||
Licensed Rights by any recipient of the Licensed
|
||||
Material.
|
||||
|
||||
6. No endorsement. Nothing in this Public License constitutes or
|
||||
may be construed as permission to assert or imply that You
|
||||
are, or that Your use of the Licensed Material is, connected
|
||||
with, or sponsored, endorsed, or granted official status by,
|
||||
the Licensor or others designated to receive attribution as
|
||||
provided in Section 3(a)(1)(A)(i).
|
||||
|
||||
b. Other rights.
|
||||
|
||||
1. Moral rights, such as the right of integrity, are not
|
||||
licensed under this Public License, nor are publicity,
|
||||
privacy, and/or other similar personality rights; however, to
|
||||
the extent possible, the Licensor waives and/or agrees not to
|
||||
assert any such rights held by the Licensor to the limited
|
||||
extent necessary to allow You to exercise the Licensed
|
||||
Rights, but not otherwise.
|
||||
|
||||
2. Patent and trademark rights are not licensed under this
|
||||
Public License.
|
||||
|
||||
3. To the extent possible, the Licensor waives any right to
|
||||
collect royalties from You for the exercise of the Licensed
|
||||
Rights, whether directly or through a collecting society
|
||||
under any voluntary or waivable statutory or compulsory
|
||||
licensing scheme. In all other cases the Licensor expressly
|
||||
reserves any right to collect such royalties.
|
||||
|
||||
|
||||
Section 3 -- License Conditions.
|
||||
|
||||
Your exercise of the Licensed Rights is expressly made subject to the
|
||||
following conditions.
|
||||
|
||||
a. Attribution.
|
||||
|
||||
1. If You Share the Licensed Material (including in modified
|
||||
form), You must:
|
||||
|
||||
a. retain the following if it is supplied by the Licensor
|
||||
with the Licensed Material:
|
||||
|
||||
i. identification of the creator(s) of the Licensed
|
||||
Material and any others designated to receive
|
||||
attribution, in any reasonable manner requested by
|
||||
the Licensor (including by pseudonym if
|
||||
designated);
|
||||
|
||||
ii. a copyright notice;
|
||||
|
||||
iii. a notice that refers to this Public License;
|
||||
|
||||
iv. a notice that refers to the disclaimer of
|
||||
warranties;
|
||||
|
||||
v. a URI or hyperlink to the Licensed Material to the
|
||||
extent reasonably practicable;
|
||||
|
||||
b. indicate if You modified the Licensed Material and
|
||||
retain an indication of any previous modifications; and
|
||||
|
||||
c. indicate the Licensed Material is licensed under this
|
||||
Public License, and include the text of, or the URI or
|
||||
hyperlink to, this Public License.
|
||||
|
||||
2. You may satisfy the conditions in Section 3(a)(1) in any
|
||||
reasonable manner based on the medium, means, and context in
|
||||
which You Share the Licensed Material. For example, it may be
|
||||
reasonable to satisfy the conditions by providing a URI or
|
||||
hyperlink to a resource that includes the required
|
||||
information.
|
||||
|
||||
3. If requested by the Licensor, You must remove any of the
|
||||
information required by Section 3(a)(1)(A) to the extent
|
||||
reasonably practicable.
|
||||
|
||||
4. If You Share Adapted Material You produce, the Adapter's
|
||||
License You apply must not prevent recipients of the Adapted
|
||||
Material from complying with this Public License.
|
||||
|
||||
|
||||
Section 4 -- Sui Generis Database Rights.
|
||||
|
||||
Where the Licensed Rights include Sui Generis Database Rights that
|
||||
apply to Your use of the Licensed Material:
|
||||
|
||||
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
||||
to extract, reuse, reproduce, and Share all or a substantial
|
||||
portion of the contents of the database;
|
||||
|
||||
b. if You include all or a substantial portion of the database
|
||||
contents in a database in which You have Sui Generis Database
|
||||
Rights, then the database in which You have Sui Generis Database
|
||||
Rights (but not its individual contents) is Adapted Material; and
|
||||
|
||||
c. You must comply with the conditions in Section 3(a) if You Share
|
||||
all or a substantial portion of the contents of the database.
|
||||
|
||||
For the avoidance of doubt, this Section 4 supplements and does not
|
||||
replace Your obligations under this Public License where the Licensed
|
||||
Rights include other Copyright and Similar Rights.
|
||||
|
||||
|
||||
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
||||
|
||||
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
||||
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
||||
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
||||
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
||||
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
||||
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
||||
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
||||
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
||||
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
||||
|
||||
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
||||
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
||||
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
||||
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
||||
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
||||
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
||||
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
||||
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
||||
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
||||
|
||||
c. The disclaimer of warranties and limitation of liability provided
|
||||
above shall be interpreted in a manner that, to the extent
|
||||
possible, most closely approximates an absolute disclaimer and
|
||||
waiver of all liability.
|
||||
|
||||
|
||||
Section 6 -- Term and Termination.
|
||||
|
||||
a. This Public License applies for the term of the Copyright and
|
||||
Similar Rights licensed here. However, if You fail to comply with
|
||||
this Public License, then Your rights under this Public License
|
||||
terminate automatically.
|
||||
|
||||
b. Where Your right to use the Licensed Material has terminated under
|
||||
Section 6(a), it reinstates:
|
||||
|
||||
1. automatically as of the date the violation is cured, provided
|
||||
it is cured within 30 days of Your discovery of the
|
||||
violation; or
|
||||
|
||||
2. upon express reinstatement by the Licensor.
|
||||
|
||||
For the avoidance of doubt, this Section 6(b) does not affect any
|
||||
right the Licensor may have to seek remedies for Your violations
|
||||
of this Public License.
|
||||
|
||||
c. For the avoidance of doubt, the Licensor may also offer the
|
||||
Licensed Material under separate terms or conditions or stop
|
||||
distributing the Licensed Material at any time; however, doing so
|
||||
will not terminate this Public License.
|
||||
|
||||
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
||||
License.
|
||||
|
||||
|
||||
Section 7 -- Other Terms and Conditions.
|
||||
|
||||
a. The Licensor shall not be bound by any additional or different
|
||||
terms or conditions communicated by You unless expressly agreed.
|
||||
|
||||
b. Any arrangements, understandings, or agreements regarding the
|
||||
Licensed Material not stated herein are separate from and
|
||||
independent of the terms and conditions of this Public License.
|
||||
|
||||
|
||||
Section 8 -- Interpretation.
|
||||
|
||||
a. For the avoidance of doubt, this Public License does not, and
|
||||
shall not be interpreted to, reduce, limit, restrict, or impose
|
||||
conditions on any use of the Licensed Material that could lawfully
|
||||
be made without permission under this Public License.
|
||||
|
||||
b. To the extent possible, if any provision of this Public License is
|
||||
deemed unenforceable, it shall be automatically reformed to the
|
||||
minimum extent necessary to make it enforceable. If the provision
|
||||
cannot be reformed, it shall be severed from this Public License
|
||||
without affecting the enforceability of the remaining terms and
|
||||
conditions.
|
||||
|
||||
c. No term or condition of this Public License will be waived and no
|
||||
failure to comply consented to unless expressly agreed to by the
|
||||
Licensor.
|
||||
|
||||
d. Nothing in this Public License constitutes or may be interpreted
|
||||
as a limitation upon, or waiver of, any privileges and immunities
|
||||
that apply to the Licensor or You, including from the legal
|
||||
processes of any jurisdiction or authority.
|
||||
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons is not a party to its public
|
||||
licenses. Notwithstanding, Creative Commons may elect to apply one of
|
||||
its public licenses to material it publishes and in those instances
|
||||
will be considered the “Licensor.” The text of the Creative Commons
|
||||
public licenses is dedicated to the public domain under the CC0 Public
|
||||
Domain Dedication. Except for the limited purpose of indicating that
|
||||
material is shared under a Creative Commons public license or as
|
||||
otherwise permitted by the Creative Commons policies published at
|
||||
creativecommons.org/policies, Creative Commons does not authorize the
|
||||
use of the trademark "Creative Commons" or any other trademark or logo
|
||||
of Creative Commons without its prior written consent including,
|
||||
without limitation, in connection with any unauthorized modifications
|
||||
to any of its public licenses or any other arrangements,
|
||||
understandings, or agreements concerning use of licensed material. For
|
||||
the avoidance of doubt, this paragraph does not form part of the
|
||||
public licenses.
|
||||
|
||||
Creative Commons may be contacted at creativecommons.org.
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
Creative Commons Legal Code
|
||||
|
||||
CC0 1.0 Universal
|
||||
|
||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||
HEREUNDER.
|
||||
|
||||
Statement of Purpose
|
||||
|
||||
The laws of most jurisdictions throughout the world automatically confer
|
||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||
authorship and/or a database (each, a "Work").
|
||||
|
||||
Certain owners wish to permanently relinquish those rights to a Work for
|
||||
the purpose of contributing to a commons of creative, cultural and
|
||||
scientific works ("Commons") that the public can reliably and without fear
|
||||
of later claims of infringement build upon, modify, incorporate in other
|
||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||
and for any purposes, including without limitation commercial purposes.
|
||||
These owners may contribute to the Commons to promote the ideal of a free
|
||||
culture and the further production of creative, cultural and scientific
|
||||
works, or to gain reputation or greater distribution for their Work in
|
||||
part through the use and efforts of others.
|
||||
|
||||
For these and/or other purposes and motivations, and without any
|
||||
expectation of additional consideration or compensation, the person
|
||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||
|
||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||
protected by copyright and related or neighboring rights ("Copyright and
|
||||
Related Rights"). Copyright and Related Rights include, but are not
|
||||
limited to, the following:
|
||||
|
||||
i. the right to reproduce, adapt, distribute, perform, display,
|
||||
communicate, and translate a Work;
|
||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||
iii. publicity and privacy rights pertaining to a person's image or
|
||||
likeness depicted in a Work;
|
||||
iv. rights protecting against unfair competition in regards to a Work,
|
||||
subject to the limitations in paragraph 4(a), below;
|
||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||
in a Work;
|
||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||
European Parliament and of the Council of 11 March 1996 on the legal
|
||||
protection of databases, and under any national implementation
|
||||
thereof, including any amended or successor version of such
|
||||
directive); and
|
||||
vii. other similar, equivalent or corresponding rights throughout the
|
||||
world based on applicable law or treaty, and any national
|
||||
implementations thereof.
|
||||
|
||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||
of action, whether now known or unknown (including existing as well as
|
||||
future claims and causes of action), in the Work (i) in all territories
|
||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||
treaty (including future time extensions), (iii) in any current or future
|
||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||
including without limitation commercial, advertising or promotional
|
||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||
member of the public at large and to the detriment of Affirmer's heirs and
|
||||
successors, fully intending that such Waiver shall not be subject to
|
||||
revocation, rescission, cancellation, termination, or any other legal or
|
||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||
as contemplated by Affirmer's express Statement of Purpose.
|
||||
|
||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||
be judged legally invalid or ineffective under applicable law, then the
|
||||
Waiver shall be preserved to the maximum extent permitted taking into
|
||||
account Affirmer's express Statement of Purpose. In addition, to the
|
||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||
maximum duration provided by applicable law or treaty (including future
|
||||
time extensions), (iii) in any current or future medium and for any number
|
||||
of copies, and (iv) for any purpose whatsoever, including without
|
||||
limitation commercial, advertising or promotional purposes (the
|
||||
"License"). The License shall be deemed effective as of the date CC0 was
|
||||
applied by Affirmer to the Work. Should any part of the License for any
|
||||
reason be judged legally invalid or ineffective under applicable law, such
|
||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||
of the License, and in such case Affirmer hereby affirms that he or she
|
||||
will not (i) exercise any of his or her remaining Copyright and Related
|
||||
Rights in the Work or (ii) assert any associated claims and causes of
|
||||
action with respect to the Work, in either case contrary to Affirmer's
|
||||
express Statement of Purpose.
|
||||
|
||||
4. Limitations and Disclaimers.
|
||||
|
||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||
surrendered, licensed or otherwise affected by this document.
|
||||
b. Affirmer offers the Work as-is and makes no representations or
|
||||
warranties of any kind concerning the Work, express, implied,
|
||||
statutory or otherwise, including without limitation warranties of
|
||||
title, merchantability, fitness for a particular purpose, non
|
||||
infringement, or the absence of latent or other defects, accuracy, or
|
||||
the present or absence of errors, whether or not discoverable, all to
|
||||
the greatest extent permissible under applicable law.
|
||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||
that may apply to the Work or any use thereof, including without
|
||||
limitation any person's Copyright and Related Rights in the Work.
|
||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||
consents, permissions or other rights required for any use of the
|
||||
Work.
|
||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||
party to this document and has no duty or obligation with respect to
|
||||
this CC0 or use of the Work.
|
||||
@@ -1,9 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) <year> <copyright holders>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -5,12 +5,4 @@ Yet Another Aero Icon Set.
|
||||
## Repository Notes
|
||||
|
||||
The content submitted in Git repository doesn't include any binary assets.
|
||||
It only includes the code part of this repository for tracing the changes of code building this icon set.
|
||||
|
||||
## Status
|
||||
|
||||
Work in progress...
|
||||
|
||||
## License
|
||||
|
||||
See [LICENSES](LICENSE.md) for more details.
|
||||
It only includes code part of this icon set for tracing the change of build code.
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
version = 1
|
||||
SPDX-PackageName = "aurora-iconset"
|
||||
SPDX-PackageDownloadLocation = "https://github.com/SarasasChipWorkshop/aurora-iconset.git"
|
||||
|
||||
[[annotations]]
|
||||
path = [".gitignore"]
|
||||
precedence = "override"
|
||||
SPDX-FileCopyrightText = "None"
|
||||
SPDX-License-Identifier = "CC0-1.0"
|
||||
|
||||
[[annotations]]
|
||||
path = ["**.md"]
|
||||
precedence = "override"
|
||||
SPDX-FileCopyrightText = "None"
|
||||
SPDX-License-Identifier = "CC0-1.0"
|
||||
@@ -0,0 +1,5 @@
|
||||
# Todo
|
||||
|
||||
- Use "source" and "sink" to explicitly represent the input and output of job to replace current circumstance that use explicit job name to declare dependencies. After this change, the dependency network will be automaticlaly calculated from "source" and "sink" relation.
|
||||
- Support analysing the license info for each output artifacts respectively.
|
||||
- Peel `assemblicon` off as an independent repository and let the builder of this repository refer it.
|
||||
@@ -0,0 +1,35 @@
|
||||
Ivar Leidus, CC BY-SA 3.0 <https://creativecommons.org/licenses/by-sa/3.0>, via Wikimedia Commons
|
||||
https://commons.wikimedia.org/wiki/File:Niinsaare_j%C3%A4rv.jpg
|
||||
|
||||
Pascalou petit, CC BY-SA 3.0 <https://creativecommons.org/licenses/by-sa/3.0>, via Wikimedia Commons
|
||||
https://commons.wikimedia.org/wiki/File:Aster_Tataricus.JPG
|
||||
|
||||
https://commons.wikimedia.org/wiki/File:Great_pershing_balloon_derby_2005_09_04.jpg
|
||||
Balloon launch at the Great Pershing Balloon Derby near Brookfield, Missouri on September 4, 2005. Photo taken by Joe DeShon.
|
||||
This file is licensed under the Creative Commons Attribution 2.5 Generic license.
|
||||
|
||||
https://commons.wikimedia.org/wiki/File:Wild_Petunia_Blue_Flower_1.JPG
|
||||
I, Jonathan Zander, CC BY-SA 3.0 <http://creativecommons.org/licenses/by-sa/3.0/>, via Wikimedia Commons
|
||||
|
||||
https://commons.wikimedia.org/wiki/File:Daisy_(Argyranthemum_frutescens).jpg
|
||||
Fir0002, CC BY-SA 3.0 <http://creativecommons.org/licenses/by-sa/3.0/>, via Wikimedia Commons
|
||||
|
||||
https://commons.wikimedia.org/wiki/File:Nycticorax_nycticorax12.jpg
|
||||
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported, 2.5 Generic, 2.0 Generic and 1.0 Generic license.
|
||||
Calibas
|
||||
|
||||
https://commons.wikimedia.org/wiki/File:Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg
|
||||
This work is in the public domain in its country of origin and other countries and areas where the copyright term is the author's life plus 100 years or fewer.
|
||||
Vincent van Gogh
|
||||
Google Arts & Culture
|
||||
|
||||
https://commons.wikimedia.org/wiki/File:Tulipa_suaveolens_floriade_to_Canberra.jpg
|
||||
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
|
||||
John O'Neill
|
||||
|
||||
https://commons.wikimedia.org/wiki/File:International_hot_air_balloon_festival_in_leon_guanajuato_mexico_2012.jpg
|
||||
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
|
||||
Tomascastelazo
|
||||
https://commons.wikimedia.org/wiki/File:Hot-air_balloon_in_Tambov_-_02.jpg
|
||||
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
|
||||
Alexander Novikov
|
||||
@@ -1,15 +0,0 @@
|
||||
version = 1
|
||||
|
||||
[[annotations]]
|
||||
path = "Jokulsarlon_lake,_Iceland.jpg"
|
||||
precedence = "override"
|
||||
SPDX-FileComment = "Source: https://commons.wikimedia.org/wiki/File:Jokulsarlon_lake,_Iceland.jpg"
|
||||
SPDX-FileCopyrightText = "2006 Kenneth Muir"
|
||||
SPDX-License-Identifier = "CC-BY-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "Sky_Palette_by_Craig_Woodman.jpg"
|
||||
precedence = "override"
|
||||
SPDX-FileComment = "Source: https://commons.wikimedia.org/wiki/File:Sky_Palette_by_Craig_Woodman.jpg"
|
||||
SPDX-FileCopyrightText = "2020 Channel City Camera Club"
|
||||
SPDX-License-Identifier = "CC-BY-2.0"
|
||||
@@ -0,0 +1,63 @@
|
||||
[[licenses]]
|
||||
file = 'go-base.svg'
|
||||
license = "CC-BY-SA-4.0"
|
||||
authors = ["yyc12345"]
|
||||
|
||||
[[licenses]]
|
||||
file = 'go-inner-shining.svg'
|
||||
license = "CC-BY-SA-4.0"
|
||||
authors = ["yyc12345"]
|
||||
|
||||
[[licenses]]
|
||||
file = 'go-inner.svg'
|
||||
license = "Apache-2.0"
|
||||
authors = ["Google", "yyc12345"]
|
||||
source = 'https://github.com/google/material-design-icon'
|
||||
|
||||
[[licenses]]
|
||||
file = 'object-flip-horizontal.svg'
|
||||
license = "LGPL-2.1-only"
|
||||
authors = ["KDE Oxygen Icon Theme Team", "yyc12345"]
|
||||
source = 'https://invent.kde.org/frameworks/oxygen-icons'
|
||||
|
||||
[[licenses]]
|
||||
file = 'object-flip-vertical.svg'
|
||||
license = "LGPL-2.1-only"
|
||||
authors = ["KDE Oxygen Icon Theme Team", "yyc12345"]
|
||||
source = 'https://invent.kde.org/frameworks/oxygen-icons'
|
||||
|
||||
[[licenses]]
|
||||
file = 'object-rotate-left.svg'
|
||||
license = "LGPL-2.1-only"
|
||||
authors = ["KDE Oxygen Icon Theme Team", "yyc12345"]
|
||||
source = 'https://invent.kde.org/frameworks/oxygen-icons'
|
||||
|
||||
[[licenses]]
|
||||
file = 'object-rotate-right.svg'
|
||||
license = "LGPL-2.1-only"
|
||||
authors = ["KDE Oxygen Icon Theme Team", "yyc12345"]
|
||||
source = 'https://invent.kde.org/frameworks/oxygen-icons'
|
||||
|
||||
[[licenses]]
|
||||
file = 'object-rotate-right.svg'
|
||||
license = "LGPL-2.1-only"
|
||||
authors = ["KDE Oxygen Icon Theme Team", "yyc12345"]
|
||||
source = 'https://invent.kde.org/frameworks/oxygen-icons'
|
||||
|
||||
[[licenses]]
|
||||
file = 'dialog-infomation.svg'
|
||||
license = "LGPL-2.1-only"
|
||||
authors = ["KDE Oxygen Icon Theme Team", "yyc12345"]
|
||||
source = 'https://invent.kde.org/frameworks/oxygen-icons'
|
||||
|
||||
[[licenses]]
|
||||
file = 'dialog-warning.svg'
|
||||
license = "LGPL-2.1-only"
|
||||
authors = ["KDE Oxygen Icon Theme Team", "yyc12345"]
|
||||
source = 'https://invent.kde.org/frameworks/oxygen-icons'
|
||||
|
||||
[[licenses]]
|
||||
file = 'dialog-error.svg'
|
||||
license = "LGPL-2.1-only"
|
||||
authors = ["KDE Oxygen Icon Theme Team"]
|
||||
source = 'https://invent.kde.org/frameworks/oxygen-icons'
|
||||
@@ -1,75 +0,0 @@
|
||||
version = 1
|
||||
|
||||
[[annotations]]
|
||||
path = "go-base.svg"
|
||||
precedence = "override"
|
||||
SPDX-FileCopyrightText = "2026 yyc12345"
|
||||
SPDX-License-Identifier = "CC-BY-4.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "go-inner-shining.svg"
|
||||
precedence = "override"
|
||||
SPDX-FileCopyrightText = "2026 yyc12345"
|
||||
SPDX-License-Identifier = "CC-BY-4.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "go-inner.svg"
|
||||
precedence = "override"
|
||||
SPDX-FileComment = "Source: https://github.com/google/material-design-icon"
|
||||
SPDX-FileCopyrightText = ["2014-2026 Google", "2026 yyc12345"]
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "object-flip-horizontal.svg"
|
||||
precedence = "override"
|
||||
SPDX-FileComment = "Source: https://invent.kde.org/frameworks/oxygen-icons"
|
||||
SPDX-FileCopyrightText = ["2015-2026 KDE Oxygen Icon Theme Team", "2026 yyc12345"]
|
||||
SPDX-License-Identifier = "LGPL-2.1-only"
|
||||
|
||||
[[annotations]]
|
||||
path = "object-flip-vertical.svg"
|
||||
precedence = "override"
|
||||
SPDX-FileComment = "Source: https://invent.kde.org/frameworks/oxygen-icons"
|
||||
SPDX-FileCopyrightText = ["2015-2026 KDE Oxygen Icon Theme Team", "2026 yyc12345"]
|
||||
SPDX-License-Identifier = "LGPL-2.1-only"
|
||||
|
||||
[[annotations]]
|
||||
path = "object-rotate-left.svg"
|
||||
precedence = "override"
|
||||
SPDX-FileComment = "Source: https://invent.kde.org/frameworks/oxygen-icons"
|
||||
SPDX-FileCopyrightText = ["2015-2026 KDE Oxygen Icon Theme Team", "2026 yyc12345"]
|
||||
SPDX-License-Identifier = "LGPL-2.1-only"
|
||||
|
||||
[[annotations]]
|
||||
path = "object-rotate-right.svg"
|
||||
precedence = "override"
|
||||
SPDX-FileComment = "Source: https://invent.kde.org/frameworks/oxygen-icons"
|
||||
SPDX-FileCopyrightText = ["2015-2026 KDE Oxygen Icon Theme Team", "2026 yyc12345"]
|
||||
SPDX-License-Identifier = "LGPL-2.1-only"
|
||||
|
||||
[[annotations]]
|
||||
path = "image-png-checkerboard.svg"
|
||||
precedence = "override"
|
||||
SPDX-FileCopyrightText = "2026 yyc12345"
|
||||
SPDX-License-Identifier = "CC-BY-4.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "dialog-infomation.svg"
|
||||
precedence = "override"
|
||||
SPDX-FileComment = "Source: https://invent.kde.org/frameworks/oxygen-icons"
|
||||
SPDX-FileCopyrightText = ["2015-2026 KDE Oxygen Icon Theme Team", "2026 yyc12345"]
|
||||
SPDX-License-Identifier = "LGPL-2.1-only"
|
||||
|
||||
[[annotations]]
|
||||
path = "dialog-warning.svg"
|
||||
precedence = "override"
|
||||
SPDX-FileComment = "Source: https://invent.kde.org/frameworks/oxygen-icons"
|
||||
SPDX-FileCopyrightText = ["2015-2026 KDE Oxygen Icon Theme Team", "2026 yyc12345"]
|
||||
SPDX-License-Identifier = "LGPL-2.1-only"
|
||||
|
||||
[[annotations]]
|
||||
path = "dialog-error.svg"
|
||||
precedence = "override"
|
||||
SPDX-FileComment = "Source: https://invent.kde.org/frameworks/oxygen-icons"
|
||||
SPDX-FileCopyrightText = "2015-2026 KDE Oxygen Icon Theme Team"
|
||||
SPDX-License-Identifier = "LGPL-2.1-only"
|
||||
@@ -0,0 +1,9 @@
|
||||
[[licenses]]
|
||||
file = 'sarasacw-picture-frame.svg'
|
||||
license = "CC-BY-SA-4.0"
|
||||
authors = ["yyc12345"]
|
||||
|
||||
[[licenses]]
|
||||
file = 'notepad.blend'
|
||||
license = "CC-BY-SA-4.0"
|
||||
authors = ["yyc12345"]
|
||||
@@ -1,13 +0,0 @@
|
||||
version = 1
|
||||
|
||||
[[annotations]]
|
||||
path = "sarasacw-picture-frame.svg"
|
||||
precedence = "override"
|
||||
SPDX-FileCopyrightText = "2026 yyc12345"
|
||||
SPDX-License-Identifier = "CC-BY-4.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "notepad.blend"
|
||||
precedence = "override"
|
||||
SPDX-FileCopyrightText = "2026 yyc12345"
|
||||
SPDX-License-Identifier = "CC-BY-4.0"
|
||||
@@ -0,0 +1,23 @@
|
||||
[[licenses]]
|
||||
file = 'Niinsaare_järv.jpg'
|
||||
license = "CC-BY-SA-3.0"
|
||||
authors = ["Ivar Leidus"]
|
||||
source = 'https://commons.wikimedia.org/wiki/File:Niinsaare_j%C3%A4rv.jpg'
|
||||
|
||||
[[licenses]]
|
||||
file = 'Tulipa_suaveolens_floriade_to_Canberra.jpg'
|
||||
license = "CC-BY-SA-3.0"
|
||||
authors = ["John O'Neill"]
|
||||
source = 'https://commons.wikimedia.org/wiki/File:Tulipa_suaveolens_floriade_to_Canberra.jpg'
|
||||
|
||||
[[licenses]]
|
||||
file = 'Hot-air_balloon_in_Tambov_-_02.jpg'
|
||||
license = "CC-BY-SA-4.0"
|
||||
authors = ["Alexander Novikov"]
|
||||
source = 'https://commons.wikimedia.org/wiki/File:Hot-air_balloon_in_Tambov_-_02.jpg'
|
||||
|
||||
[[licenses]]
|
||||
file = 'Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg'
|
||||
license = "CC0-1.0" # Public Domain actually.
|
||||
authors = ["Vincent van Gogh", "Google Arts & Culture"]
|
||||
source = 'https://commons.wikimedia.org/wiki/File:Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg'
|
||||
@@ -1,35 +0,0 @@
|
||||
version = 1
|
||||
|
||||
[[annotations]]
|
||||
path = "Herbert_Lake_beim_Icefields_Parkway.jpg"
|
||||
precedence = "override"
|
||||
SPDX-FileComment = "Source: https://commons.wikimedia.org/wiki/File:Herbert_Lake_beim_Icefields_Parkway.jpg"
|
||||
SPDX-FileCopyrightText = "2012 Florian Fuchs"
|
||||
SPDX-License-Identifier = "CC-BY-3.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "Narzisse.jpg"
|
||||
precedence = "override"
|
||||
SPDX-FileComment = "Source: https://commons.wikimedia.org/wiki/File:Narzisse.jpg"
|
||||
SPDX-FileCopyrightText = "2008 Martin Hirtreiter"
|
||||
SPDX-License-Identifier = "CC-BY-3.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "Narzisse-mask.png"
|
||||
precedence = "override"
|
||||
SPDX-FileCopyrightText = "2026 yyc12345"
|
||||
SPDX-License-Identifier = "CC-BY-4.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "Kite_(23729899095).jpg"
|
||||
precedence = "override"
|
||||
SPDX-FileComment = "Source: https://commons.wikimedia.org/wiki/File:Kite_(23729899095).jpg"
|
||||
SPDX-FileCopyrightText = "2015 Nebojsa Ljuboja"
|
||||
SPDX-License-Identifier = "CC-BY-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg"
|
||||
precedence = "override"
|
||||
SPDX-FileComment = "Source: https://commons.wikimedia.org/wiki/File:Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg"
|
||||
SPDX-FileCopyrightText = ["1889 Vincent van Gogh", "Google Arts & Culture"]
|
||||
SPDX-License-Identifier = "CC0-1.0" # Public Domain actually.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 96 KiB |
@@ -0,0 +1,32 @@
|
||||
[[licenses]]
|
||||
file = 'image-base.svg'
|
||||
license = "CC-BY-SA-4.0"
|
||||
authors = ["yyc12345"]
|
||||
|
||||
[[licenses]]
|
||||
file = 'generic-background.svg'
|
||||
license = "CC-BY-SA-4.0"
|
||||
authors = ["yyc12345"]
|
||||
|
||||
[[licenses]]
|
||||
file = 'triangle.svg'
|
||||
license = "Apache-2.0"
|
||||
authors = ["Austin Andrews", "yyc12345"]
|
||||
source = 'https://pictogrammers.com/library/mdi/icon/menu-left/'
|
||||
|
||||
[[licenses]]
|
||||
file = 'magnifying-glass.blend'
|
||||
license = "CC-BY-SA-4.0"
|
||||
authors = ["yyc12345"]
|
||||
|
||||
[[licenses]]
|
||||
file = 'minus.svg'
|
||||
license = "Apache-2.0"
|
||||
authors = ["Google", "yyc12345"]
|
||||
source = 'https://github.com/google/material-design-icon'
|
||||
|
||||
[[licenses]]
|
||||
file = 'plus.svg'
|
||||
license = "Apache-2.0"
|
||||
authors = ["Google", "yyc12345"]
|
||||
source = 'https://github.com/google/material-design-icon'
|
||||
@@ -1,40 +0,0 @@
|
||||
version = 1
|
||||
|
||||
[[annotations]]
|
||||
path = "image-base.svg"
|
||||
precedence = "override"
|
||||
SPDX-FileCopyrightText = "2026 yyc12345"
|
||||
SPDX-License-Identifier = "CC-BY-4.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "generic-background.svg"
|
||||
precedence = "override"
|
||||
SPDX-FileCopyrightText = "2026 yyc12345"
|
||||
SPDX-License-Identifier = "CC-BY-4.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "triangle.svg"
|
||||
precedence = "override"
|
||||
SPDX-FileComment = "Source: https://github.com/Templarian/MaterialDesign"
|
||||
SPDX-FileCopyrightText = ["2014-2025 Austin Andrews", "2026 yyc12345"]
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "magnifying-glass.blend"
|
||||
precedence = "override"
|
||||
SPDX-FileCopyrightText = "2026 yyc12345"
|
||||
SPDX-License-Identifier = "CC-BY-4.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "minus.svg"
|
||||
precedence = "override"
|
||||
SPDX-FileComment = "Source: https://github.com/google/material-design-icon"
|
||||
SPDX-FileCopyrightText = ["2014-2026 Google", "2026 yyc12345"]
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "plus.svg"
|
||||
precedence = "override"
|
||||
SPDX-FileComment = "Source: https://github.com/google/material-design-icon"
|
||||
SPDX-FileCopyrightText = ["2014-2026 Google", "2026 yyc12345"]
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
@@ -1,7 +0,0 @@
|
||||
version = 1
|
||||
|
||||
[[annotations]]
|
||||
path = "vector-image-inner.blend"
|
||||
precedence = "override"
|
||||
SPDX-FileCopyrightText = "2026 yyc12345"
|
||||
SPDX-License-Identifier = "CC-BY-4.0"
|
||||
@@ -1,7 +0,0 @@
|
||||
version = 1
|
||||
|
||||
[[annotations]]
|
||||
path = "**"
|
||||
precedence = "override"
|
||||
SPDX-FileCopyrightText = "2026 Sarasa's Chip Workshop"
|
||||
SPDX-License-Identifier = "MIT"
|
||||
+1
-4
@@ -8,7 +8,7 @@ authors = [
|
||||
]
|
||||
requires-python = ">=3.13"
|
||||
dependencies = [
|
||||
"assemblicon",
|
||||
"pillow>=12.3.0",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
@@ -17,6 +17,3 @@ aurora-iconset-builder = "aurora_iconset_builder:main"
|
||||
[build-system]
|
||||
requires = ["uv_build>=0.8.0,<0.9"]
|
||||
build-backend = "uv_build"
|
||||
|
||||
[tool.uv.sources]
|
||||
assemblicon = { git = "https://github.com/SarasasChipWorkshop/assemblicon" }
|
||||
@@ -1,13 +1,7 @@
|
||||
from pathlib import Path
|
||||
from assemblicon.highlevel.utils import (
|
||||
DEFAULT_FD_THUMBNAIL_HWS,
|
||||
DEFAULT_MSIX_SCALES,
|
||||
DEFAULT_MSIX_APP44_TARGETSIZES,
|
||||
DEFAULT_MSIX_EXT_TARGETSIZES,
|
||||
)
|
||||
from assemblicon.highlevel.environment import Environment
|
||||
from assemblicon.highlevel.context import Context
|
||||
from assemblicon.logger import APP_LOGGER as LOGGER
|
||||
from .assemblicon.highlevel.environment import Environment
|
||||
from .assemblicon.highlevel.context import Context
|
||||
from .assemblicon.logger import APP_LOGGER as LOGGER
|
||||
from .cli import parse
|
||||
from .types import AuroraPrologue, AuroraContext
|
||||
from . import std_icons, nostd_icons
|
||||
@@ -25,15 +19,7 @@ def main() -> None:
|
||||
iconset_input = repository_root / "src"
|
||||
iconset_output = repository_root / "artifact"
|
||||
prologue = AuroraPrologue(
|
||||
iconset_input,
|
||||
iconset_output,
|
||||
opts.svg_render,
|
||||
DEFAULT_FD_THUMBNAIL_HWS,
|
||||
DEFAULT_MSIX_SCALES,
|
||||
DEFAULT_MSIX_APP44_TARGETSIZES,
|
||||
DEFAULT_MSIX_EXT_TARGETSIZES,
|
||||
tempdir_initializer,
|
||||
opts.format_selection,
|
||||
iconset_input, iconset_output, opts.svg_render, tempdir_initializer
|
||||
)
|
||||
env = Environment(prologue)
|
||||
ctx = Context(env)
|
||||
|
||||
Whitespace-only changes.
@@ -0,0 +1,108 @@
|
||||
import enum
|
||||
from typing import Optional
|
||||
from pathlib import Path
|
||||
from argparse import ArgumentParser, Namespace
|
||||
from dataclasses import dataclass
|
||||
from .lowlevel.artrdr import SvgRenderKind
|
||||
|
||||
|
||||
class CliSvgRenderKind(enum.StrEnum):
|
||||
Inkscape = "inkscape"
|
||||
ReSvg = "resvg"
|
||||
|
||||
def to_assemblicon_type(self) -> SvgRenderKind:
|
||||
match self:
|
||||
case CliSvgRenderKind.Inkscape:
|
||||
return SvgRenderKind.Inkscape
|
||||
case CliSvgRenderKind.ReSvg:
|
||||
return SvgRenderKind.ReSvg
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class StdOpts:
|
||||
"""Assemblicon standard command line options"""
|
||||
|
||||
input_directory: Optional[Path]
|
||||
"""The path to input directory. None if you doesn't request it."""
|
||||
output_directory: Optional[Path]
|
||||
"""The path to output directory. None if you doesn't request it."""
|
||||
selection: Optional[list[str]]
|
||||
"""The list holding all name of jobs for building."""
|
||||
svg_render: CliSvgRenderKind
|
||||
"""The render kind for SVG file."""
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class StdOptsSetup:
|
||||
require_input: bool
|
||||
"""Whether add input path option in argument parser."""
|
||||
require_output: bool
|
||||
"""Whether add outputput path option in argument parser."""
|
||||
|
||||
|
||||
def create_argparser(setup: StdOptsSetup) -> ArgumentParser:
|
||||
"""
|
||||
Create Assemblicon standard argument parser.
|
||||
|
||||
This argument parser are filled properly with the requirement of Assemblicon itself.
|
||||
It can be directly used or modified with extra options.
|
||||
|
||||
:param cfg: The setup of argument parser.
|
||||
:return: The built argument parser.
|
||||
"""
|
||||
parser = ArgumentParser(
|
||||
prog="Assemblicon",
|
||||
description="The Programmatic Icon Assembly Workflow.",
|
||||
)
|
||||
if setup.require_input:
|
||||
parser.add_argument(
|
||||
"-i",
|
||||
"--input",
|
||||
dest="input",
|
||||
action="store",
|
||||
type=Path,
|
||||
required=True,
|
||||
help="The path to input directory.",
|
||||
metavar="DIR",
|
||||
)
|
||||
if setup.require_output:
|
||||
parser.add_argument(
|
||||
"-o",
|
||||
"--output",
|
||||
dest="output",
|
||||
action="store",
|
||||
type=Path,
|
||||
required=True,
|
||||
help="The path to output directory.",
|
||||
metavar="DIR",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-t",
|
||||
"--select",
|
||||
dest="selection",
|
||||
action="extend",
|
||||
nargs="+",
|
||||
type=str,
|
||||
help="Only build given name represented jobs.",
|
||||
metavar="RENDER",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-s",
|
||||
"--svg-render",
|
||||
dest="svg_render",
|
||||
action="store",
|
||||
type=CliSvgRenderKind,
|
||||
default=CliSvgRenderKind.Inkscape,
|
||||
help="The render used for rendering SVG into PNG.",
|
||||
metavar="RENDER",
|
||||
)
|
||||
return parser
|
||||
|
||||
|
||||
def parse_standard_opts(cfg: StdOptsSetup, ns: Namespace) -> StdOpts:
|
||||
return StdOpts(
|
||||
input_directory=ns.input if cfg.require_input else None,
|
||||
output_directory=ns.output if cfg.require_output else None,
|
||||
selection=ns.selection,
|
||||
svg_render=ns.svg_render,
|
||||
)
|
||||
@@ -0,0 +1,123 @@
|
||||
import math
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass
|
||||
class Point:
|
||||
"""A point (or vector) on 2D plane with integer coordinates."""
|
||||
|
||||
x: int
|
||||
y: int
|
||||
|
||||
@staticmethod
|
||||
def from_tuple(t: tuple[int, int]) -> "Point":
|
||||
return Point(t[0], t[1])
|
||||
|
||||
def __add__(self, other: "Point") -> "Point":
|
||||
if not isinstance(other, Point):
|
||||
return NotImplemented
|
||||
return Point(self.x + other.x, self.y + other.y)
|
||||
|
||||
def __sub__(self, other: "Point") -> "Point":
|
||||
if not isinstance(other, Point):
|
||||
return NotImplemented
|
||||
return Point(self.x - other.x, self.y - other.y)
|
||||
|
||||
def __neg__(self) -> "Point":
|
||||
return Point(-self.x, -self.y)
|
||||
|
||||
def __mul__(self, other: int | float) -> "Point":
|
||||
if not isinstance(other, (int, float)):
|
||||
return NotImplemented
|
||||
return Point(math.floor(self.x * other), math.floor(self.y * other))
|
||||
|
||||
def __rmul__(self, other: int | float) -> "Point":
|
||||
return self.__mul__(other)
|
||||
|
||||
def __floordiv__(self, other: int | float) -> "Point":
|
||||
if not isinstance(other, (int, float)):
|
||||
return NotImplemented
|
||||
return Point(math.floor(self.x / other), math.floor(self.y / other))
|
||||
|
||||
def to_tuple(self) -> tuple[int, int]:
|
||||
"""
|
||||
Create the tuple representing this point by ``(x, y)``
|
||||
which can be used by Pillow.
|
||||
"""
|
||||
return (self.x, self.y)
|
||||
|
||||
|
||||
@dataclass
|
||||
class Rectangle:
|
||||
"""
|
||||
A rectangle framed by two corner points.
|
||||
|
||||
pos1 is always assumed to be the top-left corner and pos2 the
|
||||
bottom-right one. This relation is a pure convention and is never
|
||||
validated: constructing a Rectangle with swapped or inverted corners
|
||||
produces a meaningless-but-silent result.
|
||||
"""
|
||||
|
||||
pos1: Point
|
||||
pos2: Point
|
||||
|
||||
@staticmethod
|
||||
def from_tuple(t: tuple[int, int, int, int]) -> "Rectangle":
|
||||
return Rectangle(Point(t[0], t[1]), Point(t[2], t[3]))
|
||||
|
||||
@staticmethod
|
||||
def from_min_max_rect(pos1: Point, pos2: Point) -> "Rectangle":
|
||||
return Rectangle(pos1, pos2)
|
||||
|
||||
@staticmethod
|
||||
def from_pos_size_rect(pos: Point, width: int, height: int) -> "Rectangle":
|
||||
return Rectangle(pos, pos + Point(width, height))
|
||||
|
||||
@staticmethod
|
||||
def from_margin_rect(
|
||||
width: int, height: int, top: int, right: int, bottom: int, left: int
|
||||
) -> "Rectangle":
|
||||
"""
|
||||
Create the rectangle with the size of this region's parent, and the margin between this region and its parent.
|
||||
|
||||
:param width: The width of parent.
|
||||
:param height: The height of parent.
|
||||
:param top: The distance from this rectangle to the top border of parent.
|
||||
:param right: The distance from this rectangle to the right border of parent.
|
||||
:param bottom: The distance from this rectangle to the bottom border of parent.
|
||||
:param left: The distance from this rectangle to the top border of parent.
|
||||
"""
|
||||
return Rectangle(Point(left, top), Point(width - right, height - bottom))
|
||||
|
||||
@staticmethod
|
||||
def from_padding_rect(
|
||||
pos: Point, top: int, right: int, bottom: int, left: int
|
||||
) -> "Rectangle":
|
||||
"""
|
||||
Create the rectangle with the central point in this region's parent, and the padding between this point and region's border.
|
||||
|
||||
:param x: The X factor of reference point.
|
||||
:param y: The Y factor of reference point.
|
||||
:param top: The distance from reference point to this rectangle's top border.
|
||||
:param right: The distance from reference point to this rectangle's right border.
|
||||
:param bottom: The distance from reference point to this rectangle's bottom border.
|
||||
:param left: The distance from reference point to this rectangle's left border.
|
||||
"""
|
||||
return Rectangle(
|
||||
Point(pos.x - left, pos.y - top), Point(pos.x + right, pos.y + bottom)
|
||||
)
|
||||
|
||||
@property
|
||||
def width(self) -> int:
|
||||
return self.pos2.x - self.pos1.x
|
||||
|
||||
@property
|
||||
def height(self) -> int:
|
||||
return self.pos2.y - self.pos1.y
|
||||
|
||||
def to_tuple(self) -> tuple[int, int, int, int]:
|
||||
"""
|
||||
Create the tuple representing this rectangle by ``(x1, y2 x2, y2)``
|
||||
which can be used by Pillow.
|
||||
"""
|
||||
return (self.pos1.x, self.pos1.y, self.pos2.x, self.pos2.y)
|
||||
Whitespace-only changes.
@@ -0,0 +1,40 @@
|
||||
import enum
|
||||
|
||||
|
||||
class AddressDomain(enum.IntEnum):
|
||||
Input = enum.auto()
|
||||
Temporary = enum.auto()
|
||||
Output = enum.auto()
|
||||
|
||||
FdOutput = enum.auto()
|
||||
WinOutput = enum.auto()
|
||||
MacOutput = enum.auto()
|
||||
|
||||
|
||||
class Address:
|
||||
"""The unique identity of an artifact slot (source/sink)."""
|
||||
|
||||
__domain: AddressDomain
|
||||
__subdirectories: tuple[str, ...]
|
||||
|
||||
def __init__(self, domain: AddressDomain, *args: str) -> None:
|
||||
self.__domain = domain
|
||||
self.__subdirectories = tuple(args)
|
||||
|
||||
def __hash__(self) -> int:
|
||||
return hash((self.__domain.value,) + self.__subdirectories)
|
||||
|
||||
def __eq__(self, other: object) -> bool:
|
||||
if self is other:
|
||||
return True
|
||||
|
||||
if not isinstance(other, Address):
|
||||
return NotImplemented
|
||||
|
||||
return (
|
||||
self.__domain == other.__domain
|
||||
and self.__subdirectories == other.__subdirectories
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"Address({self.__domain.name}, {'/'.join(self.__subdirectories)})"
|
||||
@@ -0,0 +1,191 @@
|
||||
from collections import deque
|
||||
from dataclasses import dataclass
|
||||
from typing import Iterable, TypeVar, Generic, Protocol, Callable, cast
|
||||
from .environment import Environment, Prologue
|
||||
from .address import Address
|
||||
from .source import Source
|
||||
from .sink import Sink
|
||||
from ..logger import HIGHLEVEL_LOGGER as LOGGER
|
||||
|
||||
|
||||
P = TypeVar("P", bound=Prologue)
|
||||
|
||||
|
||||
class Executor[*Ts](Protocol):
|
||||
def __call__(self, *args: *Ts) -> None: ...
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Job:
|
||||
"""
|
||||
The class represents a type-erased job.
|
||||
Precise typing lives only in register's signature.
|
||||
"""
|
||||
|
||||
name: str
|
||||
"""The name of this job."""
|
||||
ios: tuple[Source | Sink, ...]
|
||||
"""The sources and sinks of this job."""
|
||||
executor: Callable[..., None]
|
||||
"""The executor of this job."""
|
||||
|
||||
|
||||
class Context(Generic[P]):
|
||||
__jobs: dict[str, Job]
|
||||
"""The dict storing all jobs. Key is job name and value is job payload."""
|
||||
__env: Environment[P]
|
||||
"""The shared environment passed to every job executor."""
|
||||
|
||||
def __init__(self, env: Environment[P]) -> None:
|
||||
self.__jobs = {}
|
||||
self.__env = env
|
||||
|
||||
def run(self, selected: Iterable[str] | None) -> None:
|
||||
"""
|
||||
Execute builder with given selections.
|
||||
|
||||
The selected jobs, together with all their transitive dependencies,
|
||||
are resolved and topologically sorted (Kahn's algorithm), then
|
||||
executed sequentially with the shared environment. The chain is
|
||||
aborted on the first failing executor.
|
||||
|
||||
Job dependencies are not declared explicitly. They are inferred
|
||||
from the job IO declarations instead: a job depends on the
|
||||
producer of every address required by one of its sources.
|
||||
|
||||
:param selected: Only build jobs matching these given names.
|
||||
Their dependencies are always built first. None for building
|
||||
all jobs.
|
||||
:raises ValueError: If a selected job name is unknown, some
|
||||
address is produced more than once (by one or several
|
||||
jobs), some required address has no producer at all, or the
|
||||
inferred dependency graph contains a cycle (including
|
||||
self-dependencies).
|
||||
"""
|
||||
# Step 0: build the producer table over all registered jobs,
|
||||
# mapping every produced address to its producing job name.
|
||||
# An address produced more than once is rejected right here,
|
||||
# even if it is never actually required: the producers may be
|
||||
# several jobs, or a single job declaring several identical
|
||||
# sinks.
|
||||
producers: dict[Address, str] = {}
|
||||
for name, job in self.__jobs.items():
|
||||
for item in job.ios:
|
||||
if not isinstance(item, Sink):
|
||||
continue
|
||||
addr = item.address
|
||||
prev = producers.get(addr)
|
||||
if prev is not None and prev == name:
|
||||
raise ValueError(
|
||||
f'Job "{name}" declares multiple sinks '
|
||||
f"producing the same address {addr!r}."
|
||||
)
|
||||
if prev is not None:
|
||||
raise ValueError(
|
||||
f"Address {addr!r} is produced by both job "
|
||||
f'"{prev}" and "{name}".'
|
||||
)
|
||||
producers[addr] = name
|
||||
|
||||
# Step 1: resolve the selection closure. Collect the selected
|
||||
# jobs themselves plus, transitively, every job producing an
|
||||
# address one of their sources requires. A source whose address
|
||||
# is ``None`` depends on nothing.
|
||||
needed: set[str] = set()
|
||||
pending = list(self.__jobs.keys()) if selected is None else list(selected)
|
||||
while pending:
|
||||
name = pending.pop()
|
||||
if name in needed:
|
||||
continue
|
||||
job = self.__jobs.get(name)
|
||||
if job is None:
|
||||
raise ValueError(f'Unknown job name: "{name}"')
|
||||
needed.add(name)
|
||||
for item in job.ios:
|
||||
if not isinstance(item, Source):
|
||||
continue
|
||||
addr = item.address
|
||||
if addr is None:
|
||||
continue
|
||||
producer = producers.get(addr)
|
||||
if producer is None:
|
||||
raise ValueError(
|
||||
f'Job "{name}" requires resource {addr!r} '
|
||||
f"but no registered job produces it."
|
||||
)
|
||||
if producer == name:
|
||||
raise ValueError(
|
||||
f'Job "{name}" requires resource {addr!r} '
|
||||
f"which is produced by itself."
|
||||
)
|
||||
pending.append(producer)
|
||||
|
||||
# Step 2: Kahn topological sort over the sub-graph induced by "needed".
|
||||
# "in_degree": key is a job name, value is how many of its (needed)
|
||||
# dependencies are not built yet.
|
||||
# "dependents": key is a job name, value is the list of jobs in
|
||||
# "needed" that directly depend on the key job.
|
||||
in_degree: dict[str, int] = {name: 0 for name in needed}
|
||||
dependents: dict[str, list[str]] = {name: [] for name in needed}
|
||||
for name in needed:
|
||||
# "deps": the names of jobs producing resources this job
|
||||
# requires, deduplicated
|
||||
deps: set[str] = set()
|
||||
for item in self.__jobs[name].ios:
|
||||
if not isinstance(item, Source):
|
||||
continue
|
||||
addr = item.address
|
||||
if addr is None:
|
||||
continue
|
||||
deps.add(producers[addr])
|
||||
for dep in deps:
|
||||
dependents[dep].append(name)
|
||||
in_degree[name] += 1
|
||||
queue = deque(
|
||||
name for name in self.__jobs if name in needed and in_degree[name] == 0
|
||||
)
|
||||
order: list[str] = []
|
||||
while queue:
|
||||
name = queue.popleft()
|
||||
order.append(name)
|
||||
for dependent in dependents[name]:
|
||||
in_degree[dependent] -= 1
|
||||
if in_degree[dependent] == 0:
|
||||
queue.append(dependent)
|
||||
if len(order) != len(needed):
|
||||
cyclic = sorted(needed - set(order))
|
||||
raise ValueError(f"Dependency cycle detected among jobs: {cyclic}")
|
||||
|
||||
# Step 3: execute the build chain in resolved order, feeding
|
||||
# the shared environment and the declared IO items to each
|
||||
# executor.
|
||||
for name in order:
|
||||
LOGGER.info('Running job "%s"...', name)
|
||||
self.__jobs[name].executor(self.__env, *self.__jobs[name].ios)
|
||||
|
||||
def register[*Ts](
|
||||
self,
|
||||
name: str,
|
||||
ios: tuple[*Ts],
|
||||
executor: Executor[Environment[P], *Ts],
|
||||
) -> None:
|
||||
"""
|
||||
Register a new job with given name, dependencies and executor.
|
||||
|
||||
:param name: The name of job.
|
||||
:param ios: A tuple declares ths sources and sinks of this job.
|
||||
These sources and sinks will be directly passed to executor.
|
||||
:param exec: The executor of this job.
|
||||
"""
|
||||
# check job name collision
|
||||
if name in self.__jobs:
|
||||
raise ValueError(f'Can not register 2 jobs with same name: "{name}"')
|
||||
# check the type of sources and sinks
|
||||
for item in ios:
|
||||
if not isinstance(item, (Source, Sink)):
|
||||
raise TypeError(
|
||||
f"All items in the ios of job {name!r} must be instances "
|
||||
f"of Source or Sink, but got {type(item)}."
|
||||
)
|
||||
|
||||
self.__jobs[name] = Job(name, cast(tuple[Source | Sink, ...], ios), executor)
|
||||
@@ -0,0 +1,193 @@
|
||||
import tempfile
|
||||
import os
|
||||
from typing import Optional
|
||||
from types import TracebackType
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from typing import TypeVar, Generic, Callable
|
||||
from ..lowlevel.environment import Prologue as LowPrologue, Environment as LowEnv
|
||||
from ..lowlevel.artrdr import SvgRenderKind
|
||||
from .utils import FdContext, WinCategory, MacCategory, FD_THUMBNAIL_HWS
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Prologue(LowPrologue):
|
||||
svg_render: SvgRenderKind
|
||||
"""The render kind for SVG"""
|
||||
temp_dir_initializer: Callable[[Path], None] | None
|
||||
"""
|
||||
The extra initializer for user temporary directory.
|
||||
The only argument in function is the path to user temporary directory.
|
||||
``None`` for no extra initializer.
|
||||
"""
|
||||
|
||||
|
||||
_TEMP_USER_DIR: str = "user"
|
||||
_TEMP_LIB_DIR: str = "assemblicon"
|
||||
_TEMP_LIB_ALLOC_DIR: str = "alloc"
|
||||
_TEMP_LIB_STABLE_DIR: str = "stable"
|
||||
|
||||
_ART_WIN: str = "windows"
|
||||
_ART_MAC: str = "macos"
|
||||
|
||||
P = TypeVar("P", bound=Prologue)
|
||||
|
||||
|
||||
class Environment(Generic[P]):
|
||||
__prologue: P
|
||||
"""The prologue used for environment."""
|
||||
__lowenv: LowEnv
|
||||
"""The lowlevel environment managing temporary directory."""
|
||||
|
||||
def __init__(self, prologue: P) -> None:
|
||||
self.__prologue = prologue
|
||||
self.__lowenv = LowEnv(self.__prologue)
|
||||
|
||||
# construct basic layout of temporary directory
|
||||
self.__temporary_artifact(_TEMP_USER_DIR).mkdir(parents=True, exist_ok=True)
|
||||
self.__temporary_artifact(_TEMP_LIB_DIR, _TEMP_LIB_ALLOC_DIR).mkdir(
|
||||
parents=True, exist_ok=True
|
||||
)
|
||||
self.__temporary_artifact(_TEMP_LIB_DIR, _TEMP_LIB_STABLE_DIR).mkdir(
|
||||
parents=True, exist_ok=True
|
||||
)
|
||||
# and output directory
|
||||
for hw in FD_THUMBNAIL_HWS:
|
||||
for kind in FdContext:
|
||||
self.__output_artifact(f"{hw}x{hw}", str(kind)).mkdir(
|
||||
parents=True, exist_ok=True
|
||||
)
|
||||
for kind in WinCategory:
|
||||
self.__output_artifact(_ART_WIN, str(kind)).mkdir(
|
||||
parents=True, exist_ok=True
|
||||
)
|
||||
for kind in MacCategory:
|
||||
self.__output_artifact(_ART_MAC, str(kind)).mkdir(
|
||||
parents=True, exist_ok=True
|
||||
)
|
||||
|
||||
# construct user custom temporary layout of possible
|
||||
if self.__prologue.temp_dir_initializer is not None:
|
||||
temp_dir = self.user_temporary_artifact()
|
||||
self.__prologue.temp_dir_initializer(temp_dir)
|
||||
|
||||
# region: With Visitor Requirements
|
||||
|
||||
def __enter__(self) -> "Environment":
|
||||
self.__lowenv.__enter__()
|
||||
return self
|
||||
|
||||
def __exit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_value: BaseException | None,
|
||||
traceback: TracebackType | None,
|
||||
) -> None:
|
||||
self.__lowenv.__exit__(exc_type, exc_value, traceback)
|
||||
|
||||
# endregion
|
||||
|
||||
# region: Prologue Visitor
|
||||
|
||||
@property
|
||||
def prologue(self) -> Prologue:
|
||||
return self.__prologue
|
||||
|
||||
@property
|
||||
def user_prologue(self) -> P:
|
||||
return self.__prologue
|
||||
|
||||
# endregion
|
||||
|
||||
# region: Input Artifact
|
||||
|
||||
def input_artifact(self, *args: str) -> Path:
|
||||
"""
|
||||
Get the path to input artifact.
|
||||
"""
|
||||
return self.__lowenv.input_artifact(*args)
|
||||
|
||||
# endregion
|
||||
|
||||
# region: Temporary Artifact
|
||||
|
||||
def __temporary_artifact(self, *args: str) -> Path:
|
||||
return self.__lowenv.temporary_artifact(*args)
|
||||
|
||||
def user_temporary_artifact(self, *args: str) -> Path:
|
||||
return self.__temporary_artifact(_TEMP_USER_DIR, *args)
|
||||
|
||||
def __lib_temporary_artifact(self, *args: str) -> Path:
|
||||
return self.__temporary_artifact(_TEMP_LIB_DIR, *args)
|
||||
|
||||
def __allocate_lib_temporary_artifact(self, suffix: Optional[str] = None) -> Path:
|
||||
p = self.__lib_temporary_artifact(_TEMP_LIB_ALLOC_DIR)
|
||||
(fd, pf) = tempfile.mkstemp(suffix=suffix, prefix=None, dir=str(p), text=False)
|
||||
os.close(fd)
|
||||
return Path(pf)
|
||||
|
||||
def __fetch_const_lib_temporary_artifact(self, name: str) -> Path:
|
||||
return self.__lib_temporary_artifact(_TEMP_LIB_STABLE_DIR, name)
|
||||
|
||||
def allocate_lib_render_temporary_artifact(self) -> Path:
|
||||
"""
|
||||
Allocated a path pointing to temporary render result.
|
||||
|
||||
:return: The path to temporary PNG file.
|
||||
Please note that this file is already presneted in file system,
|
||||
so caller need to overwrite it.
|
||||
"""
|
||||
return self.__allocate_lib_temporary_artifact(".png")
|
||||
|
||||
def fetch_lib_blender_script_temporary_artifact(self) -> Path:
|
||||
"""
|
||||
Allocated a path pointing to temporary script instructing Blender render.
|
||||
|
||||
:return: The path to temporary Python file.
|
||||
Please note that this file may be presneted in file system,
|
||||
so caller may need to overwrite it.
|
||||
All Blender render process share the same script file (this).
|
||||
"""
|
||||
# TODO: Strip this "share" behavior to enable multi-threads build ability.
|
||||
return self.__fetch_const_lib_temporary_artifact("blender.py")
|
||||
|
||||
# endregion
|
||||
|
||||
# region: Output Artifact
|
||||
|
||||
def __output_artifact(self, *args: str) -> Path:
|
||||
"""
|
||||
Get the path to output artifact.
|
||||
"""
|
||||
return self.__lowenv.output_artifact(*args)
|
||||
|
||||
def fd_output_artifact(self, hw: int, kind: FdContext, name: str) -> Path:
|
||||
"""
|
||||
Get the path for saving FreeDesktop icon with given image size, FreeDesktop icon and name.
|
||||
|
||||
:param hw: The height or width of this FreeDesktop icon.
|
||||
Required because FreeDesktop need to save icon with different size variant.
|
||||
:param kind: The FreeDesktop kind of this icon.
|
||||
:param name: The name of saved artifact. The file extension ".png" is not required.
|
||||
"""
|
||||
return self.__output_artifact(f"{hw}x{hw}", str(kind), f"{name}.png")
|
||||
|
||||
def win_output_artifact(self, kind: WinCategory, name: str) -> Path:
|
||||
"""
|
||||
Get the path for saving Windows-only icon.
|
||||
|
||||
:param kind: The kind of this icon.
|
||||
:param name: The name of saved artifact. The file extension ".ico" is not required.
|
||||
"""
|
||||
return self.__output_artifact(_ART_WIN, str(kind), f"{name}.ico")
|
||||
|
||||
def mac_output_artifact(self, kind: MacCategory, name: str) -> Path:
|
||||
"""
|
||||
Get the path for saving macOS-only icon.
|
||||
|
||||
:param kind: The kind of this icon.
|
||||
:param name: The name of saved artifact. The file extension ".icns" is not required.
|
||||
"""
|
||||
return self.__output_artifact(_ART_MAC, str(kind), f"{name}.icns")
|
||||
|
||||
# endregion
|
||||
@@ -0,0 +1,13 @@
|
||||
from .common import Sink
|
||||
from .tempart_sink import TempArtSink
|
||||
from .fdart_sink import FdArtSink
|
||||
from .winart_sink import WinArtSink
|
||||
from .macart_sink import MacArtSink
|
||||
|
||||
__all__ = [
|
||||
"Sink",
|
||||
"TempArtSink",
|
||||
"FdArtSink",
|
||||
"WinArtSink",
|
||||
"MacArtSink"
|
||||
]
|
||||
@@ -0,0 +1,12 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from ..address import Address
|
||||
|
||||
|
||||
class Sink(ABC):
|
||||
"""
|
||||
Abstract base class for all sinks.
|
||||
"""
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def address(self) -> Address: ...
|
||||
@@ -0,0 +1,42 @@
|
||||
from dataclasses import dataclass
|
||||
from .common import Sink
|
||||
from ..address import Address, AddressDomain
|
||||
from ..environment import Environment
|
||||
from ..utils import Artifact, FdContext, FD_THUMBNAIL_HWS, check_vart
|
||||
from ...lowlevel import artio, artrdr
|
||||
from ...logger import HIGHLEVEL_LOGGER as LOGGER
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class FdArtSinkHint:
|
||||
kind: FdContext
|
||||
name: str
|
||||
|
||||
|
||||
class FdArtSink(Sink):
|
||||
__kind: FdContext
|
||||
__name: str
|
||||
|
||||
def __init__(self, kind: FdContext, name: str) -> None:
|
||||
self.__kind = kind
|
||||
self.__name = name
|
||||
|
||||
@property
|
||||
def address(self) -> Address:
|
||||
return Address(AddressDomain.FdOutput, str(self.__kind), self.__name)
|
||||
|
||||
def push(self, env: Environment, art: Artifact) -> None:
|
||||
LOGGER.info(
|
||||
'Saving FreeDesktop artifact with kind "%s" and name "%s".',
|
||||
self.__kind,
|
||||
self.__name,
|
||||
)
|
||||
check_vart(art)
|
||||
for hw, thumbnail in zip(
|
||||
FD_THUMBNAIL_HWS, artrdr.render_thumbnail(art, FD_THUMBNAIL_HWS)
|
||||
):
|
||||
dst = env.fd_output_artifact(hw, self.__kind, self.__name)
|
||||
artio.save_artifact(thumbnail, dst)
|
||||
|
||||
def push_hint(self) -> FdArtSinkHint:
|
||||
return FdArtSinkHint(self.__kind, self.__name)
|
||||
@@ -0,0 +1,38 @@
|
||||
from dataclasses import dataclass
|
||||
from .common import Sink
|
||||
from ..address import Address, AddressDomain
|
||||
from ..environment import Environment
|
||||
from ..utils import Artifact, MacCategory, check_vart
|
||||
from ...lowlevel import artrdr
|
||||
from ...logger import HIGHLEVEL_LOGGER as LOGGER
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class MacArtSinkHint:
|
||||
kind: MacCategory
|
||||
name: str
|
||||
|
||||
|
||||
class MacArtSink(Sink):
|
||||
__kind: MacCategory
|
||||
__name: str
|
||||
|
||||
def __init__(self, kind: MacCategory, name: str) -> None:
|
||||
self.__kind = kind
|
||||
self.__name = name
|
||||
|
||||
@property
|
||||
def address(self) -> Address:
|
||||
return Address(AddressDomain.MacOutput, str(self.__kind), self.__name)
|
||||
|
||||
def push(self, env: Environment, art: Artifact) -> None:
|
||||
LOGGER.info(
|
||||
'Saving macOS-only artifact with kind "%s" and name "%s".',
|
||||
self.__kind,
|
||||
self.__name,
|
||||
)
|
||||
check_vart(art)
|
||||
artrdr.render_icns(art, env.mac_output_artifact(self.__kind, self.__name))
|
||||
|
||||
def push_hint(self) -> MacArtSinkHint:
|
||||
return MacArtSinkHint(self.__kind, self.__name)
|
||||
@@ -0,0 +1,43 @@
|
||||
from pathlib import Path
|
||||
from .common import Sink
|
||||
from ..address import Address, AddressDomain
|
||||
from ..environment import Environment
|
||||
from ..utils import Artifact
|
||||
from ...lowlevel import artio
|
||||
from ...logger import HIGHLEVEL_LOGGER as LOGGER
|
||||
|
||||
|
||||
class TempArtSink(Sink):
|
||||
"""
|
||||
The sink to artifact (PNG-only) located in temporary directory.
|
||||
|
||||
All existence of sub-directory should be ensured on your own.
|
||||
"""
|
||||
|
||||
__comps: tuple[str, ...]
|
||||
|
||||
def __init__(self, *args: str) -> None:
|
||||
self.__comps = tuple(args)
|
||||
|
||||
@property
|
||||
def address(self) -> Address:
|
||||
return Address(AddressDomain.Temporary, *self.__comps)
|
||||
|
||||
def push(self, env: Environment, art: Artifact) -> None:
|
||||
p = self.push_hint(env)
|
||||
LOGGER.info("Saving temporary artifact: %s", p)
|
||||
artio.save_artifact(art, p)
|
||||
|
||||
def repull(self, env: Environment) -> Artifact:
|
||||
"""
|
||||
Re-pull the artifact from this sink, after the artifact has
|
||||
been pushed to it (usually via a direct rendering).
|
||||
Only meaningful for artifacts produced by the job declaring
|
||||
this sink.
|
||||
"""
|
||||
p = self.push_hint(env)
|
||||
LOGGER.info("Re-pulling temporary artifact: %s", p)
|
||||
return artio.load_artifact(p)
|
||||
|
||||
def push_hint(self, env: Environment) -> Path:
|
||||
return env.user_temporary_artifact(*self.__comps)
|
||||
@@ -0,0 +1,38 @@
|
||||
from dataclasses import dataclass
|
||||
from .common import Sink
|
||||
from ..address import Address, AddressDomain
|
||||
from ..environment import Environment
|
||||
from ..utils import Artifact, WinCategory, check_vart
|
||||
from ...lowlevel import artrdr
|
||||
from ...logger import HIGHLEVEL_LOGGER as LOGGER
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class WinArtSinkHint:
|
||||
kind: WinCategory
|
||||
name: str
|
||||
|
||||
|
||||
class WinArtSink(Sink):
|
||||
__kind: WinCategory
|
||||
__name: str
|
||||
|
||||
def __init__(self, kind: WinCategory, name: str) -> None:
|
||||
self.__kind = kind
|
||||
self.__name = name
|
||||
|
||||
@property
|
||||
def address(self) -> Address:
|
||||
return Address(AddressDomain.WinOutput, str(self.__kind), self.__name)
|
||||
|
||||
def push(self, env: Environment, art: Artifact) -> None:
|
||||
LOGGER.info(
|
||||
'Saving Windows-only artifact with kind "%s" and name "%s".',
|
||||
self.__kind,
|
||||
self.__name,
|
||||
)
|
||||
check_vart(art)
|
||||
artrdr.render_ico(art, env.win_output_artifact(self.__kind, self.__name))
|
||||
|
||||
def push_hint(self) -> WinArtSinkHint:
|
||||
return WinArtSinkHint(self.__kind, self.__name)
|
||||
@@ -0,0 +1,22 @@
|
||||
from .common import Source
|
||||
from .newart_source import NewArtSource
|
||||
from .bitmap_source import BitmapSource
|
||||
from .svg_source import SvgSource
|
||||
from .blender_source import BlenderSource
|
||||
from .tempart_source import TempArtSource
|
||||
from .fdart_source import FdArtSource
|
||||
from .winart_source import WinArtSource
|
||||
from .macart_source import MacArtSource
|
||||
|
||||
|
||||
__all__ = [
|
||||
"Source",
|
||||
"NewArtSource",
|
||||
"BitmapSource",
|
||||
"SvgSource",
|
||||
"BlenderSource",
|
||||
"TempArtSource",
|
||||
"FdArtSource",
|
||||
"WinArtSource",
|
||||
"MacArtSource",
|
||||
]
|
||||
@@ -0,0 +1,24 @@
|
||||
from .common import Source
|
||||
from ..address import Address
|
||||
from ..environment import Environment
|
||||
from ..utils import Artifact
|
||||
from ...lowlevel import artio
|
||||
from ...logger import HIGHLEVEL_LOGGER as LOGGER
|
||||
|
||||
|
||||
class BitmapSource(Source):
|
||||
"""The source to bimap artifact (PNG, JPEG or BMP) located in input directory."""
|
||||
|
||||
__comps: tuple[str, ...]
|
||||
|
||||
def __init__(self, *args: str) -> None:
|
||||
self.__comps = tuple(args)
|
||||
|
||||
@property
|
||||
def address(self) -> Address | None:
|
||||
return None
|
||||
|
||||
def pull(self, env: Environment) -> Artifact:
|
||||
p = env.input_artifact(*self.__comps)
|
||||
LOGGER.info("Loading input artifact: %s", p)
|
||||
return artio.load_input_artifact(p)
|
||||
@@ -0,0 +1,58 @@
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
from .common import Source
|
||||
from ..address import Address
|
||||
from ..environment import Environment
|
||||
from ..sink.tempart_sink import TempArtSink
|
||||
from ..utils import Artifact, VART_HW
|
||||
from ...lowlevel import artio, artrdr
|
||||
from ...lowlevel.artrdr import BlenderConfig
|
||||
from ...logger import HIGHLEVEL_LOGGER as LOGGER
|
||||
|
||||
|
||||
DEFAULT_BLD_CONFIG = artrdr.BlenderConfig(VART_HW, VART_HW)
|
||||
|
||||
|
||||
class BlenderSource(Source):
|
||||
"""The source to Blender composition located in input directory."""
|
||||
|
||||
__comps: tuple[str, ...]
|
||||
|
||||
def __init__(self, *args: str) -> None:
|
||||
self.__comps = tuple(args)
|
||||
|
||||
@property
|
||||
def address(self) -> Address | None:
|
||||
return None
|
||||
|
||||
def pull(
|
||||
self, env: Environment, cfg: BlenderConfig = DEFAULT_BLD_CONFIG
|
||||
) -> Artifact:
|
||||
dst = self.__render(env, None, cfg)
|
||||
return artio.load_artifact(dst)
|
||||
|
||||
def pull_to_temp(
|
||||
self,
|
||||
env: Environment,
|
||||
temp_sink: TempArtSink,
|
||||
cfg: BlenderConfig = DEFAULT_BLD_CONFIG,
|
||||
) -> None:
|
||||
self.__render(env, temp_sink.push_hint(env), cfg)
|
||||
|
||||
def __render(
|
||||
self, env: Environment, dst: Optional[Path], cfg: BlenderConfig
|
||||
) -> Path:
|
||||
"""
|
||||
Internal used function for rendering Blender composition.
|
||||
|
||||
:return: The path to destination storing render result.
|
||||
"""
|
||||
src = env.input_artifact(*self.__comps)
|
||||
temp_script = env.fetch_lib_blender_script_temporary_artifact()
|
||||
if dst is None:
|
||||
LOGGER.info("Rendering temporary Blender composition: %s", src)
|
||||
dst = env.allocate_lib_render_temporary_artifact()
|
||||
else:
|
||||
LOGGER.info("Rendering Blender composition: %s -> %s", src, dst)
|
||||
artrdr.render_blender(src, dst, temp_script, cfg)
|
||||
return dst
|
||||
@@ -0,0 +1,20 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from ..address import Address
|
||||
|
||||
|
||||
class Source(ABC):
|
||||
"""
|
||||
Abstract base class for all sources.
|
||||
"""
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def address(self) -> Address | None:
|
||||
"""
|
||||
Get the address representation of this source.
|
||||
|
||||
:return: The address representing this source.
|
||||
``None`` if there is no producer for this source.
|
||||
It means that this source do not depend anything.
|
||||
"""
|
||||
...
|
||||
@@ -0,0 +1,35 @@
|
||||
from .common import Source
|
||||
from ..address import Address, AddressDomain
|
||||
from ..environment import Environment
|
||||
from ..sink.fdart_sink import FdArtSink
|
||||
from ..utils import FdContext, FD_THUMBNAIL_HWS
|
||||
from ...lowlevel import artio
|
||||
from ...logger import HIGHLEVEL_LOGGER as LOGGER
|
||||
|
||||
|
||||
class FdArtSource(Source):
|
||||
__kind: FdContext
|
||||
__name: str
|
||||
|
||||
def __init__(self, kind: FdContext, name: str) -> None:
|
||||
self.__kind = kind
|
||||
self.__name = name
|
||||
|
||||
@property
|
||||
def address(self) -> Address:
|
||||
return Address(AddressDomain.FdOutput, str(self.__kind), self.__name)
|
||||
|
||||
def link_to(self, env: Environment, fd_sink: FdArtSink) -> None:
|
||||
sink_hint = fd_sink.push_hint()
|
||||
LOGGER.info(
|
||||
'Duplicating FreeDesktop artifact from kind "%s" name "%s" to kind "%s" name "%s".',
|
||||
self.__kind,
|
||||
self.__name,
|
||||
sink_hint.kind,
|
||||
sink_hint.name,
|
||||
)
|
||||
for hw in FD_THUMBNAIL_HWS:
|
||||
artio.link_artifact(
|
||||
env.fd_output_artifact(hw, self.__kind, self.__name),
|
||||
env.fd_output_artifact(hw, sink_hint.kind, sink_hint.name),
|
||||
)
|
||||
@@ -0,0 +1,34 @@
|
||||
from .common import Source
|
||||
from ..address import Address, AddressDomain
|
||||
from ..environment import Environment
|
||||
from ..sink.macart_sink import MacArtSink
|
||||
from ..utils import MacCategory
|
||||
from ...lowlevel import artio
|
||||
from ...logger import HIGHLEVEL_LOGGER as LOGGER
|
||||
|
||||
|
||||
class MacArtSource(Source):
|
||||
__kind: MacCategory
|
||||
__name: str
|
||||
|
||||
def __init__(self, kind: MacCategory, name: str) -> None:
|
||||
self.__kind = kind
|
||||
self.__name = name
|
||||
|
||||
@property
|
||||
def address(self) -> Address:
|
||||
return Address(AddressDomain.MacOutput, str(self.__kind), self.__name)
|
||||
|
||||
def link_to(self, env: Environment, mac_sink: MacArtSink) -> None:
|
||||
sink_hint = mac_sink.push_hint()
|
||||
LOGGER.info(
|
||||
'Duplicating macOS-only artifact from kind "%s" name "%s" to kind "%s" name "%s".',
|
||||
self.__kind,
|
||||
self.__name,
|
||||
sink_hint.kind,
|
||||
sink_hint.name,
|
||||
)
|
||||
artio.link_artifact(
|
||||
env.mac_output_artifact(self.__kind, self.__name),
|
||||
env.mac_output_artifact(sink_hint.kind, sink_hint.name),
|
||||
)
|
||||
@@ -0,0 +1,16 @@
|
||||
from .common import Source
|
||||
from ..address import Address
|
||||
from ..utils import Artifact, VART_HW
|
||||
from ...lowlevel import artio
|
||||
|
||||
|
||||
class NewArtSource(Source):
|
||||
def __init__(self) -> None:
|
||||
pass
|
||||
|
||||
@property
|
||||
def address(self) -> Address | None:
|
||||
return None
|
||||
|
||||
def pull(self) -> Artifact:
|
||||
return artio.new_artifact((VART_HW, VART_HW))
|
||||
@@ -0,0 +1,52 @@
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
from .common import Source
|
||||
from ..address import Address
|
||||
from ..environment import Environment
|
||||
from ..sink.tempart_sink import TempArtSink
|
||||
from ..utils import Artifact, VART_HW
|
||||
from ...lowlevel import artio, artrdr
|
||||
from ...lowlevel.artrdr import SvgConfig
|
||||
from ...logger import HIGHLEVEL_LOGGER as LOGGER
|
||||
|
||||
DEFAULT_SVG_CONFIG = SvgConfig(VART_HW, VART_HW)
|
||||
|
||||
|
||||
class SvgSource(Source):
|
||||
"""The source to SVG located in input directory."""
|
||||
|
||||
__comps: tuple[str, ...]
|
||||
|
||||
def __init__(self, *args: str) -> None:
|
||||
self.__comps = tuple(args)
|
||||
|
||||
@property
|
||||
def address(self) -> Address | None:
|
||||
return None
|
||||
|
||||
def pull(self, env: Environment, cfg: SvgConfig = DEFAULT_SVG_CONFIG) -> Artifact:
|
||||
dst = self.__render(env, None, cfg)
|
||||
return artio.load_artifact(dst)
|
||||
|
||||
def pull_to_temp(
|
||||
self,
|
||||
env: Environment,
|
||||
temp_sink: TempArtSink,
|
||||
cfg: SvgConfig = DEFAULT_SVG_CONFIG,
|
||||
) -> None:
|
||||
self.__render(env, temp_sink.push_hint(env), cfg)
|
||||
|
||||
def __render(self, env: Environment, dst: Optional[Path], cfg: SvgConfig) -> Path:
|
||||
"""
|
||||
Internal used function for rendering SVG.
|
||||
|
||||
:return: The path to destination storing render result.
|
||||
"""
|
||||
src = env.input_artifact(*self.__comps)
|
||||
if dst is None:
|
||||
LOGGER.info("Rendering temporary SVG: %s", src)
|
||||
dst = env.allocate_lib_render_temporary_artifact()
|
||||
else:
|
||||
LOGGER.info("Rendering SVG: %s -> %s", src, dst)
|
||||
artrdr.render_svg(src, dst, env.prologue.svg_render, cfg)
|
||||
return dst
|
||||
@@ -0,0 +1,24 @@
|
||||
from .common import Source
|
||||
from ..address import Address, AddressDomain
|
||||
from ..environment import Environment
|
||||
from ..utils import Artifact
|
||||
from ...lowlevel import artio
|
||||
from ...logger import HIGHLEVEL_LOGGER as LOGGER
|
||||
|
||||
|
||||
class TempArtSource(Source):
|
||||
"""The source to artifact (PNG-only) located in temporary directory."""
|
||||
|
||||
__comps: tuple[str, ...]
|
||||
|
||||
def __init__(self, *args: str) -> None:
|
||||
self.__comps = tuple(args)
|
||||
|
||||
@property
|
||||
def address(self) -> Address | None:
|
||||
return Address(AddressDomain.Temporary, *self.__comps)
|
||||
|
||||
def pull(self, env: Environment) -> Artifact:
|
||||
p = env.user_temporary_artifact(*self.__comps)
|
||||
LOGGER.info("Loading temporary artifact: %s", p)
|
||||
return artio.load_artifact(p)
|
||||
@@ -0,0 +1,34 @@
|
||||
from .common import Source
|
||||
from ..address import Address, AddressDomain
|
||||
from ..environment import Environment
|
||||
from ..sink.winart_sink import WinArtSink
|
||||
from ..utils import WinCategory
|
||||
from ...lowlevel import artio
|
||||
from ...logger import HIGHLEVEL_LOGGER as LOGGER
|
||||
|
||||
|
||||
class WinArtSource(Source):
|
||||
__kind: WinCategory
|
||||
__name: str
|
||||
|
||||
def __init__(self, kind: WinCategory, name: str) -> None:
|
||||
self.__kind = kind
|
||||
self.__name = name
|
||||
|
||||
@property
|
||||
def address(self) -> Address:
|
||||
return Address(AddressDomain.WinOutput, str(self.__kind), self.__name)
|
||||
|
||||
def link_to(self, env: Environment, win_sink: WinArtSink) -> None:
|
||||
sink_hint = win_sink.push_hint()
|
||||
LOGGER.info(
|
||||
'Duplicating Windows-only artifact from kind "%s" name "%s" to kind "%s" name "%s".',
|
||||
self.__kind,
|
||||
self.__name,
|
||||
sink_hint.kind,
|
||||
sink_hint.name,
|
||||
)
|
||||
artio.link_artifact(
|
||||
env.win_output_artifact(self.__kind, self.__name),
|
||||
env.win_output_artifact(sink_hint.kind, sink_hint.name),
|
||||
)
|
||||
@@ -0,0 +1,46 @@
|
||||
import enum
|
||||
from ..lowlevel.utils import Artifact
|
||||
|
||||
VART_HW: int = 1024
|
||||
"""The height or width of Vanilla Artifact."""
|
||||
|
||||
|
||||
def check_vart(art: Artifact) -> None:
|
||||
if art.size != (VART_HW, VART_HW):
|
||||
raise ValueError(
|
||||
f"The size of general highlevel used artifact must be {VART_HW}x{VART_HW}, got {art.width}x{art.height} instead"
|
||||
)
|
||||
|
||||
|
||||
class FdContext(enum.StrEnum):
|
||||
Actions = "actions"
|
||||
Animations = "animations"
|
||||
Applications = "apps"
|
||||
Categories = "categories"
|
||||
Devices = "devices"
|
||||
Emblems = "emblems"
|
||||
Emotes = "emotes"
|
||||
International = "intl"
|
||||
MimeTypes = "mimetypes"
|
||||
Places = "places"
|
||||
Status = "status"
|
||||
|
||||
|
||||
class WinCategory(enum.StrEnum):
|
||||
Application = "apps"
|
||||
"""Icons for applications"""
|
||||
Extension = "exts"
|
||||
"""Icons for file extensions"""
|
||||
|
||||
|
||||
class MacCategory(enum.StrEnum):
|
||||
Application = "apps"
|
||||
"""Icons for applications"""
|
||||
Extension = "exts"
|
||||
"""Icons for file extensions"""
|
||||
|
||||
|
||||
# TODO: For easy testing, we only build 32x32 and 48x48.
|
||||
# Enable full generation after testing.
|
||||
FD_THUMBNAIL_HWS: tuple[int, ...] = (32, 48)
|
||||
# FD_THUMBNAIL_HWS: tuple[int, ...] = (16, 32, 48, 64, 128, 256)
|
||||
@@ -0,0 +1,24 @@
|
||||
import logging
|
||||
|
||||
|
||||
class LoggerFactory:
|
||||
def __init__(self) -> None:
|
||||
# setup log format and level
|
||||
logging.basicConfig(
|
||||
format="[%(levelname)s] [%(name)s] %(message)s", level=logging.INFO
|
||||
)
|
||||
|
||||
def get_app_logger(self) -> logging.Logger:
|
||||
return logging.getLogger("App")
|
||||
|
||||
def get_lowlevel_logger(self) -> logging.Logger:
|
||||
return logging.getLogger("Lowlevel")
|
||||
|
||||
def get_highlevel_logger(self) -> logging.Logger:
|
||||
return logging.getLogger("Highlevel")
|
||||
|
||||
|
||||
LOGGER_FACTORY = LoggerFactory()
|
||||
LOWLEVEL_LOGGER = LOGGER_FACTORY.get_lowlevel_logger()
|
||||
HIGHLEVEL_LOGGER = LOGGER_FACTORY.get_highlevel_logger()
|
||||
APP_LOGGER = LOGGER_FACTORY.get_app_logger()
|
||||
Whitespace-only changes.
@@ -0,0 +1,153 @@
|
||||
import shutil
|
||||
import os
|
||||
import sys
|
||||
import enum
|
||||
from pathlib import Path
|
||||
import PIL.Image
|
||||
from .utils import Artifact
|
||||
from ..logger import LOWLEVEL_LOGGER as LOGGER
|
||||
|
||||
|
||||
_LINK_MODE_ENV: str = "ASSEMBLICON_LINK_MODE"
|
||||
"""The environment variable selecting how artifacts are linked."""
|
||||
|
||||
|
||||
class LinkMode(enum.StrEnum):
|
||||
"""All valid values of the ``ASSEMBLICON_LINK_MODE`` environment variable."""
|
||||
|
||||
Copy = "copy"
|
||||
Symlink = "symlink"
|
||||
|
||||
|
||||
def new_artifact(size: tuple[int, int]) -> Artifact:
|
||||
"""
|
||||
Create new RGBA empty (#ffffff00) artifact with given size.
|
||||
"""
|
||||
return PIL.Image.new("RGBA", size, "#ffffff00")
|
||||
|
||||
|
||||
def load_input_artifact(p: Path) -> Artifact:
|
||||
"""
|
||||
Load bitmap artifact (PNG, JPEG or BMP) which usually is located in input directory.
|
||||
"""
|
||||
LOGGER.debug("Loading input artifact: %s", p)
|
||||
return PIL.Image.open(p, "r", ["PNG", "JPEG", "BMP"])
|
||||
|
||||
|
||||
def load_artifact(p: Path) -> Artifact:
|
||||
"""
|
||||
Load bitmap artifact (PNG-only) saved previously as the intermediary.
|
||||
"""
|
||||
LOGGER.debug("Loading temporary or output artifact: %s", p)
|
||||
return PIL.Image.open(p, "r", ["PNG"])
|
||||
|
||||
|
||||
def save_artifact(art: Artifact, p: Path) -> None:
|
||||
LOGGER.debug("Saving artifact: %s", p)
|
||||
art.save(p, format="PNG")
|
||||
|
||||
|
||||
def dup_artifact(src: Path, dst: Path) -> None:
|
||||
LOGGER.debug("Duplicating artifact: %s -> %s", src, dst)
|
||||
shutil.copyfile(src, dst)
|
||||
|
||||
|
||||
def link_artifact(src: Path, dst: Path) -> None:
|
||||
"""
|
||||
Make given artifact reachable from another path, either via a
|
||||
relative symlink or a content copy.
|
||||
|
||||
The linking mode is controlled by the ``ASSEMBLICON_LINK_MODE``
|
||||
environment variable: ``symlink`` (default) creates a symlink with a
|
||||
path relative to the destination; ``copy`` duplicates the artifact
|
||||
content. An existing destination is only removed after it is proven
|
||||
to be a regular file, or a symlink whose target is a file path
|
||||
(the target is allowed to be missing), and only when it shares the
|
||||
same filename suffix as the source. Symlink creation failure falls
|
||||
back to copying.
|
||||
|
||||
:param src: The path to source artifact file.
|
||||
:param dst: The path to destination which should reach the artifact.
|
||||
:raises ValueError: If the link mode is unknown, the destination
|
||||
exists but is not safely deletable (see above), its suffix
|
||||
differs from the source one, or no common directory exists
|
||||
between source and destination.
|
||||
"""
|
||||
try:
|
||||
mode = LinkMode(os.getenv(_LINK_MODE_ENV, LinkMode.Symlink))
|
||||
except ValueError:
|
||||
raise ValueError(
|
||||
f"Invalid link mode for env {_LINK_MODE_ENV}. "
|
||||
f"Valid modes are: {', '.join(m.value for m in LinkMode)}."
|
||||
)
|
||||
|
||||
LOGGER.debug("Linking artifact: %s -> %s (mode: %s)", src, dst, mode)
|
||||
|
||||
# SAFETY: the code below deletes an existing destination file. These
|
||||
# checks are the only guards against accidental data deletion, so
|
||||
# never relax them. A destination is deletable only when it is a
|
||||
# regular file, or a symlink whose target is a file path (the target
|
||||
# itself is allowed to be missing, i.e. a broken symlink is
|
||||
# deletable). Additionally, the source and the destination must
|
||||
# share the same filename suffix.
|
||||
if os.path.lexists(dst):
|
||||
if dst.is_symlink():
|
||||
# a symlink is deletable unless it provably points to a
|
||||
# non-file, e.g. an existing directory
|
||||
if dst.exists() and not dst.is_file():
|
||||
raise ValueError(
|
||||
f'Refusing to remove existing destination "{dst}": '
|
||||
f"it is a symlink not pointing to a file."
|
||||
)
|
||||
elif not dst.is_file():
|
||||
raise ValueError(
|
||||
f'Refusing to remove existing destination "{dst}": '
|
||||
f"it is not a regular file."
|
||||
)
|
||||
if src.suffix != dst.suffix:
|
||||
raise ValueError(
|
||||
f'Refusing to remove existing destination "{dst}": its '
|
||||
f'suffix "{dst.suffix}" differs from source suffix "{src.suffix}".'
|
||||
)
|
||||
dst.unlink()
|
||||
|
||||
if mode == LinkMode.Copy:
|
||||
shutil.copyfile(src, dst)
|
||||
return
|
||||
|
||||
# symlinks are always created with a path relative to the
|
||||
# destination, so that the whole artifact directory stays relocatable
|
||||
try:
|
||||
link_target = src.relative_to(dst.parent, walk_up=True)
|
||||
except ValueError:
|
||||
raise ValueError(
|
||||
f'No common directory between "{src}" and "{dst}", '
|
||||
f"can not create relative symlink."
|
||||
)
|
||||
|
||||
# SAFETY: the symlink target must always be stored with POSIX
|
||||
# separators ("/"). On Windows, "relative_to" yields a
|
||||
# backslash-separated path, and "symlink_to" stores the target string
|
||||
# verbatim into the NTFS reparse point, so a backslash form would
|
||||
# also leak verbatim into tar archives. Whether an unpacker accepts
|
||||
# backslash targets is not guaranteed, and we deliberately do not
|
||||
# rely on the packer normalizing them. Converting to POSIX form here
|
||||
# is the single point guaranteeing that archived symlinks stay
|
||||
# portable, regardless of the platform the build ran on or the
|
||||
# packer used.
|
||||
try:
|
||||
dst.symlink_to(link_target.as_posix())
|
||||
except OSError as e:
|
||||
LOGGER.warning(
|
||||
"Fail to create symlink for artifact %s: %s. Falling back to copy.",
|
||||
dst,
|
||||
e,
|
||||
)
|
||||
if sys.platform == "win32":
|
||||
LOGGER.warning(
|
||||
"Symlink creation on Windows usually requires administrator "
|
||||
"privileges. Consider rerunning as administrator, enabling "
|
||||
"Developer Mode, or setting %s=copy.",
|
||||
_LINK_MODE_ENV,
|
||||
)
|
||||
shutil.copyfile(src, dst)
|
||||
@@ -0,0 +1,136 @@
|
||||
import enum
|
||||
import math
|
||||
import PIL.Image
|
||||
from .utils import Artifact
|
||||
from ..geometry import Point
|
||||
|
||||
|
||||
class HorizontalAnchor(enum.IntEnum):
|
||||
Left = enum.auto()
|
||||
Center = enum.auto()
|
||||
Right = enum.auto()
|
||||
|
||||
|
||||
class VerticalAnchor(enum.IntEnum):
|
||||
Top = enum.auto()
|
||||
Center = enum.auto()
|
||||
Bottom = enum.auto()
|
||||
|
||||
|
||||
def anchor_to_offset(
|
||||
oversize_width: int,
|
||||
oversize_height: int,
|
||||
horizontal_anchor: HorizontalAnchor,
|
||||
vertical_anchor: VerticalAnchor,
|
||||
) -> Point:
|
||||
x: int
|
||||
match horizontal_anchor:
|
||||
case HorizontalAnchor.Left:
|
||||
x = 0
|
||||
case HorizontalAnchor.Center:
|
||||
x = oversize_width // 2
|
||||
case HorizontalAnchor.Right:
|
||||
x = oversize_width
|
||||
|
||||
y: int
|
||||
match vertical_anchor:
|
||||
case VerticalAnchor.Top:
|
||||
y = 0
|
||||
case VerticalAnchor.Center:
|
||||
y = oversize_height // 2
|
||||
case VerticalAnchor.Bottom:
|
||||
y = oversize_height
|
||||
|
||||
return Point(x, y)
|
||||
|
||||
|
||||
def aspect_ratio_scale_and_crop(
|
||||
art: Artifact,
|
||||
target_width: int,
|
||||
target_height: int,
|
||||
scale_resample: int,
|
||||
crop_horizontal_anchor: HorizontalAnchor,
|
||||
crop_vertical_anchor: VerticalAnchor,
|
||||
) -> Artifact:
|
||||
if target_width <= 0:
|
||||
raise ValueError("Target width must be a positive integer")
|
||||
if target_height <= 0:
|
||||
raise ValueError("Target height must be positive integer")
|
||||
|
||||
scale = max(target_width / art.width, target_height / art.height)
|
||||
# use math.ceil to ensure that resized image at least has required size
|
||||
# (floating point value error may cause this)
|
||||
scaled_width = math.ceil(art.width * scale)
|
||||
scaled_height = math.ceil(art.height * scale)
|
||||
scaled = art.resize((scaled_width, scaled_height), scale_resample)
|
||||
|
||||
crop = anchor_to_offset(
|
||||
scaled_width - target_width,
|
||||
scaled_height - target_height,
|
||||
crop_horizontal_anchor,
|
||||
crop_vertical_anchor,
|
||||
)
|
||||
(crop_x, crop_y) = crop.to_tuple()
|
||||
return scaled.crop((crop_x, crop_y, crop_x + target_width, crop_y + target_height))
|
||||
|
||||
|
||||
def default_art_resize(art: Artifact, width: int, height: int) -> Artifact:
|
||||
"""
|
||||
Resize given artifact with default resample (LANCZOS).
|
||||
"""
|
||||
return art.resize((width, height), PIL.Image.Resampling.LANCZOS)
|
||||
|
||||
|
||||
def art_anchor_to_offset(
|
||||
art: Artifact,
|
||||
horizontal_anchor: HorizontalAnchor,
|
||||
vertical_anchor: VerticalAnchor,
|
||||
) -> Point:
|
||||
"""
|
||||
Resolve the anchor point position inside given artifact.
|
||||
|
||||
:param art: The artifact whose anchor point should be resolved.
|
||||
:param horizontal_anchor: The anchor selection at horizontal direction.
|
||||
:param vertical_anchor: The anchor selection at vertical direction.
|
||||
:return: The (x, y) coordinate of the anchor point. For Left/Top
|
||||
anchors this is the corresponding edge; for Right/Bottom anchors
|
||||
this is just outside the artifact (the exact corner coordinate).
|
||||
"""
|
||||
return anchor_to_offset(*art.size, horizontal_anchor, vertical_anchor)
|
||||
|
||||
|
||||
def align_paste(
|
||||
art: Artifact,
|
||||
clipboard: Artifact,
|
||||
art_pos: Point,
|
||||
clipboard_pos: Point,
|
||||
) -> None:
|
||||
"""
|
||||
Paste clipboard onto given artifact with two anchor points aligned.
|
||||
|
||||
The clipboard is pasted in the way that the point indicated by
|
||||
clipboard_pos on the clipboard exactly overlaps the point indicated
|
||||
by art_pos on the artifact. The art is modified in place. Positions
|
||||
resolving to negative paste origins are allowed and clipped by PIL
|
||||
just like a normal paste call.
|
||||
|
||||
:param art: The artifact pasted onto. Modified in place.
|
||||
:param clipboard: The artifact pasted as the clipboard.
|
||||
:param art_pos: The (x, y) point on the art to be aligned, usually
|
||||
resolved by anchor_to_pos.
|
||||
:param clipboard_pos: The (x, y) point on the clipboard to be
|
||||
aligned, usually resolved by anchor_to_pos.
|
||||
"""
|
||||
art.paste(clipboard, (art_pos - clipboard_pos).to_tuple())
|
||||
|
||||
|
||||
def align_alpha_composite(
|
||||
art: Artifact,
|
||||
clipboard: Artifact,
|
||||
art_pos: Point,
|
||||
clipboard_pos: Point,
|
||||
) -> None:
|
||||
"""
|
||||
Alpha-supported ``align_paste``.
|
||||
"""
|
||||
art.alpha_composite(clipboard, (art_pos - clipboard_pos).to_tuple())
|
||||
@@ -0,0 +1,232 @@
|
||||
import os
|
||||
import enum
|
||||
import subprocess
|
||||
from typing import Iterable, Iterator
|
||||
from pathlib import Path
|
||||
from dataclasses import dataclass
|
||||
import PIL.Image
|
||||
from .utils import Artifact
|
||||
from ..logger import LOWLEVEL_LOGGER as LOGGER
|
||||
|
||||
|
||||
class SvgRenderKind(enum.IntEnum):
|
||||
Inkscape = enum.auto()
|
||||
ReSvg = enum.auto()
|
||||
|
||||
|
||||
@dataclass
|
||||
class SvgConfig:
|
||||
width: int
|
||||
height: int
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
if self.width <= 0:
|
||||
raise ValueError(
|
||||
f"The image width in Inkscape config must be a positive integer"
|
||||
)
|
||||
if self.height <= 0:
|
||||
raise ValueError(
|
||||
f"The image height in Inkscape config must be a positive integer"
|
||||
)
|
||||
|
||||
|
||||
def render_svg(src: Path, dst: Path, kind: SvgRenderKind, cfg: SvgConfig) -> None:
|
||||
"""
|
||||
Render given SVG file to PNG file.
|
||||
|
||||
:param src: The path to SVG file to be rendered
|
||||
:param dst: The path to rendered PNG file.
|
||||
:param kind: The selected SVG render kind.
|
||||
:param cfg: The configuration when rendering.
|
||||
"""
|
||||
LOGGER.debug(
|
||||
"Rendering SVG artifact with render %s: %s -> %s", kind.name, src, dst
|
||||
)
|
||||
|
||||
# YYC MARK:
|
||||
# Inkscape will silently quit with return code 0
|
||||
# if given source file doesn't exist in file system.
|
||||
# So we need to check whether it is existing and popularize it to all render.
|
||||
if not src.is_file():
|
||||
raise ValueError(f"Source SVG file is not presented in file system: {src}")
|
||||
|
||||
match kind:
|
||||
case SvgRenderKind.Inkscape:
|
||||
inkscape_bin = os.getenv("ASSEMBLICON_INKSCAPE", "inkscape")
|
||||
cmd = [
|
||||
inkscape_bin,
|
||||
"--export-area-page",
|
||||
"--export-width",
|
||||
str(cfg.width),
|
||||
"--export-height",
|
||||
str(cfg.height),
|
||||
"--export-type",
|
||||
"png",
|
||||
"--export-png-color-mode",
|
||||
"RGBA_8",
|
||||
"--export-background-opacity",
|
||||
"0.0",
|
||||
"--export-png-use-dithering",
|
||||
"false",
|
||||
"--export-filename",
|
||||
str(dst),
|
||||
str(src),
|
||||
]
|
||||
case SvgRenderKind.ReSvg:
|
||||
resvg_bin = os.getenv("ASSEMBLICON_RESVG", "resvg")
|
||||
cmd = [
|
||||
resvg_bin,
|
||||
"--width",
|
||||
str(cfg.width),
|
||||
"--height",
|
||||
str(cfg.height),
|
||||
str(src),
|
||||
str(dst),
|
||||
]
|
||||
|
||||
proc = subprocess.run(cmd, capture_output=False)
|
||||
if proc.returncode != 0:
|
||||
raise RuntimeError(
|
||||
f"Fail to execute SVG render {kind.name}. Return code is {proc.returncode}"
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class BlenderConfig:
|
||||
width: int
|
||||
height: int
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
if self.width <= 0:
|
||||
raise ValueError(
|
||||
f"The image width in Blender config must be a positive integer"
|
||||
)
|
||||
if self.height <= 0:
|
||||
raise ValueError(
|
||||
f"The image height in Blender config must be a positive integer"
|
||||
)
|
||||
|
||||
|
||||
_BLENDER_RENDER_SCRIPT = """\
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
try:
|
||||
import bpy
|
||||
|
||||
render = bpy.context.scene.render
|
||||
render.resolution_x = {width}
|
||||
render.resolution_y = {height}
|
||||
render.resolution_percentage = 100
|
||||
render.image_settings.file_format = "PNG"
|
||||
render.image_settings.color_mode = "RGBA"
|
||||
render.image_settings.color_depth = "8"
|
||||
render.film_transparent = True
|
||||
render.use_file_extension = False
|
||||
render.filepath = {dst}
|
||||
bpy.ops.render.render(write_still=True)
|
||||
except BaseException:
|
||||
traceback.print_exc()
|
||||
sys.exit(1)
|
||||
"""
|
||||
|
||||
|
||||
def render_blender(src: Path, dst: Path, temp_script: Path, cfg: BlenderConfig) -> None:
|
||||
"""
|
||||
Render given Blender composition into PNG file.
|
||||
|
||||
:param src: The path to Blender composition file to be rendered
|
||||
:param dst: The path to rendered PNG file.
|
||||
:param temp_script: The path to temporary Python script instructing Blender rendering.
|
||||
The caller must make sure that this file is immutable during calling this function.
|
||||
:param cfg: The configuration when rendering.
|
||||
"""
|
||||
LOGGER.debug("Rendering Blender artifact: %s -> %s", src, dst)
|
||||
|
||||
if not src.is_file():
|
||||
raise ValueError(
|
||||
f"Source Blender composition file is not presented in file system: {src}"
|
||||
)
|
||||
|
||||
script = _BLENDER_RENDER_SCRIPT.format(
|
||||
width=cfg.width, height=cfg.height, dst=repr(str(dst))
|
||||
)
|
||||
temp_script.write_text(script, encoding="utf-8")
|
||||
|
||||
blender_bin = os.getenv("ASSEMBLICON_BLENDER", "blender")
|
||||
cmd = [
|
||||
blender_bin,
|
||||
"--background",
|
||||
str(src),
|
||||
"--python",
|
||||
str(temp_script),
|
||||
]
|
||||
proc = subprocess.run(cmd, capture_output=False)
|
||||
if proc.returncode != 0:
|
||||
raise RuntimeError(f"Fail to execute Blender. Return code is {proc.returncode}")
|
||||
if not dst.exists():
|
||||
raise RuntimeError(
|
||||
f"Blender exited successfully but output file {dst} is missing"
|
||||
)
|
||||
|
||||
|
||||
def render_thumbnail(art: Artifact, hws: Iterable[int]) -> Iterator[Artifact]:
|
||||
"""
|
||||
Render given artifact as multiple resolution thumbnails.
|
||||
|
||||
:param art: The artifact to be rendered.
|
||||
:param hws: The int iterable holding all resolution of thumbnails (square thumbnail only)
|
||||
:return: A generator outputing thumbnail one by one with the order of given resolution.
|
||||
"""
|
||||
LOGGER.debug("Rendering thumbnail...")
|
||||
|
||||
# check whether given artifact is square rectangle.
|
||||
if art.width != art.height:
|
||||
raise ValueError(f'Thumbnail render only accept square rectangle.')
|
||||
# scale artifact up to the maximum resolution hws if it is too small.
|
||||
max_hws = max(hws)
|
||||
if art.width < max_hws:
|
||||
art = art.resize((max_hws, max_hws), PIL.Image.Resampling.LANCZOS)
|
||||
|
||||
# render thumbnail
|
||||
for hw in hws:
|
||||
LOGGER.debug("Rendering thumbnail %dx%d.", hw, hw)
|
||||
thumbnail = art.copy()
|
||||
thumbnail.thumbnail((hw, hw), PIL.Image.Resampling.LANCZOS)
|
||||
yield thumbnail
|
||||
|
||||
|
||||
def render_ico(art: Artifact, dst: Path) -> None:
|
||||
"""
|
||||
Render given artifact as Windows ICO in given path.
|
||||
|
||||
:param art: The artifact to be rendered.
|
||||
:param dst: The path to rendered result.
|
||||
"""
|
||||
LOGGER.debug("Rendering .ICO artifact: %s", dst)
|
||||
|
||||
sizes = [16, 32, 48, 64, 128, 256]
|
||||
# provide every frame explicitly so that we never depend on
|
||||
# undocumented plugin-side resizing behavior
|
||||
frames = list(render_thumbnail(art, sizes))
|
||||
art.save(
|
||||
dst,
|
||||
format="ICO",
|
||||
sizes=[(size, size) for size in sizes],
|
||||
append_images=frames,
|
||||
)
|
||||
|
||||
|
||||
def render_icns(art: Artifact, dst: Path) -> None:
|
||||
"""
|
||||
Render given artifact as macOS ICNS in given path.
|
||||
|
||||
:param art: The artifact to be rendered.
|
||||
:param dst: The path to rendered result.
|
||||
"""
|
||||
LOGGER.debug("Rendering .ICNS artifact: %s", dst)
|
||||
|
||||
# provide every smaller frame explicitly; the 1024x1024 entry is
|
||||
# covered by the art itself
|
||||
frames = list(render_thumbnail(art, (512, 256, 128, 64, 32)))
|
||||
art.save(dst, format="ICNS", append_images=frames)
|
||||
@@ -0,0 +1,68 @@
|
||||
import tempfile
|
||||
from dataclasses import dataclass
|
||||
from types import TracebackType
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Prologue:
|
||||
input_directory: Path
|
||||
"""The path to input directory."""
|
||||
output_directory: Path
|
||||
"""The path to output directory."""
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
if not self.input_directory.is_dir():
|
||||
raise ValueError(
|
||||
f"Given input path {self.input_directory} is not an existing directory."
|
||||
)
|
||||
if not self.output_directory.is_dir():
|
||||
raise ValueError(
|
||||
f"Given output path {self.output_directory} is not an existing directory."
|
||||
)
|
||||
|
||||
|
||||
class Environment:
|
||||
__prologue: Prologue
|
||||
"""The prologue used for environment."""
|
||||
__temp_dir: tempfile.TemporaryDirectory[str]
|
||||
"""Allocated temporary directory."""
|
||||
|
||||
def __init__(self, prologue: Prologue) -> None:
|
||||
self.__prologue = prologue
|
||||
self.__temp_dir = tempfile.TemporaryDirectory()
|
||||
|
||||
def __enter__(self) -> "Environment":
|
||||
return self
|
||||
|
||||
def __exit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_value: BaseException | None,
|
||||
traceback: TracebackType | None,
|
||||
) -> None:
|
||||
self.__temp_dir.cleanup()
|
||||
|
||||
def input_artifact(self, *args: str) -> Path:
|
||||
"""
|
||||
Get the path to input artifact.
|
||||
|
||||
:return: The built absolute path to input artifact.
|
||||
"""
|
||||
return self.__prologue.input_directory / Path(*args)
|
||||
|
||||
def temporary_artifact(self, *args: str) -> Path:
|
||||
"""
|
||||
Get the path to temporary artifact.
|
||||
|
||||
:return: The built absolute path to temporary artifact.
|
||||
"""
|
||||
return Path(self.__temp_dir.name) / Path(*args)
|
||||
|
||||
def output_artifact(self, *args: str) -> Path:
|
||||
"""
|
||||
Get the path to output artifact.
|
||||
|
||||
:return: The built absolute path to output artifact.
|
||||
"""
|
||||
return self.__prologue.output_directory / Path(*args)
|
||||
@@ -0,0 +1,3 @@
|
||||
from PIL.Image import Image
|
||||
|
||||
type Artifact = Image
|
||||
@@ -1,28 +1,19 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
from assemblicon.cli import (
|
||||
from .assemblicon.cli import (
|
||||
SvgRenderKind,
|
||||
StdOptsSetup,
|
||||
create_argparser,
|
||||
parse_standard_opts,
|
||||
)
|
||||
from assemblicon.highlevel.address import Family
|
||||
from assemblicon.lowlevel.artrdr import SvgRenderKind
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class AuroraOpts:
|
||||
selection: Optional[list[str]]
|
||||
"""
|
||||
The list holding all name of jobs for building.
|
||||
``None`` for building artifacts of all jobs.
|
||||
"""
|
||||
"""The list holding all name of jobs for building."""
|
||||
svg_render: SvgRenderKind
|
||||
"""The render kind for SVG file."""
|
||||
format_selection: Optional[set[Family]]
|
||||
"""
|
||||
The set holding all formats of artifacts for building.
|
||||
``None`` for building artifacts of all formats.
|
||||
"""
|
||||
|
||||
|
||||
def parse() -> AuroraOpts:
|
||||
@@ -35,14 +26,6 @@ def parse() -> AuroraOpts:
|
||||
ns = parser.parse_args()
|
||||
opts = parse_standard_opts(setup, ns)
|
||||
|
||||
format_selection = (
|
||||
None
|
||||
if opts.format_selection is None
|
||||
else {item.to_assemblicon_type() for item in opts.format_selection}
|
||||
)
|
||||
|
||||
return AuroraOpts(
|
||||
selection=opts.selection,
|
||||
svg_render=opts.svg_render.to_assemblicon_type(),
|
||||
format_selection=format_selection,
|
||||
selection=opts.selection, svg_render=opts.svg_render.to_assemblicon_type()
|
||||
)
|
||||
@@ -1,9 +1,9 @@
|
||||
from ..types import AuroraContext, AuroraEnvironment
|
||||
from assemblicon.highlevel.utils import FdContext, VART_HW
|
||||
from assemblicon.highlevel.source import TempArtSource, NewArtSource
|
||||
from assemblicon.highlevel.sink import FdArtSink
|
||||
from assemblicon.geometry import Rectangle
|
||||
from assemblicon.lowlevel.artproc import (
|
||||
from ..assemblicon.highlevel.utils import FdContext, VART_HW
|
||||
from ..assemblicon.highlevel.source import TempArtSource, NewArtSource
|
||||
from ..assemblicon.highlevel.sink import FdArtSink
|
||||
from ..assemblicon.geometry import Rectangle
|
||||
from ..assemblicon.lowlevel.artproc import (
|
||||
art_anchor_to_offset,
|
||||
anchor_to_offset,
|
||||
default_art_resize,
|
||||
@@ -37,19 +37,6 @@ def register(ctx: AuroraContext) -> None:
|
||||
),
|
||||
build_image_zoom_original_icon,
|
||||
)
|
||||
ctx.register(
|
||||
"nostd/action/monitor-zoom-fit-best",
|
||||
(
|
||||
TempArtSource("component", "triangle-left.png"),
|
||||
TempArtSource("component", "triangle-down.png"),
|
||||
TempArtSource("component", "triangle-right.png"),
|
||||
TempArtSource("component", "triangle-up.png"),
|
||||
TempArtSource("component", "monitor.png"),
|
||||
NewArtSource(),
|
||||
FdArtSink(FdContext.Actions, "monitor-zoom-fit-best"),
|
||||
),
|
||||
build_monitor_zoom_fit_best_icon,
|
||||
)
|
||||
|
||||
|
||||
def build_image_properties_icon(
|
||||
@@ -158,86 +145,3 @@ def build_image_zoom_original_icon(
|
||||
|
||||
# save it
|
||||
fd_sink.push(env, icon)
|
||||
|
||||
def build_monitor_zoom_fit_best_icon(
|
||||
env: AuroraEnvironment,
|
||||
tri_left_src: TempArtSource,
|
||||
tri_down_src: TempArtSource,
|
||||
tri_right_src: TempArtSource,
|
||||
tri_up_src: TempArtSource,
|
||||
inner_src: TempArtSource,
|
||||
new_art: NewArtSource,
|
||||
fd_sink: FdArtSink,
|
||||
) -> None:
|
||||
# load triangle assets
|
||||
TRI_SIZE = (200, 200)
|
||||
tri_left = default_art_resize(tri_left_src.pull(env), *TRI_SIZE)
|
||||
tri_down = default_art_resize(tri_down_src.pull(env), *TRI_SIZE)
|
||||
tri_right = default_art_resize(tri_right_src.pull(env), *TRI_SIZE)
|
||||
tri_up = default_art_resize(tri_up_src.pull(env), *TRI_SIZE)
|
||||
|
||||
# load inner image
|
||||
inner = inner_src.pull(env)
|
||||
resized_inner = default_art_resize(inner, 620, 620)
|
||||
|
||||
# composite this icon
|
||||
icon = new_art.pull()
|
||||
|
||||
align_paste(
|
||||
icon,
|
||||
resized_inner,
|
||||
art_anchor_to_offset(icon, HorizontalAnchor.Center, VerticalAnchor.Center),
|
||||
art_anchor_to_offset(
|
||||
resized_inner, HorizontalAnchor.Center, VerticalAnchor.Center
|
||||
),
|
||||
)
|
||||
|
||||
tri_rect = Rectangle.from_margin_rect(VART_HW, VART_HW, 100, 0, 100, 0)
|
||||
align_alpha_composite(
|
||||
icon,
|
||||
tri_right,
|
||||
anchor_to_offset(
|
||||
tri_rect.width,
|
||||
tri_rect.height,
|
||||
HorizontalAnchor.Left,
|
||||
VerticalAnchor.Center,
|
||||
)
|
||||
+ tri_rect.pos1,
|
||||
art_anchor_to_offset(tri_right, HorizontalAnchor.Left, VerticalAnchor.Center),
|
||||
)
|
||||
align_alpha_composite(
|
||||
icon,
|
||||
tri_left,
|
||||
anchor_to_offset(
|
||||
tri_rect.width,
|
||||
tri_rect.height,
|
||||
HorizontalAnchor.Right,
|
||||
VerticalAnchor.Center,
|
||||
)
|
||||
+ tri_rect.pos1,
|
||||
art_anchor_to_offset(tri_left, HorizontalAnchor.Right, VerticalAnchor.Center),
|
||||
)
|
||||
align_alpha_composite(
|
||||
icon,
|
||||
tri_down,
|
||||
anchor_to_offset(
|
||||
tri_rect.width, tri_rect.height, HorizontalAnchor.Center, VerticalAnchor.Top
|
||||
)
|
||||
+ tri_rect.pos1,
|
||||
art_anchor_to_offset(tri_down, HorizontalAnchor.Center, VerticalAnchor.Top),
|
||||
)
|
||||
align_alpha_composite(
|
||||
icon,
|
||||
tri_up,
|
||||
anchor_to_offset(
|
||||
tri_rect.width,
|
||||
tri_rect.height,
|
||||
HorizontalAnchor.Center,
|
||||
VerticalAnchor.Bottom,
|
||||
)
|
||||
+ tri_rect.pos1,
|
||||
art_anchor_to_offset(tri_up, HorizontalAnchor.Center, VerticalAnchor.Bottom),
|
||||
)
|
||||
|
||||
# save it
|
||||
fd_sink.push(env, icon)
|
||||
@@ -1,24 +1,13 @@
|
||||
from ..types import AuroraContext, AuroraEnvironment
|
||||
from assemblicon.highlevel.utils import (
|
||||
FdContext,
|
||||
IcoCategory,
|
||||
IcnsCategory,
|
||||
MsixCategory,
|
||||
)
|
||||
from assemblicon.highlevel.source import (
|
||||
from ..assemblicon.highlevel.utils import FdContext, WinCategory, MacCategory
|
||||
from ..assemblicon.highlevel.source import (
|
||||
SvgSource,
|
||||
TempArtSource,
|
||||
NewArtSource,
|
||||
BlenderSource,
|
||||
)
|
||||
from assemblicon.highlevel.sink import (
|
||||
FdArtSink,
|
||||
IcoArtSink,
|
||||
MsixArtSink,
|
||||
IcnsArtSink,
|
||||
TempArtSink,
|
||||
)
|
||||
from assemblicon.lowlevel.artproc import (
|
||||
from ..assemblicon.highlevel.sink import FdArtSink, WinArtSink, MacArtSink, TempArtSink
|
||||
from ..assemblicon.lowlevel.artproc import (
|
||||
art_anchor_to_offset,
|
||||
default_art_resize,
|
||||
align_paste,
|
||||
@@ -29,15 +18,14 @@ from assemblicon.lowlevel.artproc import (
|
||||
|
||||
def register(ctx: AuroraContext) -> None:
|
||||
ctx.register(
|
||||
"nostd/application/org.sarasaschipworkshop.picture",
|
||||
"nostd/application/org.sarasachipworkshop.picture",
|
||||
(
|
||||
SvgSource("apps", "sarasacw-picture-frame.svg"),
|
||||
TempArtSource("image-jpeg.png"),
|
||||
NewArtSource(),
|
||||
FdArtSink(FdContext.Applications, "org.sarasaschipworkshop.picture"),
|
||||
IcoArtSink(IcoCategory.Application, "sarasacw-picture"),
|
||||
MsixArtSink(MsixCategory.Application, "SarasasChipWorkshop.Picture"),
|
||||
IcnsArtSink(IcnsCategory.Application, "sarasacw-picture"),
|
||||
FdArtSink(FdContext.Applications, "org.sarasachipworkshop.picture"),
|
||||
WinArtSink(WinCategory.Application, "sarasacw-picture"),
|
||||
MacArtSink(MacCategory.Application, "sarasacw-picture"),
|
||||
),
|
||||
build_sarasacw_picture_icon,
|
||||
)
|
||||
@@ -46,8 +34,7 @@ def register(ctx: AuroraContext) -> None:
|
||||
(
|
||||
BlenderSource("apps", "notepad.blend"),
|
||||
TempArtSink("notepad.png"),
|
||||
IcoArtSink(IcoCategory.Application, "notepad"),
|
||||
MsixArtSink(MsixCategory.Application, "Notepad"),
|
||||
WinArtSink(WinCategory.Application, "notepad"),
|
||||
),
|
||||
build_notepad_icon,
|
||||
)
|
||||
@@ -59,9 +46,8 @@ def build_sarasacw_picture_icon(
|
||||
inner_src: TempArtSource,
|
||||
new_art: NewArtSource,
|
||||
fd_sink: FdArtSink,
|
||||
ico_sink: IcoArtSink,
|
||||
msix_sink: MsixArtSink,
|
||||
icns_sink: IcnsArtSink,
|
||||
win_sink: WinArtSink,
|
||||
mac_sink: MacArtSink,
|
||||
) -> None:
|
||||
app = new_art.pull()
|
||||
frame = frame_src.pull(env)
|
||||
@@ -81,19 +67,16 @@ def build_sarasacw_picture_icon(
|
||||
|
||||
# save artifact
|
||||
fd_sink.push(env, app)
|
||||
ico_sink.push(env, app)
|
||||
msix_sink.push(env, app)
|
||||
icns_sink.push(env, app)
|
||||
win_sink.push(env, app)
|
||||
mac_sink.push(env, app)
|
||||
|
||||
|
||||
def build_notepad_icon(
|
||||
env: AuroraEnvironment,
|
||||
src: BlenderSource,
|
||||
temp_sink: TempArtSink,
|
||||
ico_sink: IcoArtSink,
|
||||
msix_sink: MsixArtSink,
|
||||
win_sink: WinArtSink,
|
||||
) -> None:
|
||||
src.pull_to_temp(env, temp_sink)
|
||||
with temp_sink.repull(env) as art:
|
||||
ico_sink.push(env, art)
|
||||
msix_sink.push(env, art)
|
||||
win_sink.push(env, art)
|
||||
@@ -1,18 +1,7 @@
|
||||
from ..types import AuroraContext, AuroraEnvironment
|
||||
from assemblicon.highlevel.utils import (
|
||||
FdContext,
|
||||
IcoCategory,
|
||||
IcnsCategory,
|
||||
MsixCategory,
|
||||
)
|
||||
from assemblicon.highlevel.source import SvgSource, TempArtSource
|
||||
from assemblicon.highlevel.sink import (
|
||||
TempArtSink,
|
||||
FdArtSink,
|
||||
IcoArtSink,
|
||||
MsixArtSink,
|
||||
IcnsArtSink,
|
||||
)
|
||||
from ..assemblicon.highlevel.utils import FdContext, WinCategory, MacCategory
|
||||
from ..assemblicon.highlevel.source import SvgSource, TempArtSource
|
||||
from ..assemblicon.highlevel.sink import TempArtSink, FdArtSink, WinArtSink, MacArtSink
|
||||
|
||||
|
||||
def register(ctx: AuroraContext) -> None:
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import PIL.Image
|
||||
from ..types import AuroraContext, AuroraEnvironment
|
||||
from assemblicon.geometry import Rectangle, Point
|
||||
from assemblicon.lowlevel.artproc import default_art_resize, align_alpha_composite
|
||||
from assemblicon.highlevel.utils import FdContext
|
||||
from assemblicon.highlevel.source import SvgSource, TempArtSource
|
||||
from assemblicon.highlevel.sink import FdArtSink
|
||||
from ..assemblicon.geometry import Rectangle, Point
|
||||
from ..assemblicon.lowlevel.artproc import default_art_resize, align_alpha_composite
|
||||
from ..assemblicon.highlevel.utils import FdContext
|
||||
from ..assemblicon.highlevel.source import SvgSource, TempArtSource
|
||||
from ..assemblicon.highlevel.sink import FdArtSink
|
||||
|
||||
|
||||
def register(ctx: AuroraContext) -> None:
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import PIL.Image
|
||||
from ..types import AuroraContext, AuroraEnvironment
|
||||
from assemblicon.highlevel.source import (
|
||||
from ..assemblicon.highlevel.source import (
|
||||
SvgSource,
|
||||
TempArtSource,
|
||||
NewArtSource,
|
||||
BlenderSource,
|
||||
)
|
||||
from assemblicon.highlevel.sink import TempArtSink
|
||||
from ..assemblicon.highlevel.sink import TempArtSink
|
||||
|
||||
|
||||
def register(ctx: AuroraContext) -> None:
|
||||
@@ -51,14 +51,6 @@ def register(ctx: AuroraContext) -> None:
|
||||
),
|
||||
build_magnifying_glass_icon,
|
||||
)
|
||||
ctx.register(
|
||||
"component/monitor",
|
||||
(
|
||||
SvgSource("component", "monitor.svg"),
|
||||
TempArtSink("component", "monitor.png"),
|
||||
),
|
||||
build_generic_background,
|
||||
)
|
||||
|
||||
|
||||
def build_generic_background(
|
||||
@@ -130,9 +122,3 @@ def build_magnifying_glass_icon(
|
||||
env: AuroraEnvironment, src: BlenderSource, sink: TempArtSink
|
||||
) -> None:
|
||||
src.pull_to_temp(env, sink)
|
||||
|
||||
|
||||
def build_monitor_icon(
|
||||
env: AuroraEnvironment, src: SvgSource, sink: TempArtSink
|
||||
) -> None:
|
||||
src.pull_to_temp(env, sink)
|
||||
@@ -1,29 +1,17 @@
|
||||
import PIL.Image
|
||||
import PIL.ImageEnhance
|
||||
from ..types import AuroraContext, AuroraEnvironment
|
||||
from assemblicon.highlevel.utils import (
|
||||
FdContext,
|
||||
IcoCategory,
|
||||
IcnsCategory,
|
||||
MsixCategory,
|
||||
)
|
||||
from assemblicon.highlevel.source import (
|
||||
from ..assemblicon.highlevel.utils import FdContext, WinCategory, MacCategory
|
||||
from ..assemblicon.highlevel.source import (
|
||||
SvgSource,
|
||||
BlenderSource,
|
||||
BitmapSource,
|
||||
TempArtSource,
|
||||
FdArtSource,
|
||||
)
|
||||
from assemblicon.highlevel.sink import (
|
||||
TempArtSink,
|
||||
FdArtSink,
|
||||
IcoArtSink,
|
||||
MsixArtSink,
|
||||
IcnsArtSink,
|
||||
)
|
||||
from assemblicon.geometry import Rectangle, Point
|
||||
from assemblicon.lowlevel.artio import new_artifact
|
||||
from assemblicon.lowlevel.artproc import (
|
||||
from ..assemblicon.highlevel.sink import TempArtSink, FdArtSink, WinArtSink, MacArtSink
|
||||
from ..assemblicon.geometry import Rectangle, Point
|
||||
from ..assemblicon.lowlevel.artio import new_artifact
|
||||
from ..assemblicon.lowlevel.artproc import (
|
||||
aspect_ratio_scale_and_crop,
|
||||
VerticalAnchor,
|
||||
HorizontalAnchor,
|
||||
@@ -51,12 +39,11 @@ def register(ctx: AuroraContext) -> None:
|
||||
"std/mimetype/image-jpeg",
|
||||
(
|
||||
TempArtSource("component", "image-base.png"),
|
||||
BitmapSource("bitmap", "Herbert_Lake_beim_Icefields_Parkway.jpg"),
|
||||
BitmapSource("bitmap", "Niinsaare_järv.jpg"),
|
||||
TempArtSink("image-jpeg.png"),
|
||||
FdArtSink(FdContext.MimeTypes, "image-jpeg"),
|
||||
IcoArtSink(IcoCategory.Extension, "jpg"),
|
||||
MsixArtSink(MsixCategory.Extension, "jpg"),
|
||||
IcnsArtSink(IcnsCategory.Extension, "jpg"),
|
||||
WinArtSink(WinCategory.Extension, "jpg"),
|
||||
MacArtSink(MacCategory.Extension, "jpg"),
|
||||
),
|
||||
build_image_jpeg_icon,
|
||||
)
|
||||
@@ -64,13 +51,12 @@ def register(ctx: AuroraContext) -> None:
|
||||
"std/mimetype/image-png",
|
||||
(
|
||||
TempArtSource("component", "image-base.png"),
|
||||
BitmapSource("bitmap", "Narzisse.jpg"),
|
||||
BitmapSource("bitmap", "Narzisse-mask.png"),
|
||||
BitmapSource("bitmap", "Tulipa_suaveolens_floriade_to_Canberra.jpg"),
|
||||
BitmapSource("bitmap", "Tulipa_suaveolens_floriade_to_Canberra-mask.png"),
|
||||
SvgSource("image-png-checkerboard.svg"),
|
||||
FdArtSink(FdContext.MimeTypes, "image-png"),
|
||||
IcoArtSink(IcoCategory.Extension, "png"),
|
||||
MsixArtSink(MsixCategory.Extension, "png"),
|
||||
IcnsArtSink(IcnsCategory.Extension, "png"),
|
||||
WinArtSink(WinCategory.Extension, "png"),
|
||||
MacArtSink(MacCategory.Extension, "png"),
|
||||
),
|
||||
build_image_png_icon,
|
||||
)
|
||||
@@ -80,9 +66,8 @@ def register(ctx: AuroraContext) -> None:
|
||||
TempArtSource("component", "image-base.png"),
|
||||
BitmapSource("bitmap", "Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg"),
|
||||
FdArtSink(FdContext.MimeTypes, "image-bmp"),
|
||||
IcoArtSink(IcoCategory.Extension, "bmp"),
|
||||
MsixArtSink(MsixCategory.Extension, "bmp"),
|
||||
IcnsArtSink(IcnsCategory.Extension, "bmp"),
|
||||
WinArtSink(WinCategory.Extension, "bmp"),
|
||||
MacArtSink(MacCategory.Extension, "bmp"),
|
||||
),
|
||||
build_image_bmp_icon,
|
||||
)
|
||||
@@ -90,26 +75,13 @@ def register(ctx: AuroraContext) -> None:
|
||||
"std/mimetype/image-gif",
|
||||
(
|
||||
TempArtSource("component", "image-base.png"),
|
||||
BitmapSource("bitmap", "Kite_(23729899095).jpg"),
|
||||
BitmapSource("bitmap", "Hot-air_balloon_in_Tambov_-_02.jpg"),
|
||||
FdArtSink(FdContext.MimeTypes, "image-gif"),
|
||||
IcoArtSink(IcoCategory.Extension, "gif"),
|
||||
MsixArtSink(MsixCategory.Extension, "gif"),
|
||||
IcnsArtSink(IcnsCategory.Extension, "gif"),
|
||||
WinArtSink(WinCategory.Extension, "gif"),
|
||||
MacArtSink(MacCategory.Extension, "gif"),
|
||||
),
|
||||
build_image_gif_icon,
|
||||
)
|
||||
ctx.register(
|
||||
"std/mimetype/image-svg",
|
||||
(
|
||||
TempArtSource("component", "image-base.png"),
|
||||
BlenderSource("exts", "vector-image-inner.blend"),
|
||||
FdArtSink(FdContext.MimeTypes, "image-svg"),
|
||||
IcoArtSink(IcoCategory.Extension, "svg"),
|
||||
MsixArtSink(MsixCategory.Extension, "svg"),
|
||||
IcnsArtSink(IcnsCategory.Extension, "svg"),
|
||||
),
|
||||
build_image_svg_icon,
|
||||
)
|
||||
|
||||
|
||||
def build_image_base_icon(
|
||||
@@ -135,16 +107,22 @@ def build_image_jpeg_icon(
|
||||
bitmap_src: BitmapSource,
|
||||
temp_sink: TempArtSink,
|
||||
fd_sink: FdArtSink,
|
||||
ico_sink: IcoArtSink,
|
||||
msix_sink: MsixArtSink,
|
||||
icns_sink: IcnsArtSink,
|
||||
win_sink: WinArtSink,
|
||||
mac_sink: MacArtSink,
|
||||
) -> None:
|
||||
jpg_image = base_src.pull(env)
|
||||
|
||||
jpg_image_inner = bitmap_src.pull(env)
|
||||
with jpg_image_inner:
|
||||
# crop the area which is interested by ourselves
|
||||
interest_area = Rectangle.from_pos_size_rect(Point(2700, 0), 5016, 3888)
|
||||
crop_jpg_image_inner = jpg_image_inner.crop(interest_area.to_tuple())
|
||||
# do a flip
|
||||
flip_jpg_image_inner = crop_jpg_image_inner.transpose(
|
||||
PIL.Image.Transpose.FLIP_LEFT_RIGHT
|
||||
)
|
||||
# enhance its saturation
|
||||
enhancer = PIL.ImageEnhance.Color(jpg_image_inner)
|
||||
enhancer = PIL.ImageEnhance.Color(flip_jpg_image_inner)
|
||||
saturated_jpg_image_inner = enhancer.enhance(1.4)
|
||||
|
||||
# fit to inner rect
|
||||
@@ -153,9 +131,8 @@ def build_image_jpeg_icon(
|
||||
IMAGE_INNER_RECT.width,
|
||||
IMAGE_INNER_RECT.height,
|
||||
PIL.Image.Resampling.NEAREST,
|
||||
# Left-top to keep more sky and more our interested area.
|
||||
HorizontalAnchor.Left,
|
||||
VerticalAnchor.Top,
|
||||
HorizontalAnchor.Center,
|
||||
VerticalAnchor.Center,
|
||||
)
|
||||
# paste into inner rect
|
||||
jpg_image.paste(bestfit_jpg_image_inner, IMAGE_INNER_RECT.to_tuple())
|
||||
@@ -166,9 +143,8 @@ def build_image_jpeg_icon(
|
||||
# save for FD
|
||||
fd_sink.push(env, jpg_image)
|
||||
# save for windows and mac
|
||||
ico_sink.push(env, jpg_image)
|
||||
msix_sink.push(env, jpg_image)
|
||||
icns_sink.push(env, jpg_image)
|
||||
win_sink.push(env, jpg_image)
|
||||
mac_sink.push(env, jpg_image)
|
||||
|
||||
|
||||
def build_image_png_icon(
|
||||
@@ -178,9 +154,8 @@ def build_image_png_icon(
|
||||
bitmap_mask_src: BitmapSource,
|
||||
checkerboard_src: SvgSource,
|
||||
fd_sink: FdArtSink,
|
||||
ico_sink: IcoArtSink,
|
||||
msix_sink: MsixArtSink,
|
||||
icns_sink: IcnsArtSink,
|
||||
win_sink: WinArtSink,
|
||||
mac_sink: MacArtSink,
|
||||
) -> None:
|
||||
png_image = base_src.pull(env)
|
||||
|
||||
@@ -201,8 +176,8 @@ def build_image_png_icon(
|
||||
IMAGE_INNER_RECT.width,
|
||||
IMAGE_INNER_RECT.height,
|
||||
PIL.Image.Resampling.NEAREST,
|
||||
HorizontalAnchor.Left,
|
||||
VerticalAnchor.Center,
|
||||
HorizontalAnchor.Center,
|
||||
VerticalAnchor.Top,
|
||||
)
|
||||
# TODO: When bestfit this checkerboard, the border of this checkerboard aer lost.
|
||||
# We may need resolve this in future but currently it is so subtle to notice.
|
||||
@@ -225,9 +200,8 @@ def build_image_png_icon(
|
||||
# save for FD
|
||||
fd_sink.push(env, png_image)
|
||||
# save for windows and mac
|
||||
ico_sink.push(env, png_image)
|
||||
msix_sink.push(env, png_image)
|
||||
icns_sink.push(env, png_image)
|
||||
win_sink.push(env, png_image)
|
||||
mac_sink.push(env, png_image)
|
||||
|
||||
|
||||
def build_image_bmp_icon(
|
||||
@@ -235,9 +209,8 @@ def build_image_bmp_icon(
|
||||
base_src: TempArtSource,
|
||||
bitmap_src: BitmapSource,
|
||||
fd_sink: FdArtSink,
|
||||
ico_sink: IcoArtSink,
|
||||
msix_sink: MsixArtSink,
|
||||
icns_sink: IcnsArtSink,
|
||||
win_sink: WinArtSink,
|
||||
mac_sink: MacArtSink,
|
||||
) -> None:
|
||||
bmp_image = base_src.pull(env)
|
||||
|
||||
@@ -260,9 +233,8 @@ def build_image_bmp_icon(
|
||||
# save for FD
|
||||
fd_sink.push(env, bmp_image)
|
||||
# save for windows and mac
|
||||
ico_sink.push(env, bmp_image)
|
||||
msix_sink.push(env, bmp_image)
|
||||
icns_sink.push(env, bmp_image)
|
||||
win_sink.push(env, bmp_image)
|
||||
mac_sink.push(env, bmp_image)
|
||||
|
||||
|
||||
def build_image_gif_icon(
|
||||
@@ -270,22 +242,17 @@ def build_image_gif_icon(
|
||||
base_src: TempArtSource,
|
||||
bitmap_src: BitmapSource,
|
||||
fd_sink: FdArtSink,
|
||||
ico_sink: IcoArtSink,
|
||||
msix_sink: MsixArtSink,
|
||||
icns_sink: IcnsArtSink,
|
||||
win_sink: WinArtSink,
|
||||
mac_sink: MacArtSink,
|
||||
) -> None:
|
||||
gif_image = base_src.pull(env)
|
||||
|
||||
gif_image_inner = bitmap_src.pull(env)
|
||||
with gif_image_inner:
|
||||
# crop the area which is interested by ourselves
|
||||
interest_area = Rectangle.from_pos_size_rect(Point(1600, 520), 2752, 1992)
|
||||
crop_gif_image_inner = gif_image_inner.crop(interest_area.to_tuple())
|
||||
|
||||
# we use the whole image as the inner,
|
||||
# so we directly fit it to inner.
|
||||
bestfit_inner = aspect_ratio_scale_and_crop(
|
||||
crop_gif_image_inner,
|
||||
gif_image_inner,
|
||||
IMAGE_INNER_RECT.width,
|
||||
IMAGE_INNER_RECT.height,
|
||||
PIL.Image.Resampling.NEAREST,
|
||||
@@ -299,41 +266,5 @@ def build_image_gif_icon(
|
||||
# save for FD
|
||||
fd_sink.push(env, gif_image)
|
||||
# save for windows and mac
|
||||
ico_sink.push(env, gif_image)
|
||||
msix_sink.push(env, gif_image)
|
||||
icns_sink.push(env, gif_image)
|
||||
|
||||
|
||||
def build_image_svg_icon(
|
||||
env: AuroraEnvironment,
|
||||
base_src: TempArtSource,
|
||||
blender_src: BlenderSource,
|
||||
fd_sink: FdArtSink,
|
||||
ico_sink: IcoArtSink,
|
||||
msix_sink: MsixArtSink,
|
||||
icns_sink: IcnsArtSink,
|
||||
) -> None:
|
||||
svg_image = base_src.pull(env)
|
||||
|
||||
svg_image_inner = blender_src.pull(env)
|
||||
with svg_image_inner:
|
||||
# we use the whole image as the inner,
|
||||
# so we directly fit it to inner.
|
||||
bestfit_inner = aspect_ratio_scale_and_crop(
|
||||
svg_image_inner,
|
||||
IMAGE_INNER_RECT.width,
|
||||
IMAGE_INNER_RECT.height,
|
||||
PIL.Image.Resampling.NEAREST,
|
||||
HorizontalAnchor.Center,
|
||||
VerticalAnchor.Center,
|
||||
)
|
||||
# paste into inner rect
|
||||
svg_image.paste(bestfit_inner, IMAGE_INNER_RECT.to_tuple())
|
||||
|
||||
# build artifacts
|
||||
# save for FD
|
||||
fd_sink.push(env, svg_image)
|
||||
# save for windows and mac
|
||||
ico_sink.push(env, svg_image)
|
||||
msix_sink.push(env, svg_image)
|
||||
icns_sink.push(env, svg_image)
|
||||
win_sink.push(env, gif_image)
|
||||
mac_sink.push(env, gif_image)
|
||||
@@ -1,7 +1,7 @@
|
||||
from ..types import AuroraContext, AuroraEnvironment
|
||||
from assemblicon.highlevel.utils import FdContext
|
||||
from assemblicon.highlevel.source import SvgSource
|
||||
from assemblicon.highlevel.sink import TempArtSink, FdArtSink
|
||||
from ..assemblicon.highlevel.utils import FdContext
|
||||
from ..assemblicon.highlevel.source import SvgSource
|
||||
from ..assemblicon.highlevel.sink import TempArtSink, FdArtSink
|
||||
|
||||
|
||||
def register(ctx: AuroraContext) -> None:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from dataclasses import dataclass
|
||||
from assemblicon.highlevel.environment import Environment, Prologue
|
||||
from assemblicon.highlevel.context import Context
|
||||
from .assemblicon.highlevel.environment import Environment, Prologue
|
||||
from .assemblicon.highlevel.context import Context
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
||||
Generated
+2
-10
@@ -2,24 +2,16 @@ version = 1
|
||||
revision = 2
|
||||
requires-python = ">=3.13"
|
||||
|
||||
[[package]]
|
||||
name = "assemblicon"
|
||||
version = "0.1.0"
|
||||
source = { git = "https://github.com/SarasasChipWorkshop/assemblicon#4549e37f88efb800de98a9d7c73cf0cade1b0876" }
|
||||
dependencies = [
|
||||
{ name = "pillow" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aurora-iconset-builder"
|
||||
version = "0.1.0"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "assemblicon" },
|
||||
{ name = "pillow" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [{ name = "assemblicon", git = "https://github.com/SarasasChipWorkshop/assemblicon" }]
|
||||
requires-dist = [{ name = "pillow", specifier = ">=12.3.0" }]
|
||||
|
||||
[[package]]
|
||||
name = "pillow"
|
||||
|
||||
Reference in new issue
Block a user