first commit
|
@ -0,0 +1,661 @@
|
|||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. httpfsf.org
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
andor modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
This License refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
Copyright also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
The Program refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as you. Licensees and
|
||||
recipients may be individuals or organizations.
|
||||
|
||||
To modify a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a modified version of the
|
||||
earlier work or a work based on the earlier work.
|
||||
|
||||
A covered work means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To propagate a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To convey a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays Appropriate Legal Notices
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The source code for a work means the preferred form of the work
|
||||
for making modifications to it. Object code means any non-source
|
||||
form of a work.
|
||||
|
||||
A Standard Interface means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The System Libraries of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
Major Component, in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The Corresponding Source for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
keep intact all notices.
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
aggregate if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A User Product is either (1) a consumer product, which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, normally used refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
Installation Information for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
Additional permissions are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered further
|
||||
restrictions within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An entity transaction is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A contributor is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's contributor version.
|
||||
|
||||
A contributor's essential patent claims are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, control includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a patent license is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To grant such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. Knowingly relying means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is discriminatory if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised andor new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License or any later version applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS ANDOR OTHER PARTIES PROVIDE THE PROGRAM AS IS WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES ANDOR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the copyright line and a pointer to where the full notice is found.
|
||||
|
||||
one line to give the program's name and a brief idea of what it does.
|
||||
Copyright (C) year name of author
|
||||
|
||||
This program is free software you can redistribute it andor modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see httpwww.gnu.orglicenses.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a Source link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a copyright disclaimer for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
httpwww.gnu.orglicenses.
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
INCLUDEPATH += $$PWD/giflib
|
||||
|
||||
SOURCES += $$PWD/giflib/dgif_lib.c \
|
||||
$$PWD/giflib/egif_lib.c \
|
||||
$$PWD/giflib/gif_err.c \
|
||||
$$PWD/giflib/gif_hash.c \
|
||||
$$PWD/giflib/gifalloc.c \
|
||||
$$PWD/giflib/quantize.c
|
|
@ -0,0 +1,36 @@
|
|||
Michael Brown <michael_brown_uk[AT]hotmail.com>
|
||||
callbacks to write data via user defined function
|
||||
|
||||
Daniel Eisenbud <eisenbud[AT]google.com>
|
||||
Fixes for crashes with invalid gif files and double freeing of
|
||||
colormaps
|
||||
|
||||
Gershon Elber <gershon[AT]cs.technion.sc.il>
|
||||
original giflib code
|
||||
|
||||
Marc Ewing <marc[AT]redhat.com>
|
||||
spec file (for rpms) updates
|
||||
|
||||
Toshio Kuratomi <toshio[AT]tiki-lounge.com>
|
||||
uncompressed gif writing code
|
||||
autoconf/automake process
|
||||
former maintainer
|
||||
|
||||
marek <marwaw[AT]users.sourceforge.net>
|
||||
Gif initialization fix
|
||||
windows build code
|
||||
|
||||
Peter Mehlitz <peter[AT]transvirtual.com>
|
||||
callbacks to read data from arbitrary sources (like libjpeg/libpng)
|
||||
|
||||
Dick Porter <dick[AT]cymru.net>
|
||||
int/pointer fixes for Alpha
|
||||
|
||||
Eric Raymond <esr[AT]snark.thyrsus.com>
|
||||
current as well as long time former maintainer of giflib code
|
||||
|
||||
Petter Reinholdtsen <pere[AT]hungry.com>
|
||||
Tru64 build fixs
|
||||
|
||||
Georg Schwarz <geos[AT]epost.de>
|
||||
IRIX fixes
|
|
@ -0,0 +1,19 @@
|
|||
The GIFLIB distribution is Copyright (c) 1997 Eric S. Raymond
|
||||
|
||||
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.
|
|
@ -0,0 +1,27 @@
|
|||
= GIFLIB =
|
||||
|
||||
This is the README file of GIFLIB, a library for manipulating GIF files.
|
||||
|
||||
Latest versions of GIFLIB are currently hosted at:
|
||||
http://sourceforge.net/projects/giflib
|
||||
|
||||
== Overview ==
|
||||
|
||||
GIF is a legacy format; we recommend against generating new images in
|
||||
it. For a cleaner, more extensible design with better color support
|
||||
and compression, look up PNG.
|
||||
|
||||
giflib provides code for reading GIF files and transforming them into
|
||||
RGB bitmaps, and for writing RGB bitmaps as GIF files.
|
||||
|
||||
The (permissive) open-source license is in the file COPYING.
|
||||
|
||||
You will find build instructions in build.asc
|
||||
|
||||
You will find full documentation of the API in doc/ and on the
|
||||
project website.
|
||||
|
||||
The project has a long and confusing history, described in history.asc
|
||||
|
||||
The project to-do list is in TODO.
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
/*****************************************************************************
|
||||
|
||||
gif_err.c - handle error reporting for the GIF library.
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "gif_lib.h"
|
||||
#include "gif_lib_private.h"
|
||||
|
||||
/*****************************************************************************
|
||||
Return a string description of the last GIF error
|
||||
*****************************************************************************/
|
||||
char *
|
||||
GifErrorString(int ErrorCode)
|
||||
{
|
||||
char *Err;
|
||||
|
||||
switch (ErrorCode) {
|
||||
case E_GIF_ERR_OPEN_FAILED:
|
||||
Err = "Failed to open given file";
|
||||
break;
|
||||
case E_GIF_ERR_WRITE_FAILED:
|
||||
Err = "Failed to write to given file";
|
||||
break;
|
||||
case E_GIF_ERR_HAS_SCRN_DSCR:
|
||||
Err = "Screen descriptor has already been set";
|
||||
break;
|
||||
case E_GIF_ERR_HAS_IMAG_DSCR:
|
||||
Err = "Image descriptor is still active";
|
||||
break;
|
||||
case E_GIF_ERR_NO_COLOR_MAP:
|
||||
Err = "Neither global nor local color map";
|
||||
break;
|
||||
case E_GIF_ERR_DATA_TOO_BIG:
|
||||
Err = "Number of pixels bigger than width * height";
|
||||
break;
|
||||
case E_GIF_ERR_NOT_ENOUGH_MEM:
|
||||
Err = "Failed to allocate required memory";
|
||||
break;
|
||||
case E_GIF_ERR_DISK_IS_FULL:
|
||||
Err = "Write failed (disk full?)";
|
||||
break;
|
||||
case E_GIF_ERR_CLOSE_FAILED:
|
||||
Err = "Failed to close given file";
|
||||
break;
|
||||
case E_GIF_ERR_NOT_WRITEABLE:
|
||||
Err = "Given file was not opened for write";
|
||||
break;
|
||||
case D_GIF_ERR_OPEN_FAILED:
|
||||
Err = "Failed to open given file";
|
||||
break;
|
||||
case D_GIF_ERR_READ_FAILED:
|
||||
Err = "Failed to read from given file";
|
||||
break;
|
||||
case D_GIF_ERR_NOT_GIF_FILE:
|
||||
Err = "Data is not in GIF format";
|
||||
break;
|
||||
case D_GIF_ERR_NO_SCRN_DSCR:
|
||||
Err = "No screen descriptor detected";
|
||||
break;
|
||||
case D_GIF_ERR_NO_IMAG_DSCR:
|
||||
Err = "No Image Descriptor detected";
|
||||
break;
|
||||
case D_GIF_ERR_NO_COLOR_MAP:
|
||||
Err = "Neither global nor local color map";
|
||||
break;
|
||||
case D_GIF_ERR_WRONG_RECORD:
|
||||
Err = "Wrong record type detected";
|
||||
break;
|
||||
case D_GIF_ERR_DATA_TOO_BIG:
|
||||
Err = "Number of pixels bigger than width * height";
|
||||
break;
|
||||
case D_GIF_ERR_NOT_ENOUGH_MEM:
|
||||
Err = "Failed to allocate required memory";
|
||||
break;
|
||||
case D_GIF_ERR_CLOSE_FAILED:
|
||||
Err = "Failed to close given file";
|
||||
break;
|
||||
case D_GIF_ERR_NOT_READABLE:
|
||||
Err = "Given file was not opened for read";
|
||||
break;
|
||||
case D_GIF_ERR_IMAGE_DEFECT:
|
||||
Err = "Image is defective, decoding aborted";
|
||||
break;
|
||||
case D_GIF_ERR_EOF_TOO_SOON:
|
||||
Err = "Image EOF detected before image complete";
|
||||
break;
|
||||
default:
|
||||
Err = NULL;
|
||||
break;
|
||||
}
|
||||
return Err;
|
||||
}
|
||||
|
||||
/* end */
|
|
@ -0,0 +1,252 @@
|
|||
/*****************************************************************************
|
||||
|
||||
gif_font.c - utility font handling and simple drawing for the GIF library
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "gif_lib.h"
|
||||
|
||||
/*****************************************************************************
|
||||
Ascii 8 by 8 regular font - only first 128 characters are supported.
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Each array entry holds the bits for 8 horizontal scan lines, topmost
|
||||
* first. The most significant bit of each constant is the leftmost bit of
|
||||
* the scan line.
|
||||
*/
|
||||
/*@+charint@*/
|
||||
const unsigned char GifAsciiTable8x8[][GIF_FONT_WIDTH] = {
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* Ascii 0 */
|
||||
{0x3c, 0x42, 0xa5, 0x81, 0xbd, 0x42, 0x3c, 0x00}, /* Ascii 1 */
|
||||
{0x3c, 0x7e, 0xdb, 0xff, 0xc3, 0x7e, 0x3c, 0x00}, /* Ascii 2 */
|
||||
{0x00, 0xee, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00}, /* Ascii 3 */
|
||||
{0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00}, /* Ascii 4 */
|
||||
{0x00, 0x3c, 0x18, 0xff, 0xff, 0x08, 0x18, 0x00}, /* Ascii 5 */
|
||||
{0x10, 0x38, 0x7c, 0xfe, 0xfe, 0x10, 0x38, 0x00}, /* Ascii 6 */
|
||||
{0x00, 0x00, 0x18, 0x3c, 0x18, 0x00, 0x00, 0x00}, /* Ascii 7 */
|
||||
{0xff, 0xff, 0xe7, 0xc3, 0xe7, 0xff, 0xff, 0xff}, /* Ascii 8 */
|
||||
{0x00, 0x3c, 0x42, 0x81, 0x81, 0x42, 0x3c, 0x00}, /* Ascii 9 */
|
||||
{0xff, 0xc3, 0xbd, 0x7e, 0x7e, 0xbd, 0xc3, 0xff}, /* Ascii 10 */
|
||||
{0x1f, 0x07, 0x0d, 0x7c, 0xc6, 0xc6, 0x7c, 0x00}, /* Ascii 11 */
|
||||
{0x00, 0x7e, 0xc3, 0xc3, 0x7e, 0x18, 0x7e, 0x18}, /* Ascii 12 */
|
||||
{0x04, 0x06, 0x07, 0x04, 0x04, 0xfc, 0xf8, 0x00}, /* Ascii 13 */
|
||||
{0x0c, 0x0a, 0x0d, 0x0b, 0xf9, 0xf9, 0x1f, 0x1f}, /* Ascii 14 */
|
||||
{0x00, 0x92, 0x7c, 0x44, 0xc6, 0x7c, 0x92, 0x00}, /* Ascii 15 */
|
||||
{0x00, 0x00, 0x60, 0x78, 0x7e, 0x78, 0x60, 0x00}, /* Ascii 16 */
|
||||
{0x00, 0x00, 0x06, 0x1e, 0x7e, 0x1e, 0x06, 0x00}, /* Ascii 17 */
|
||||
{0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x18}, /* Ascii 18 */
|
||||
{0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00}, /* Ascii 19 */
|
||||
{0xff, 0xb6, 0x76, 0x36, 0x36, 0x36, 0x36, 0x00}, /* Ascii 20 */
|
||||
{0x7e, 0xc1, 0xdc, 0x22, 0x22, 0x1f, 0x83, 0x7e}, /* Ascii 21 */
|
||||
{0x00, 0x00, 0x00, 0x7e, 0x7e, 0x00, 0x00, 0x00}, /* Ascii 22 */
|
||||
{0x18, 0x7e, 0x18, 0x18, 0x7e, 0x18, 0x00, 0xff}, /* Ascii 23 */
|
||||
{0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00}, /* Ascii 24 */
|
||||
{0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x00}, /* Ascii 25 */
|
||||
{0x00, 0x04, 0x06, 0xff, 0x06, 0x04, 0x00, 0x00}, /* Ascii 26 */
|
||||
{0x00, 0x20, 0x60, 0xff, 0x60, 0x20, 0x00, 0x00}, /* Ascii 27 */
|
||||
{0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xff, 0x00}, /* Ascii 28 */
|
||||
{0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00}, /* Ascii 29 */
|
||||
{0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x00, 0x00}, /* Ascii 30 */
|
||||
{0x00, 0x00, 0x00, 0xfe, 0x7c, 0x38, 0x10, 0x00}, /* Ascii 31 */
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* */
|
||||
{0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x00}, /* ! */
|
||||
{0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* " */
|
||||
{0x6c, 0x6c, 0xfe, 0x6c, 0xfe, 0x6c, 0x6c, 0x00}, /* # */
|
||||
{0x10, 0x7c, 0xd2, 0x7c, 0x86, 0x7c, 0x10, 0x00}, /* $ */
|
||||
{0xf0, 0x96, 0xfc, 0x18, 0x3e, 0x72, 0xde, 0x00}, /* % */
|
||||
{0x30, 0x48, 0x30, 0x78, 0xce, 0xcc, 0x78, 0x00}, /* & */
|
||||
{0x0c, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, /* ' */
|
||||
{0x10, 0x60, 0xc0, 0xc0, 0xc0, 0x60, 0x10, 0x00}, /* ( */
|
||||
{0x10, 0x0c, 0x06, 0x06, 0x06, 0x0c, 0x10, 0x00}, /* ) */
|
||||
{0x00, 0x54, 0x38, 0xfe, 0x38, 0x54, 0x00, 0x00}, /* * */
|
||||
{0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00}, /* + */
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x70}, /* , */
|
||||
{0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00}, /* - */
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00}, /* . */
|
||||
{0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x00}, /* / */
|
||||
{0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00}, /* 0 */
|
||||
{0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 0x3c, 0x00}, /* 1 */
|
||||
{0x7c, 0xc6, 0x06, 0x0c, 0x30, 0x60, 0xfe, 0x00}, /* 2 */
|
||||
{0x7c, 0xc6, 0x06, 0x3c, 0x06, 0xc6, 0x7c, 0x00}, /* 3 */
|
||||
{0x0e, 0x1e, 0x36, 0x66, 0xfe, 0x06, 0x06, 0x00}, /* 4 */
|
||||
{0xfe, 0xc0, 0xc0, 0xfc, 0x06, 0x06, 0xfc, 0x00}, /* 5 */
|
||||
{0x7c, 0xc6, 0xc0, 0xfc, 0xc6, 0xc6, 0x7c, 0x00}, /* 6 */
|
||||
{0xfe, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x60, 0x00}, /* 7 */
|
||||
{0x7c, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0x7c, 0x00}, /* 8 */
|
||||
{0x7c, 0xc6, 0xc6, 0x7e, 0x06, 0xc6, 0x7c, 0x00}, /* 9 */
|
||||
{0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00}, /* : */
|
||||
{0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x20, 0x00}, /* }, */
|
||||
{0x00, 0x1c, 0x30, 0x60, 0x30, 0x1c, 0x00, 0x00}, /* < */
|
||||
{0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00}, /* = */
|
||||
{0x00, 0x70, 0x18, 0x0c, 0x18, 0x70, 0x00, 0x00}, /* > */
|
||||
{0x7c, 0xc6, 0x0c, 0x18, 0x30, 0x00, 0x30, 0x00}, /* ? */
|
||||
{0x7c, 0x82, 0x9a, 0xaa, 0xaa, 0x9e, 0x7c, 0x00}, /* @ */
|
||||
{0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x00}, /* A */
|
||||
{0xfc, 0xc6, 0xc6, 0xfc, 0xc6, 0xc6, 0xfc, 0x00}, /* B */
|
||||
{0x7c, 0xc6, 0xc6, 0xc0, 0xc0, 0xc6, 0x7c, 0x00}, /* C */
|
||||
{0xf8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0xf8, 0x00}, /* D */
|
||||
{0xfe, 0xc0, 0xc0, 0xfc, 0xc0, 0xc0, 0xfe, 0x00}, /* E */
|
||||
{0xfe, 0xc0, 0xc0, 0xfc, 0xc0, 0xc0, 0xc0, 0x00}, /* F */
|
||||
{0x7c, 0xc6, 0xc0, 0xce, 0xc6, 0xc6, 0x7e, 0x00}, /* G */
|
||||
{0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00}, /* H */
|
||||
{0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00}, /* I */
|
||||
{0x1e, 0x06, 0x06, 0x06, 0xc6, 0xc6, 0x7c, 0x00}, /* J */
|
||||
{0xc6, 0xcc, 0xd8, 0xf0, 0xd8, 0xcc, 0xc6, 0x00}, /* K */
|
||||
{0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x00}, /* L */
|
||||
{0xc6, 0xee, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0x00}, /* M */
|
||||
{0xc6, 0xe6, 0xf6, 0xde, 0xce, 0xc6, 0xc6, 0x00}, /* N */
|
||||
{0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00}, /* O */
|
||||
{0xfc, 0xc6, 0xc6, 0xfc, 0xc0, 0xc0, 0xc0, 0x00}, /* P */
|
||||
{0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x06}, /* Q */
|
||||
{0xfc, 0xc6, 0xc6, 0xfc, 0xc6, 0xc6, 0xc6, 0x00}, /* R */
|
||||
{0x78, 0xcc, 0x60, 0x30, 0x18, 0xcc, 0x78, 0x00}, /* S */
|
||||
{0xfc, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00}, /* T */
|
||||
{0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00}, /* U */
|
||||
{0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00}, /* V */
|
||||
{0xc6, 0xc6, 0xc6, 0xd6, 0xfe, 0xee, 0xc6, 0x00}, /* W */
|
||||
{0xc6, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0xc6, 0x00}, /* X */
|
||||
{0xc3, 0xc3, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x00}, /* Y */
|
||||
{0xfe, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xfe, 0x00}, /* Z */
|
||||
{0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00}, /* [ */
|
||||
{0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x03, 0x00}, /* \ */
|
||||
{0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00}, /* ] */
|
||||
{0x00, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00}, /* ^ */
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff}, /* _ */
|
||||
{0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, /* ` */
|
||||
{0x00, 0x00, 0x7c, 0x06, 0x7e, 0xc6, 0x7e, 0x00}, /* a */
|
||||
{0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xe6, 0xdc, 0x00}, /* b */
|
||||
{0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0x7e, 0x00}, /* c */
|
||||
{0x06, 0x06, 0x7e, 0xc6, 0xc6, 0xce, 0x76, 0x00}, /* d */
|
||||
{0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0x7e, 0x00}, /* e */
|
||||
{0x1e, 0x30, 0x7c, 0x30, 0x30, 0x30, 0x30, 0x00}, /* f */
|
||||
{0x00, 0x00, 0x7e, 0xc6, 0xce, 0x76, 0x06, 0x7c}, /* g */
|
||||
{0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x00}, /* */
|
||||
{0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x00}, /* i */
|
||||
{0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0xf0}, /* j */
|
||||
{0xc0, 0xc0, 0xcc, 0xd8, 0xf0, 0xd8, 0xcc, 0x00}, /* k */
|
||||
{0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00}, /* l */
|
||||
{0x00, 0x00, 0xcc, 0xfe, 0xd6, 0xc6, 0xc6, 0x00}, /* m */
|
||||
{0x00, 0x00, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x00}, /* n */
|
||||
{0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0x00}, /* o */
|
||||
{0x00, 0x00, 0xfc, 0xc6, 0xc6, 0xe6, 0xdc, 0xc0}, /* p */
|
||||
{0x00, 0x00, 0x7e, 0xc6, 0xc6, 0xce, 0x76, 0x06}, /* q */
|
||||
{0x00, 0x00, 0x6e, 0x70, 0x60, 0x60, 0x60, 0x00}, /* r */
|
||||
{0x00, 0x00, 0x7c, 0xc0, 0x7c, 0x06, 0xfc, 0x00}, /* s */
|
||||
{0x30, 0x30, 0x7c, 0x30, 0x30, 0x30, 0x1c, 0x00}, /* t */
|
||||
{0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x00}, /* u */
|
||||
{0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00}, /* v */
|
||||
{0x00, 0x00, 0xc6, 0xc6, 0xd6, 0xfe, 0x6c, 0x00}, /* w */
|
||||
{0x00, 0x00, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0x00}, /* x */
|
||||
{0x00, 0x00, 0xc6, 0xc6, 0xce, 0x76, 0x06, 0x7c}, /* y */
|
||||
{0x00, 0x00, 0xfc, 0x18, 0x30, 0x60, 0xfc, 0x00}, /* z */
|
||||
{0x0e, 0x18, 0x18, 0x70, 0x18, 0x18, 0x0e, 0x00}, /* { */
|
||||
{0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, /* | */
|
||||
{0xe0, 0x30, 0x30, 0x1c, 0x30, 0x30, 0xe0, 0x00}, /* } */
|
||||
{0x00, 0x00, 0x70, 0x9a, 0x0e, 0x00, 0x00, 0x00}, /* ~ */
|
||||
{0x00, 0x00, 0x18, 0x3c, 0x66, 0xff, 0x00, 0x00} /* Ascii 127 */
|
||||
};
|
||||
/*@=charint@*/
|
||||
|
||||
void
|
||||
GifDrawText8x8(SavedImage *Image,
|
||||
const int x, const int y,
|
||||
const char *legend,
|
||||
const int color)
|
||||
{
|
||||
int i, j;
|
||||
int base;
|
||||
const char *cp;
|
||||
|
||||
for (i = 0; i < GIF_FONT_HEIGHT; i++) {
|
||||
base = Image->ImageDesc.Width * (y + i) + x;
|
||||
|
||||
for (cp = legend; *cp; cp++)
|
||||
for (j = 0; j < GIF_FONT_WIDTH; j++) {
|
||||
if (GifAsciiTable8x8[(short)(*cp)][i] & (1 << (GIF_FONT_WIDTH - j)))
|
||||
Image->RasterBits[base] = color;
|
||||
base++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GifDrawBox(SavedImage *Image,
|
||||
const int x, const int y,
|
||||
const int w, const int d,
|
||||
const int color)
|
||||
{
|
||||
int j, base = Image->ImageDesc.Width * y + x;
|
||||
|
||||
for (j = 0; j < w; j++)
|
||||
Image->RasterBits[base + j] =
|
||||
Image->RasterBits[base + (d * Image->ImageDesc.Width) + j] = color;
|
||||
|
||||
for (j = 0; j < d; j++)
|
||||
Image->RasterBits[base + j * Image->ImageDesc.Width] =
|
||||
Image->RasterBits[base + j * Image->ImageDesc.Width + w] = color;
|
||||
}
|
||||
|
||||
void
|
||||
GifDrawRectangle(SavedImage *Image,
|
||||
const int x, const int y,
|
||||
const int w, const int d,
|
||||
const int color)
|
||||
{
|
||||
unsigned char *bp = Image->RasterBits + Image->ImageDesc.Width * y + x;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < d; i++)
|
||||
memset(bp + (i * Image->ImageDesc.Width), color, (size_t)w);
|
||||
}
|
||||
|
||||
void
|
||||
GifDrawBoxedText8x8(SavedImage *Image,
|
||||
const int x, const int y,
|
||||
const char *legend,
|
||||
const int border,
|
||||
const int bg, const int fg)
|
||||
{
|
||||
int i, j = 0, LineCount = 0, TextWidth = 0;
|
||||
const char *cp;
|
||||
|
||||
/* compute size of text to box */
|
||||
for (cp = legend; *cp; cp++)
|
||||
if (*cp == '\r') {
|
||||
if (j > TextWidth)
|
||||
TextWidth = j;
|
||||
j = 0;
|
||||
LineCount++;
|
||||
} else if (*cp != '\t')
|
||||
++j;
|
||||
LineCount++; /* count last line */
|
||||
if (j > TextWidth) /* last line might be longer than any previous */
|
||||
TextWidth = j;
|
||||
|
||||
/* fill the box */
|
||||
GifDrawRectangle(Image, x + 1, y + 1,
|
||||
border + TextWidth * GIF_FONT_WIDTH + border - 1,
|
||||
border + LineCount * GIF_FONT_HEIGHT + border - 1, bg);
|
||||
|
||||
/* draw the text */
|
||||
i = 0;
|
||||
cp = strtok((char *)legend, "\r\n");
|
||||
do {
|
||||
int leadspace = 0;
|
||||
|
||||
if (cp[0] == '\t')
|
||||
leadspace = (TextWidth - strlen(++cp)) / 2;
|
||||
|
||||
GifDrawText8x8(Image, x + border + (leadspace * GIF_FONT_WIDTH),
|
||||
y + border + (GIF_FONT_HEIGHT * i++), cp, fg);
|
||||
cp = strtok((char *)NULL, "\r\n");
|
||||
} while (cp);
|
||||
|
||||
/* outline the box */
|
||||
GifDrawBox(Image, x, y, border + TextWidth * GIF_FONT_WIDTH + border,
|
||||
border + LineCount * GIF_FONT_HEIGHT + border, fg);
|
||||
}
|
||||
|
||||
/* end */
|
|
@ -0,0 +1,131 @@
|
|||
/*****************************************************************************
|
||||
|
||||
gif_hash.c -- module to support the following operations:
|
||||
|
||||
1. InitHashTable - initialize hash table.
|
||||
2. ClearHashTable - clear the hash table to an empty state.
|
||||
2. InsertHashTable - insert one item into data structure.
|
||||
3. ExistsHashTable - test if item exists in data structure.
|
||||
|
||||
This module is used to hash the GIF codes during encoding.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gif_lib.h"
|
||||
#include "gif_hash.h"
|
||||
#include "gif_lib_private.h"
|
||||
|
||||
/* #define DEBUG_HIT_RATE Debug number of misses per hash Insert/Exists. */
|
||||
|
||||
#ifdef DEBUG_HIT_RATE
|
||||
static long NumberOfTests = 0,
|
||||
NumberOfMisses = 0;
|
||||
#endif /* DEBUG_HIT_RATE */
|
||||
|
||||
static int KeyItem(uint32_t Item);
|
||||
|
||||
/******************************************************************************
|
||||
Initialize HashTable - allocate the memory needed and clear it. *
|
||||
******************************************************************************/
|
||||
GifHashTableType *_InitHashTable(void)
|
||||
{
|
||||
GifHashTableType *HashTable;
|
||||
|
||||
if ((HashTable = (GifHashTableType *) malloc(sizeof(GifHashTableType)))
|
||||
== NULL)
|
||||
return NULL;
|
||||
|
||||
_ClearHashTable(HashTable);
|
||||
|
||||
return HashTable;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
Routine to clear the HashTable to an empty state. *
|
||||
This part is a little machine depended. Use the commented part otherwise. *
|
||||
******************************************************************************/
|
||||
void _ClearHashTable(GifHashTableType *HashTable)
|
||||
{
|
||||
memset(HashTable -> HTable, 0xFF, HT_SIZE * sizeof(uint32_t));
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
Routine to insert a new Item into the HashTable. The data is assumed to be *
|
||||
new one. *
|
||||
******************************************************************************/
|
||||
void _InsertHashTable(GifHashTableType *HashTable, uint32_t Key, int Code)
|
||||
{
|
||||
int HKey = KeyItem(Key);
|
||||
uint32_t *HTable = HashTable -> HTable;
|
||||
|
||||
#ifdef DEBUG_HIT_RATE
|
||||
NumberOfTests++;
|
||||
NumberOfMisses++;
|
||||
#endif /* DEBUG_HIT_RATE */
|
||||
|
||||
while (HT_GET_KEY(HTable[HKey]) != 0xFFFFFL) {
|
||||
#ifdef DEBUG_HIT_RATE
|
||||
NumberOfMisses++;
|
||||
#endif /* DEBUG_HIT_RATE */
|
||||
HKey = (HKey + 1) & HT_KEY_MASK;
|
||||
}
|
||||
HTable[HKey] = HT_PUT_KEY(Key) | HT_PUT_CODE(Code);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
Routine to test if given Key exists in HashTable and if so returns its code *
|
||||
Returns the Code if key was found, -1 if not. *
|
||||
******************************************************************************/
|
||||
int _ExistsHashTable(GifHashTableType *HashTable, uint32_t Key)
|
||||
{
|
||||
int HKey = KeyItem(Key);
|
||||
uint32_t *HTable = HashTable -> HTable, HTKey;
|
||||
|
||||
#ifdef DEBUG_HIT_RATE
|
||||
NumberOfTests++;
|
||||
NumberOfMisses++;
|
||||
#endif /* DEBUG_HIT_RATE */
|
||||
|
||||
while ((HTKey = HT_GET_KEY(HTable[HKey])) != 0xFFFFFL) {
|
||||
#ifdef DEBUG_HIT_RATE
|
||||
NumberOfMisses++;
|
||||
#endif /* DEBUG_HIT_RATE */
|
||||
if (Key == HTKey) return HT_GET_CODE(HTable[HKey]);
|
||||
HKey = (HKey + 1) & HT_KEY_MASK;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
Routine to generate an HKey for the hashtable out of the given unique key. *
|
||||
The given Key is assumed to be 20 bits as follows: lower 8 bits are the *
|
||||
new postfix character, while the upper 12 bits are the prefix code. *
|
||||
Because the average hit ratio is only 2 (2 hash references per entry), *
|
||||
evaluating more complex keys (such as twin prime keys) does not worth it! *
|
||||
******************************************************************************/
|
||||
static int KeyItem(uint32_t Item)
|
||||
{
|
||||
return ((Item >> 12) ^ Item) & HT_KEY_MASK;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_HIT_RATE
|
||||
/******************************************************************************
|
||||
Debugging routine to print the hit ratio - number of times the hash table *
|
||||
was tested per operation. This routine was used to test the KeyItem routine *
|
||||
******************************************************************************/
|
||||
void HashTablePrintHitRatio(void)
|
||||
{
|
||||
printf("Hash Table Hit Ratio is %ld/%ld = %ld%%.\n",
|
||||
NumberOfMisses, NumberOfTests,
|
||||
NumberOfMisses * 100 / NumberOfTests);
|
||||
}
|
||||
#endif /* DEBUG_HIT_RATE */
|
||||
|
||||
/* end */
|
|
@ -0,0 +1,41 @@
|
|||
/******************************************************************************
|
||||
|
||||
gif_hash.h - magfic constants and declarations for GIF LZW
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _GIF_HASH_H_
|
||||
#define _GIF_HASH_H_
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
|
||||
#define HT_SIZE 8192 /* 12bits = 4096 or twice as big! */
|
||||
#define HT_KEY_MASK 0x1FFF /* 13bits keys */
|
||||
#define HT_KEY_NUM_BITS 13 /* 13bits keys */
|
||||
#define HT_MAX_KEY 8191 /* 13bits - 1, maximal code possible */
|
||||
#define HT_MAX_CODE 4095 /* Biggest code possible in 12 bits. */
|
||||
|
||||
/* The 32 bits of the long are divided into two parts for the key & code: */
|
||||
/* 1. The code is 12 bits as our compression algorithm is limited to 12bits */
|
||||
/* 2. The key is 12 bits Prefix code + 8 bit new char or 20 bits. */
|
||||
/* The key is the upper 20 bits. The code is the lower 12. */
|
||||
#define HT_GET_KEY(l) (l >> 12)
|
||||
#define HT_GET_CODE(l) (l & 0x0FFF)
|
||||
#define HT_PUT_KEY(l) (l << 12)
|
||||
#define HT_PUT_CODE(l) (l & 0x0FFF)
|
||||
|
||||
typedef struct GifHashTableType {
|
||||
uint32_t HTable[HT_SIZE];
|
||||
} GifHashTableType;
|
||||
|
||||
GifHashTableType *_InitHashTable(void);
|
||||
void _ClearHashTable(GifHashTableType *HashTable);
|
||||
void _InsertHashTable(GifHashTableType *HashTable, uint32_t Key, int Code);
|
||||
int _ExistsHashTable(GifHashTableType *HashTable, uint32_t Key);
|
||||
|
||||
#endif /* _GIF_HASH_H_ */
|
||||
|
||||
/* end */
|
|
@ -0,0 +1,316 @@
|
|||
/******************************************************************************
|
||||
|
||||
gif_lib.h - service library for decoding and encoding GIF images
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _GIF_LIB_H_
|
||||
#define _GIF_LIB_H_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GIFLIB_MAJOR 5
|
||||
#define GIFLIB_MINOR 0
|
||||
#define GIFLIB_RELEASE 5
|
||||
|
||||
#define GIF_ERROR 0
|
||||
#define GIF_OK 1
|
||||
|
||||
#include <stddef.h>
|
||||
#ifdef _MSC_VER
|
||||
#define BOOL int
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#else
|
||||
#include <stdbool.h>
|
||||
#define BOOL _Bool
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#define GIF_STAMP "GIFVER" /* First chars in file - GIF stamp. */
|
||||
#define GIF_STAMP_LEN sizeof(GIF_STAMP) - 1
|
||||
#define GIF_VERSION_POS 3 /* Version first character in stamp. */
|
||||
#define GIF87_STAMP "GIF87a" /* First chars in file - GIF stamp. */
|
||||
#define GIF89_STAMP "GIF89a" /* First chars in file - GIF stamp. */
|
||||
|
||||
typedef unsigned char GifPixelType;
|
||||
typedef unsigned char *GifRowType;
|
||||
typedef unsigned char GifByteType;
|
||||
typedef unsigned int GifPrefixType;
|
||||
typedef int GifWord;
|
||||
|
||||
typedef struct GifColorType {
|
||||
GifByteType Red, Green, Blue;
|
||||
} GifColorType;
|
||||
|
||||
typedef struct ColorMapObject {
|
||||
int ColorCount;
|
||||
int BitsPerPixel;
|
||||
BOOL SortFlag;
|
||||
GifColorType *Colors; /* on malloc(3) heap */
|
||||
} ColorMapObject;
|
||||
|
||||
typedef struct GifImageDesc {
|
||||
GifWord Left, Top, Width, Height; /* Current image dimensions. */
|
||||
BOOL Interlace; /* Sequential/Interlaced lines. */
|
||||
ColorMapObject *ColorMap; /* The local color map */
|
||||
} GifImageDesc;
|
||||
|
||||
typedef struct ExtensionBlock {
|
||||
int ByteCount;
|
||||
GifByteType *Bytes; /* on malloc(3) heap */
|
||||
int Function; /* The block function code */
|
||||
#define CONTINUE_EXT_FUNC_CODE 0x00 /* continuation subblock */
|
||||
#define COMMENT_EXT_FUNC_CODE 0xfe /* comment */
|
||||
#define GRAPHICS_EXT_FUNC_CODE 0xf9 /* graphics control (GIF89) */
|
||||
#define PLAINTEXT_EXT_FUNC_CODE 0x01 /* plaintext */
|
||||
#define APPLICATION_EXT_FUNC_CODE 0xff /* application block */
|
||||
} ExtensionBlock;
|
||||
|
||||
typedef struct SavedImage {
|
||||
GifImageDesc ImageDesc;
|
||||
GifByteType *RasterBits; /* on malloc(3) heap */
|
||||
int ExtensionBlockCount; /* Count of extensions before image */
|
||||
ExtensionBlock *ExtensionBlocks; /* Extensions before image */
|
||||
} SavedImage;
|
||||
|
||||
typedef struct GifFileType {
|
||||
GifWord SWidth, SHeight; /* Size of virtual canvas */
|
||||
GifWord SColorResolution; /* How many colors can we generate? */
|
||||
GifWord SBackGroundColor; /* Background color for virtual canvas */
|
||||
GifByteType AspectByte; /* Used to compute pixel aspect ratio */
|
||||
ColorMapObject *SColorMap; /* Global colormap, NULL if nonexistent. */
|
||||
int ImageCount; /* Number of current image (both APIs) */
|
||||
GifImageDesc Image; /* Current image (low-level API) */
|
||||
SavedImage *SavedImages; /* Image sequence (high-level API) */
|
||||
int ExtensionBlockCount; /* Count extensions past last image */
|
||||
ExtensionBlock *ExtensionBlocks; /* Extensions past last image */
|
||||
int Error; /* Last error condition reported */
|
||||
void *UserData; /* hook to attach user data (TVT) */
|
||||
void *Private; /* Don't mess with this! */
|
||||
} GifFileType;
|
||||
|
||||
#define GIF_ASPECT_RATIO(n) ((n)+15.0/64.0)
|
||||
|
||||
typedef enum {
|
||||
UNDEFINED_RECORD_TYPE,
|
||||
SCREEN_DESC_RECORD_TYPE,
|
||||
IMAGE_DESC_RECORD_TYPE, /* Begin with ',' */
|
||||
EXTENSION_RECORD_TYPE, /* Begin with '!' */
|
||||
TERMINATE_RECORD_TYPE /* Begin with ';' */
|
||||
} GifRecordType;
|
||||
|
||||
/* func type to read gif data from arbitrary sources (TVT) */
|
||||
typedef int (*InputFunc) (GifFileType *, GifByteType *, int);
|
||||
|
||||
/* func type to write gif data to arbitrary targets.
|
||||
* Returns count of bytes written. (MRB)
|
||||
*/
|
||||
typedef int (*OutputFunc) (GifFileType *, const GifByteType *, int);
|
||||
|
||||
/******************************************************************************
|
||||
GIF89 structures
|
||||
******************************************************************************/
|
||||
|
||||
typedef struct GraphicsControlBlock {
|
||||
int DisposalMode;
|
||||
#define DISPOSAL_UNSPECIFIED 0 /* No disposal specified. */
|
||||
#define DISPOSE_DO_NOT 1 /* Leave image in place */
|
||||
#define DISPOSE_BACKGROUND 2 /* Set area too background color */
|
||||
#define DISPOSE_PREVIOUS 3 /* Restore to previous content */
|
||||
BOOL UserInputFlag; /* User confirmation required before disposal */
|
||||
int DelayTime; /* pre-display delay in 0.01sec units */
|
||||
int TransparentColor; /* Palette index for transparency, -1 if none */
|
||||
#define NO_TRANSPARENT_COLOR -1
|
||||
} GraphicsControlBlock;
|
||||
|
||||
/******************************************************************************
|
||||
GIF encoding routines
|
||||
******************************************************************************/
|
||||
|
||||
/* Main entry points */
|
||||
GifFileType *EGifOpenFileName(const char *GifFileName,
|
||||
const BOOL GifTestExistence, int *Error);
|
||||
GifFileType *EGifOpenFileHandle(const int GifFileHandle, int *Error);
|
||||
GifFileType *EGifOpen(void *userPtr, OutputFunc writeFunc, int *Error);
|
||||
int EGifSpew(GifFileType * GifFile);
|
||||
char *EGifGetGifVersion(GifFileType *GifFile); /* new in 5.x */
|
||||
int EGifCloseFile(GifFileType * GifFile);
|
||||
|
||||
#define E_GIF_ERR_OPEN_FAILED 1 /* And EGif possible errors. */
|
||||
#define E_GIF_ERR_WRITE_FAILED 2
|
||||
#define E_GIF_ERR_HAS_SCRN_DSCR 3
|
||||
#define E_GIF_ERR_HAS_IMAG_DSCR 4
|
||||
#define E_GIF_ERR_NO_COLOR_MAP 5
|
||||
#define E_GIF_ERR_DATA_TOO_BIG 6
|
||||
#define E_GIF_ERR_NOT_ENOUGH_MEM 7
|
||||
#define E_GIF_ERR_DISK_IS_FULL 8
|
||||
#define E_GIF_ERR_CLOSE_FAILED 9
|
||||
#define E_GIF_ERR_NOT_WRITEABLE 10
|
||||
|
||||
/* These are legacy. You probably do not want to call them directly */
|
||||
int EGifPutScreenDesc(GifFileType *GifFile,
|
||||
const int GifWidth, const int GifHeight,
|
||||
const int GifColorRes,
|
||||
const int GifBackGround,
|
||||
const ColorMapObject *GifColorMap);
|
||||
int EGifPutImageDesc(GifFileType *GifFile,
|
||||
const int GifLeft, const int GifTop,
|
||||
const int GifWidth, const int GifHeight,
|
||||
const BOOL GifInterlace,
|
||||
const ColorMapObject *GifColorMap);
|
||||
void EGifSetGifVersion(GifFileType *GifFile, const BOOL gif89);
|
||||
int EGifPutLine(GifFileType *GifFile, GifPixelType *GifLine,
|
||||
int GifLineLen);
|
||||
int EGifPutPixel(GifFileType *GifFile, const GifPixelType GifPixel);
|
||||
int EGifPutComment(GifFileType *GifFile, const char *GifComment);
|
||||
int EGifPutExtensionLeader(GifFileType *GifFile, const int GifExtCode);
|
||||
int EGifPutExtensionBlock(GifFileType *GifFile,
|
||||
const int GifExtLen, const void *GifExtension);
|
||||
int EGifPutExtensionTrailer(GifFileType *GifFile);
|
||||
int EGifPutExtension(GifFileType *GifFile, const int GifExtCode,
|
||||
const int GifExtLen,
|
||||
const void *GifExtension);
|
||||
int EGifPutCode(GifFileType *GifFile, int GifCodeSize,
|
||||
const GifByteType *GifCodeBlock);
|
||||
int EGifPutCodeNext(GifFileType *GifFile,
|
||||
const GifByteType *GifCodeBlock);
|
||||
|
||||
/******************************************************************************
|
||||
GIF decoding routines
|
||||
******************************************************************************/
|
||||
|
||||
/* Main entry points */
|
||||
GifFileType *DGifOpenFileName(const char *GifFileName, int *Error);
|
||||
GifFileType *DGifOpenFileHandle(int GifFileHandle, int *Error);
|
||||
int DGifSlurp(GifFileType * GifFile);
|
||||
GifFileType *DGifOpen(void *userPtr, InputFunc readFunc, int *Error); /* new one (TVT) */
|
||||
int DGifCloseFile(GifFileType * GifFile);
|
||||
|
||||
#define D_GIF_ERR_OPEN_FAILED 101 /* And DGif possible errors. */
|
||||
#define D_GIF_ERR_READ_FAILED 102
|
||||
#define D_GIF_ERR_NOT_GIF_FILE 103
|
||||
#define D_GIF_ERR_NO_SCRN_DSCR 104
|
||||
#define D_GIF_ERR_NO_IMAG_DSCR 105
|
||||
#define D_GIF_ERR_NO_COLOR_MAP 106
|
||||
#define D_GIF_ERR_WRONG_RECORD 107
|
||||
#define D_GIF_ERR_DATA_TOO_BIG 108
|
||||
#define D_GIF_ERR_NOT_ENOUGH_MEM 109
|
||||
#define D_GIF_ERR_CLOSE_FAILED 110
|
||||
#define D_GIF_ERR_NOT_READABLE 111
|
||||
#define D_GIF_ERR_IMAGE_DEFECT 112
|
||||
#define D_GIF_ERR_EOF_TOO_SOON 113
|
||||
|
||||
/* These are legacy. You probably do not want to call them directly */
|
||||
int DGifGetScreenDesc(GifFileType *GifFile);
|
||||
int DGifGetRecordType(GifFileType *GifFile, GifRecordType *GifType);
|
||||
int DGifGetImageDesc(GifFileType *GifFile);
|
||||
int DGifGetLine(GifFileType *GifFile, GifPixelType *GifLine, int GifLineLen);
|
||||
int DGifGetPixel(GifFileType *GifFile, GifPixelType GifPixel);
|
||||
int DGifGetComment(GifFileType *GifFile, char *GifComment);
|
||||
int DGifGetExtension(GifFileType *GifFile, int *GifExtCode,
|
||||
GifByteType **GifExtension);
|
||||
int DGifGetExtensionNext(GifFileType *GifFile, GifByteType **GifExtension);
|
||||
int DGifGetCode(GifFileType *GifFile, int *GifCodeSize,
|
||||
GifByteType **GifCodeBlock);
|
||||
int DGifGetCodeNext(GifFileType *GifFile, GifByteType **GifCodeBlock);
|
||||
int DGifGetLZCodes(GifFileType *GifFile, int *GifCode);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
Color table quantization (deprecated)
|
||||
******************************************************************************/
|
||||
int GifQuantizeBuffer(unsigned int Width, unsigned int Height,
|
||||
int *ColorMapSize, GifByteType * RedInput,
|
||||
GifByteType * GreenInput, GifByteType * BlueInput,
|
||||
GifByteType * OutputBuffer,
|
||||
GifColorType * OutputColorMap);
|
||||
|
||||
/******************************************************************************
|
||||
Error handling and reporting.
|
||||
******************************************************************************/
|
||||
extern char *GifErrorString(int ErrorCode); /* new in 2012 - ESR */
|
||||
|
||||
/*****************************************************************************
|
||||
Everything below this point is new after version 1.2, supporting `slurp
|
||||
mode' for doing I/O in two big belts with all the image-bashing in core.
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
Color map handling from gif_alloc.c
|
||||
******************************************************************************/
|
||||
|
||||
extern ColorMapObject *GifMakeMapObject(int ColorCount,
|
||||
const GifColorType *ColorMap);
|
||||
extern void GifFreeMapObject(ColorMapObject *Object);
|
||||
extern ColorMapObject *GifUnionColorMap(const ColorMapObject *ColorIn1,
|
||||
const ColorMapObject *ColorIn2,
|
||||
GifPixelType ColorTransIn2[]);
|
||||
extern int GifBitSize(int n);
|
||||
|
||||
/******************************************************************************
|
||||
Support for the in-core structures allocation (slurp mode).
|
||||
******************************************************************************/
|
||||
|
||||
extern void GifApplyTranslation(SavedImage *Image, GifPixelType Translation[]);
|
||||
extern int GifAddExtensionBlock(int *ExtensionBlock_Count,
|
||||
ExtensionBlock **ExtensionBlocks,
|
||||
int Function,
|
||||
unsigned int Len, unsigned char ExtData[]);
|
||||
extern void GifFreeExtensions(int *ExtensionBlock_Count,
|
||||
ExtensionBlock **ExtensionBlocks);
|
||||
extern SavedImage *GifMakeSavedImage(GifFileType *GifFile,
|
||||
const SavedImage *CopyFrom);
|
||||
extern void GifFreeSavedImages(GifFileType *GifFile);
|
||||
|
||||
/******************************************************************************
|
||||
5.x functions for GIF89 graphics control blocks
|
||||
******************************************************************************/
|
||||
|
||||
int DGifExtensionToGCB(const size_t GifExtensionLength,
|
||||
const GifByteType *GifExtension,
|
||||
GraphicsControlBlock *GCB);
|
||||
size_t EGifGCBToExtension(const GraphicsControlBlock *GCB,
|
||||
GifByteType *GifExtension);
|
||||
|
||||
int DGifSavedExtensionToGCB(GifFileType *GifFile,
|
||||
int ImageIndex,
|
||||
GraphicsControlBlock *GCB);
|
||||
int EGifGCBToSavedExtension(const GraphicsControlBlock *GCB,
|
||||
GifFileType *GifFile,
|
||||
int ImageIndex);
|
||||
|
||||
/******************************************************************************
|
||||
The library's internal utility font
|
||||
******************************************************************************/
|
||||
|
||||
#define GIF_FONT_WIDTH 8
|
||||
#define GIF_FONT_HEIGHT 8
|
||||
extern const unsigned char GifAsciiTable8x8[][GIF_FONT_WIDTH];
|
||||
|
||||
extern void GifDrawText8x8(SavedImage *Image,
|
||||
const int x, const int y,
|
||||
const char *legend, const int color);
|
||||
|
||||
extern void GifDrawBox(SavedImage *Image,
|
||||
const int x, const int y,
|
||||
const int w, const int d, const int color);
|
||||
|
||||
extern void GifDrawRectangle(SavedImage *Image,
|
||||
const int x, const int y,
|
||||
const int w, const int d, const int color);
|
||||
|
||||
extern void GifDrawBoxedText8x8(SavedImage *Image,
|
||||
const int x, const int y,
|
||||
const char *legend,
|
||||
const int border, const int bg, const int fg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* _GIF_LIB_H */
|
||||
|
||||
/* end */
|
|
@ -0,0 +1,59 @@
|
|||
/****************************************************************************
|
||||
|
||||
gif_lib_private.h - internal giflib routines and structures
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _GIF_LIB_PRIVATE_H
|
||||
#define _GIF_LIB_PRIVATE_H
|
||||
|
||||
#include "gif_lib.h"
|
||||
#include "gif_hash.h"
|
||||
|
||||
#define EXTENSION_INTRODUCER 0x21
|
||||
#define DESCRIPTOR_INTRODUCER 0x2c
|
||||
#define TERMINATOR_INTRODUCER 0x3b
|
||||
|
||||
#define LZ_MAX_CODE 4095 /* Biggest code possible in 12 bits. */
|
||||
#define LZ_BITS 12
|
||||
|
||||
#define FLUSH_OUTPUT 4096 /* Impossible code, to signal flush. */
|
||||
#define FIRST_CODE 4097 /* Impossible code, to signal first. */
|
||||
#define NO_SUCH_CODE 4098 /* Impossible code, to signal empty. */
|
||||
|
||||
#define FILE_STATE_WRITE 0x01
|
||||
#define FILE_STATE_SCREEN 0x02
|
||||
#define FILE_STATE_IMAGE 0x04
|
||||
#define FILE_STATE_READ 0x08
|
||||
|
||||
#define IS_READABLE(Private) (Private->FileState & FILE_STATE_READ)
|
||||
#define IS_WRITEABLE(Private) (Private->FileState & FILE_STATE_WRITE)
|
||||
|
||||
typedef struct GifFilePrivateType {
|
||||
GifWord FileState, FileHandle, /* Where all this data goes to! */
|
||||
BitsPerPixel, /* Bits per pixel (Codes uses at least this + 1). */
|
||||
ClearCode, /* The CLEAR LZ code. */
|
||||
EOFCode, /* The EOF LZ code. */
|
||||
RunningCode, /* The next code algorithm can generate. */
|
||||
RunningBits, /* The number of bits required to represent RunningCode. */
|
||||
MaxCode1, /* 1 bigger than max. possible code, in RunningBits bits. */
|
||||
LastCode, /* The code before the current code. */
|
||||
CrntCode, /* Current algorithm code. */
|
||||
StackPtr, /* For character stack (see below). */
|
||||
CrntShiftState; /* Number of bits in CrntShiftDWord. */
|
||||
unsigned long CrntShiftDWord; /* For bytes decomposition into codes. */
|
||||
unsigned long PixelCount; /* Number of pixels in image. */
|
||||
FILE *File; /* File as stream. */
|
||||
InputFunc Read; /* function to read gif input (TVT) */
|
||||
OutputFunc Write; /* function to write gif output (MRB) */
|
||||
GifByteType Buf[256]; /* Compressed input is buffered here. */
|
||||
GifByteType Stack[LZ_MAX_CODE]; /* Decoded pixels are stacked here. */
|
||||
GifByteType Suffix[LZ_MAX_CODE + 1]; /* So we can trace the codes. */
|
||||
GifPrefixType Prefix[LZ_MAX_CODE + 1];
|
||||
GifHashTableType *HashTable;
|
||||
BOOL gif89;
|
||||
} GifFilePrivateType;
|
||||
|
||||
#endif /* _GIF_LIB_PRIVATE_H */
|
||||
|
||||
/* end */
|
|
@ -0,0 +1,400 @@
|
|||
/*****************************************************************************
|
||||
|
||||
GIF construction tools
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gif_lib.h"
|
||||
|
||||
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
||||
|
||||
/******************************************************************************
|
||||
Miscellaneous utility functions
|
||||
******************************************************************************/
|
||||
|
||||
/* return smallest bitfield size n will fit in */
|
||||
int
|
||||
GifBitSize(int n)
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 1; i <= 8; i++)
|
||||
if ((1 << i) >= n)
|
||||
break;
|
||||
return (i);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
Color map object functions
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Allocate a color map of given size; initialize with contents of
|
||||
* ColorMap if that pointer is non-NULL.
|
||||
*/
|
||||
ColorMapObject *
|
||||
GifMakeMapObject(int ColorCount, const GifColorType *ColorMap)
|
||||
{
|
||||
ColorMapObject *Object;
|
||||
|
||||
/*** FIXME: Our ColorCount has to be a power of two. Is it necessary to
|
||||
* make the user know that or should we automatically round up instead? */
|
||||
if (ColorCount != (1 << GifBitSize(ColorCount))) {
|
||||
return ((ColorMapObject *) NULL);
|
||||
}
|
||||
|
||||
Object = (ColorMapObject *)malloc(sizeof(ColorMapObject));
|
||||
if (Object == (ColorMapObject *) NULL) {
|
||||
return ((ColorMapObject *) NULL);
|
||||
}
|
||||
|
||||
Object->Colors = (GifColorType *)calloc(ColorCount, sizeof(GifColorType));
|
||||
if (Object->Colors == (GifColorType *) NULL) {
|
||||
free(Object);
|
||||
return ((ColorMapObject *) NULL);
|
||||
}
|
||||
|
||||
Object->ColorCount = ColorCount;
|
||||
Object->BitsPerPixel = GifBitSize(ColorCount);
|
||||
|
||||
if (ColorMap != NULL) {
|
||||
memcpy((char *)Object->Colors,
|
||||
(char *)ColorMap, ColorCount * sizeof(GifColorType));
|
||||
}
|
||||
|
||||
return (Object);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
Free a color map object
|
||||
*******************************************************************************/
|
||||
void
|
||||
GifFreeMapObject(ColorMapObject *Object)
|
||||
{
|
||||
if (Object != NULL) {
|
||||
(void)free(Object->Colors);
|
||||
(void)free(Object);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
DumpColorMap(ColorMapObject *Object,
|
||||
FILE * fp)
|
||||
{
|
||||
if (Object != NULL) {
|
||||
int i, j, Len = Object->ColorCount;
|
||||
|
||||
for (i = 0; i < Len; i += 4) {
|
||||
for (j = 0; j < 4 && j < Len; j++) {
|
||||
(void)fprintf(fp, "%3d: %02x %02x %02x ", i + j,
|
||||
Object->Colors[i + j].Red,
|
||||
Object->Colors[i + j].Green,
|
||||
Object->Colors[i + j].Blue);
|
||||
}
|
||||
(void)fprintf(fp, "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*******************************************************************************
|
||||
Compute the union of two given color maps and return it. If result can't
|
||||
fit into 256 colors, NULL is returned, the allocated union otherwise.
|
||||
ColorIn1 is copied as is to ColorUnion, while colors from ColorIn2 are
|
||||
copied iff they didn't exist before. ColorTransIn2 maps the old
|
||||
ColorIn2 into the ColorUnion color map table./
|
||||
*******************************************************************************/
|
||||
ColorMapObject *
|
||||
GifUnionColorMap(const ColorMapObject *ColorIn1,
|
||||
const ColorMapObject *ColorIn2,
|
||||
GifPixelType ColorTransIn2[])
|
||||
{
|
||||
int i, j, CrntSlot, RoundUpTo, NewGifBitSize;
|
||||
ColorMapObject *ColorUnion;
|
||||
|
||||
/*
|
||||
* We don't worry about duplicates within either color map; if
|
||||
* the caller wants to resolve those, he can perform unions
|
||||
* with an empty color map.
|
||||
*/
|
||||
|
||||
/* Allocate table which will hold the result for sure. */
|
||||
ColorUnion = GifMakeMapObject(MAX(ColorIn1->ColorCount,
|
||||
ColorIn2->ColorCount) * 2, NULL);
|
||||
|
||||
if (ColorUnion == NULL)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Copy ColorIn1 to ColorUnion.
|
||||
*/
|
||||
for (i = 0; i < ColorIn1->ColorCount; i++)
|
||||
ColorUnion->Colors[i] = ColorIn1->Colors[i];
|
||||
CrntSlot = ColorIn1->ColorCount;
|
||||
|
||||
/*
|
||||
* Potentially obnoxious hack:
|
||||
*
|
||||
* Back CrntSlot down past all contiguous {0, 0, 0} slots at the end
|
||||
* of table 1. This is very useful if your display is limited to
|
||||
* 16 colors.
|
||||
*/
|
||||
while (ColorIn1->Colors[CrntSlot - 1].Red == 0
|
||||
&& ColorIn1->Colors[CrntSlot - 1].Green == 0
|
||||
&& ColorIn1->Colors[CrntSlot - 1].Blue == 0)
|
||||
CrntSlot--;
|
||||
|
||||
/* Copy ColorIn2 to ColorUnion (use old colors if they exist): */
|
||||
for (i = 0; i < ColorIn2->ColorCount && CrntSlot <= 256; i++) {
|
||||
/* Let's see if this color already exists: */
|
||||
for (j = 0; j < ColorIn1->ColorCount; j++)
|
||||
if (memcmp (&ColorIn1->Colors[j], &ColorIn2->Colors[i],
|
||||
sizeof(GifColorType)) == 0)
|
||||
break;
|
||||
|
||||
if (j < ColorIn1->ColorCount)
|
||||
ColorTransIn2[i] = j; /* color exists in Color1 */
|
||||
else {
|
||||
/* Color is new - copy it to a new slot: */
|
||||
ColorUnion->Colors[CrntSlot] = ColorIn2->Colors[i];
|
||||
ColorTransIn2[i] = CrntSlot++;
|
||||
}
|
||||
}
|
||||
|
||||
if (CrntSlot > 256) {
|
||||
GifFreeMapObject(ColorUnion);
|
||||
return ((ColorMapObject *) NULL);
|
||||
}
|
||||
|
||||
NewGifBitSize = GifBitSize(CrntSlot);
|
||||
RoundUpTo = (1 << NewGifBitSize);
|
||||
|
||||
if (RoundUpTo != ColorUnion->ColorCount) {
|
||||
register GifColorType *Map = ColorUnion->Colors;
|
||||
|
||||
/*
|
||||
* Zero out slots up to next power of 2.
|
||||
* We know these slots exist because of the way ColorUnion's
|
||||
* start dimension was computed.
|
||||
*/
|
||||
for (j = CrntSlot; j < RoundUpTo; j++)
|
||||
Map[j].Red = Map[j].Green = Map[j].Blue = 0;
|
||||
|
||||
/* perhaps we can shrink the map? */
|
||||
if (RoundUpTo < ColorUnion->ColorCount)
|
||||
ColorUnion->Colors = (GifColorType *)realloc(Map,
|
||||
sizeof(GifColorType) * RoundUpTo);
|
||||
}
|
||||
|
||||
ColorUnion->ColorCount = RoundUpTo;
|
||||
ColorUnion->BitsPerPixel = NewGifBitSize;
|
||||
|
||||
return (ColorUnion);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
Apply a given color translation to the raster bits of an image
|
||||
*******************************************************************************/
|
||||
void
|
||||
GifApplyTranslation(SavedImage *Image, GifPixelType Translation[])
|
||||
{
|
||||
register int i;
|
||||
register int RasterSize = Image->ImageDesc.Height * Image->ImageDesc.Width;
|
||||
|
||||
for (i = 0; i < RasterSize; i++)
|
||||
Image->RasterBits[i] = Translation[Image->RasterBits[i]];
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
Extension record functions
|
||||
******************************************************************************/
|
||||
int
|
||||
GifAddExtensionBlock(int *ExtensionBlockCount,
|
||||
ExtensionBlock **ExtensionBlocks,
|
||||
int Function,
|
||||
unsigned int Len,
|
||||
unsigned char ExtData[])
|
||||
{
|
||||
ExtensionBlock *ep;
|
||||
|
||||
if (*ExtensionBlocks == NULL)
|
||||
*ExtensionBlocks=(ExtensionBlock *)malloc(sizeof(ExtensionBlock));
|
||||
else
|
||||
*ExtensionBlocks = (ExtensionBlock *)realloc(*ExtensionBlocks,
|
||||
sizeof(ExtensionBlock) *
|
||||
(*ExtensionBlockCount + 1));
|
||||
|
||||
if (*ExtensionBlocks == NULL)
|
||||
return (GIF_ERROR);
|
||||
|
||||
ep = &(*ExtensionBlocks)[(*ExtensionBlockCount)++];
|
||||
|
||||
ep->Function = Function;
|
||||
ep->ByteCount=Len;
|
||||
ep->Bytes = (GifByteType *)malloc(ep->ByteCount);
|
||||
if (ep->Bytes == NULL)
|
||||
return (GIF_ERROR);
|
||||
|
||||
if (ExtData != NULL) {
|
||||
memcpy(ep->Bytes, ExtData, Len);
|
||||
}
|
||||
|
||||
return (GIF_OK);
|
||||
}
|
||||
|
||||
void
|
||||
GifFreeExtensions(int *ExtensionBlockCount,
|
||||
ExtensionBlock **ExtensionBlocks)
|
||||
{
|
||||
ExtensionBlock *ep;
|
||||
|
||||
if (*ExtensionBlocks == NULL)
|
||||
return;
|
||||
|
||||
for (ep = *ExtensionBlocks;
|
||||
ep < (*ExtensionBlocks + *ExtensionBlockCount);
|
||||
ep++)
|
||||
(void)free((char *)ep->Bytes);
|
||||
(void)free((char *)*ExtensionBlocks);
|
||||
*ExtensionBlocks = NULL;
|
||||
*ExtensionBlockCount = 0;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
Image block allocation functions
|
||||
******************************************************************************/
|
||||
|
||||
/* Private Function:
|
||||
* Frees the last image in the GifFile->SavedImages array
|
||||
*/
|
||||
void
|
||||
FreeLastSavedImage(GifFileType *GifFile)
|
||||
{
|
||||
SavedImage *sp;
|
||||
|
||||
if ((GifFile == NULL) || (GifFile->SavedImages == NULL))
|
||||
return;
|
||||
|
||||
/* Remove one SavedImage from the GifFile */
|
||||
GifFile->ImageCount--;
|
||||
sp = &GifFile->SavedImages[GifFile->ImageCount];
|
||||
|
||||
/* Deallocate its Colormap */
|
||||
if (sp->ImageDesc.ColorMap != NULL) {
|
||||
GifFreeMapObject(sp->ImageDesc.ColorMap);
|
||||
sp->ImageDesc.ColorMap = NULL;
|
||||
}
|
||||
|
||||
/* Deallocate the image data */
|
||||
if (sp->RasterBits != NULL)
|
||||
free((char *)sp->RasterBits);
|
||||
|
||||
/* Deallocate any extensions */
|
||||
GifFreeExtensions(&sp->ExtensionBlockCount, &sp->ExtensionBlocks);
|
||||
|
||||
/*** FIXME: We could realloc the GifFile->SavedImages structure but is
|
||||
* there a point to it? Saves some memory but we'd have to do it every
|
||||
* time. If this is used in GifFreeSavedImages then it would be inefficient
|
||||
* (The whole array is going to be deallocated.) If we just use it when
|
||||
* we want to free the last Image it's convenient to do it here.
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
* Append an image block to the SavedImages array
|
||||
*/
|
||||
SavedImage *
|
||||
GifMakeSavedImage(GifFileType *GifFile, const SavedImage *CopyFrom)
|
||||
{
|
||||
if (GifFile->SavedImages == NULL)
|
||||
GifFile->SavedImages = (SavedImage *)malloc(sizeof(SavedImage));
|
||||
else
|
||||
GifFile->SavedImages = (SavedImage *)realloc(GifFile->SavedImages,
|
||||
sizeof(SavedImage) * (GifFile->ImageCount + 1));
|
||||
|
||||
if (GifFile->SavedImages == NULL)
|
||||
return ((SavedImage *)NULL);
|
||||
else {
|
||||
SavedImage *sp = &GifFile->SavedImages[GifFile->ImageCount++];
|
||||
memset((char *)sp, '\0', sizeof(SavedImage));
|
||||
|
||||
if (CopyFrom != NULL) {
|
||||
memcpy((char *)sp, CopyFrom, sizeof(SavedImage));
|
||||
|
||||
/*
|
||||
* Make our own allocated copies of the heap fields in the
|
||||
* copied record. This guards against potential aliasing
|
||||
* problems.
|
||||
*/
|
||||
|
||||
/* first, the local color map */
|
||||
if (sp->ImageDesc.ColorMap != NULL) {
|
||||
sp->ImageDesc.ColorMap = GifMakeMapObject(
|
||||
CopyFrom->ImageDesc.ColorMap->ColorCount,
|
||||
CopyFrom->ImageDesc.ColorMap->Colors);
|
||||
if (sp->ImageDesc.ColorMap == NULL) {
|
||||
FreeLastSavedImage(GifFile);
|
||||
return (SavedImage *)(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* next, the raster */
|
||||
sp->RasterBits = (unsigned char *)malloc(sizeof(GifPixelType) *
|
||||
CopyFrom->ImageDesc.Height *
|
||||
CopyFrom->ImageDesc.Width);
|
||||
if (sp->RasterBits == NULL) {
|
||||
FreeLastSavedImage(GifFile);
|
||||
return (SavedImage *)(NULL);
|
||||
}
|
||||
memcpy(sp->RasterBits, CopyFrom->RasterBits,
|
||||
sizeof(GifPixelType) * CopyFrom->ImageDesc.Height *
|
||||
CopyFrom->ImageDesc.Width);
|
||||
|
||||
/* finally, the extension blocks */
|
||||
if (sp->ExtensionBlocks != NULL) {
|
||||
sp->ExtensionBlocks = (ExtensionBlock *)malloc(
|
||||
sizeof(ExtensionBlock) *
|
||||
CopyFrom->ExtensionBlockCount);
|
||||
if (sp->ExtensionBlocks == NULL) {
|
||||
FreeLastSavedImage(GifFile);
|
||||
return (SavedImage *)(NULL);
|
||||
}
|
||||
memcpy(sp->ExtensionBlocks, CopyFrom->ExtensionBlocks,
|
||||
sizeof(ExtensionBlock) * CopyFrom->ExtensionBlockCount);
|
||||
}
|
||||
}
|
||||
|
||||
return (sp);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GifFreeSavedImages(GifFileType *GifFile)
|
||||
{
|
||||
SavedImage *sp;
|
||||
|
||||
if ((GifFile == NULL) || (GifFile->SavedImages == NULL)) {
|
||||
return;
|
||||
}
|
||||
for (sp = GifFile->SavedImages;
|
||||
sp < GifFile->SavedImages + GifFile->ImageCount; sp++) {
|
||||
if (sp->ImageDesc.ColorMap != NULL) {
|
||||
GifFreeMapObject(sp->ImageDesc.ColorMap);
|
||||
sp->ImageDesc.ColorMap = NULL;
|
||||
}
|
||||
|
||||
if (sp->RasterBits != NULL)
|
||||
free((char *)sp->RasterBits);
|
||||
|
||||
GifFreeExtensions(&sp->ExtensionBlockCount, &sp->ExtensionBlocks);
|
||||
}
|
||||
free((char *)GifFile->SavedImages);
|
||||
GifFile->SavedImages = NULL;
|
||||
}
|
||||
|
||||
/* end */
|
|
@ -0,0 +1,309 @@
|
|||
/*****************************************************************************
|
||||
|
||||
quantize.c - quantize a high resolution image into lower one
|
||||
|
||||
Based on: "Color Image Quantization for frame buffer Display", by
|
||||
Paul Heckbert SIGGRAPH 1982 page 297-307.
|
||||
|
||||
This doesn't really belong in the core library, was undocumented,
|
||||
and was removed in 4.2. Then it turned out some client apps were
|
||||
actually using it, so it was restored in 5.0.
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "gif_lib.h"
|
||||
#include "gif_lib_private.h"
|
||||
|
||||
#define ABS(x) ((x) > 0 ? (x) : (-(x)))
|
||||
|
||||
#define COLOR_ARRAY_SIZE 32768
|
||||
#define BITS_PER_PRIM_COLOR 5
|
||||
#define MAX_PRIM_COLOR 0x1f
|
||||
|
||||
static int SortRGBAxis;
|
||||
|
||||
typedef struct QuantizedColorType {
|
||||
GifByteType RGB[3];
|
||||
GifByteType NewColorIndex;
|
||||
long Count;
|
||||
struct QuantizedColorType *Pnext;
|
||||
} QuantizedColorType;
|
||||
|
||||
typedef struct NewColorMapType {
|
||||
GifByteType RGBMin[3], RGBWidth[3];
|
||||
unsigned int NumEntries; /* # of QuantizedColorType in linked list below */
|
||||
unsigned long Count; /* Total number of pixels in all the entries */
|
||||
QuantizedColorType *QuantizedColors;
|
||||
} NewColorMapType;
|
||||
|
||||
static int SubdivColorMap(NewColorMapType * NewColorSubdiv,
|
||||
unsigned int ColorMapSize,
|
||||
unsigned int *NewColorMapSize);
|
||||
static int SortCmpRtn(const void *Entry1, const void *Entry2);
|
||||
|
||||
/******************************************************************************
|
||||
Quantize high resolution image into lower one. Input image consists of a
|
||||
2D array for each of the RGB colors with size Width by Height. There is no
|
||||
Color map for the input. Output is a quantized image with 2D array of
|
||||
indexes into the output color map.
|
||||
Note input image can be 24 bits at the most (8 for red/green/blue) and
|
||||
the output has 256 colors at the most (256 entries in the color map.).
|
||||
ColorMapSize specifies size of color map up to 256 and will be updated to
|
||||
real size before returning.
|
||||
Also non of the parameter are allocated by this routine.
|
||||
This function returns GIF_OK if successful, GIF_ERROR otherwise.
|
||||
******************************************************************************/
|
||||
int
|
||||
GifQuantizeBuffer(unsigned int Width,
|
||||
unsigned int Height,
|
||||
int *ColorMapSize,
|
||||
GifByteType * RedInput,
|
||||
GifByteType * GreenInput,
|
||||
GifByteType * BlueInput,
|
||||
GifByteType * OutputBuffer,
|
||||
GifColorType * OutputColorMap) {
|
||||
|
||||
unsigned int Index, NumOfEntries;
|
||||
int i, j, MaxRGBError[3];
|
||||
unsigned int NewColorMapSize;
|
||||
long Red, Green, Blue;
|
||||
NewColorMapType NewColorSubdiv[256];
|
||||
QuantizedColorType *ColorArrayEntries, *QuantizedColor;
|
||||
|
||||
ColorArrayEntries = (QuantizedColorType *)malloc(
|
||||
sizeof(QuantizedColorType) * COLOR_ARRAY_SIZE);
|
||||
if (ColorArrayEntries == NULL) {
|
||||
return GIF_ERROR;
|
||||
}
|
||||
|
||||
for (i = 0; i < COLOR_ARRAY_SIZE; i++) {
|
||||
ColorArrayEntries[i].RGB[0] = i >> (2 * BITS_PER_PRIM_COLOR);
|
||||
ColorArrayEntries[i].RGB[1] = (i >> BITS_PER_PRIM_COLOR) &
|
||||
MAX_PRIM_COLOR;
|
||||
ColorArrayEntries[i].RGB[2] = i & MAX_PRIM_COLOR;
|
||||
ColorArrayEntries[i].Count = 0;
|
||||
}
|
||||
|
||||
/* Sample the colors and their distribution: */
|
||||
for (i = 0; i < (int)(Width * Height); i++) {
|
||||
Index = ((RedInput[i] >> (8 - BITS_PER_PRIM_COLOR)) <<
|
||||
(2 * BITS_PER_PRIM_COLOR)) +
|
||||
((GreenInput[i] >> (8 - BITS_PER_PRIM_COLOR)) <<
|
||||
BITS_PER_PRIM_COLOR) +
|
||||
(BlueInput[i] >> (8 - BITS_PER_PRIM_COLOR));
|
||||
ColorArrayEntries[Index].Count++;
|
||||
}
|
||||
|
||||
/* Put all the colors in the first entry of the color map, and call the
|
||||
* recursive subdivision process. */
|
||||
for (i = 0; i < 256; i++) {
|
||||
NewColorSubdiv[i].QuantizedColors = NULL;
|
||||
NewColorSubdiv[i].Count = NewColorSubdiv[i].NumEntries = 0;
|
||||
for (j = 0; j < 3; j++) {
|
||||
NewColorSubdiv[i].RGBMin[j] = 0;
|
||||
NewColorSubdiv[i].RGBWidth[j] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
/* Find the non empty entries in the color table and chain them: */
|
||||
for (i = 0; i < COLOR_ARRAY_SIZE; i++)
|
||||
if (ColorArrayEntries[i].Count > 0)
|
||||
break;
|
||||
QuantizedColor = NewColorSubdiv[0].QuantizedColors = &ColorArrayEntries[i];
|
||||
NumOfEntries = 1;
|
||||
while (++i < COLOR_ARRAY_SIZE)
|
||||
if (ColorArrayEntries[i].Count > 0) {
|
||||
QuantizedColor->Pnext = &ColorArrayEntries[i];
|
||||
QuantizedColor = &ColorArrayEntries[i];
|
||||
NumOfEntries++;
|
||||
}
|
||||
QuantizedColor->Pnext = NULL;
|
||||
|
||||
NewColorSubdiv[0].NumEntries = NumOfEntries; /* Different sampled colors */
|
||||
NewColorSubdiv[0].Count = ((long)Width) * Height; /* Pixels */
|
||||
NewColorMapSize = 1;
|
||||
if (SubdivColorMap(NewColorSubdiv, *ColorMapSize, &NewColorMapSize) !=
|
||||
GIF_OK) {
|
||||
free((char *)ColorArrayEntries);
|
||||
return GIF_ERROR;
|
||||
}
|
||||
if (NewColorMapSize < *ColorMapSize) {
|
||||
/* And clear rest of color map: */
|
||||
for (i = NewColorMapSize; i < *ColorMapSize; i++)
|
||||
OutputColorMap[i].Red = OutputColorMap[i].Green =
|
||||
OutputColorMap[i].Blue = 0;
|
||||
}
|
||||
|
||||
/* Average the colors in each entry to be the color to be used in the
|
||||
* output color map, and plug it into the output color map itself. */
|
||||
for (i = 0; i < NewColorMapSize; i++) {
|
||||
if ((j = NewColorSubdiv[i].NumEntries) > 0) {
|
||||
QuantizedColor = NewColorSubdiv[i].QuantizedColors;
|
||||
Red = Green = Blue = 0;
|
||||
while (QuantizedColor) {
|
||||
QuantizedColor->NewColorIndex = i;
|
||||
Red += QuantizedColor->RGB[0];
|
||||
Green += QuantizedColor->RGB[1];
|
||||
Blue += QuantizedColor->RGB[2];
|
||||
QuantizedColor = QuantizedColor->Pnext;
|
||||
}
|
||||
OutputColorMap[i].Red = (Red << (8 - BITS_PER_PRIM_COLOR)) / j;
|
||||
OutputColorMap[i].Green = (Green << (8 - BITS_PER_PRIM_COLOR)) / j;
|
||||
OutputColorMap[i].Blue = (Blue << (8 - BITS_PER_PRIM_COLOR)) / j;
|
||||
}
|
||||
}
|
||||
|
||||
/* Finally scan the input buffer again and put the mapped index in the
|
||||
* output buffer. */
|
||||
MaxRGBError[0] = MaxRGBError[1] = MaxRGBError[2] = 0;
|
||||
for (i = 0; i < (int)(Width * Height); i++) {
|
||||
Index = ((RedInput[i] >> (8 - BITS_PER_PRIM_COLOR)) <<
|
||||
(2 * BITS_PER_PRIM_COLOR)) +
|
||||
((GreenInput[i] >> (8 - BITS_PER_PRIM_COLOR)) <<
|
||||
BITS_PER_PRIM_COLOR) +
|
||||
(BlueInput[i] >> (8 - BITS_PER_PRIM_COLOR));
|
||||
Index = ColorArrayEntries[Index].NewColorIndex;
|
||||
OutputBuffer[i] = Index;
|
||||
if (MaxRGBError[0] < ABS(OutputColorMap[Index].Red - RedInput[i]))
|
||||
MaxRGBError[0] = ABS(OutputColorMap[Index].Red - RedInput[i]);
|
||||
if (MaxRGBError[1] < ABS(OutputColorMap[Index].Green - GreenInput[i]))
|
||||
MaxRGBError[1] = ABS(OutputColorMap[Index].Green - GreenInput[i]);
|
||||
if (MaxRGBError[2] < ABS(OutputColorMap[Index].Blue - BlueInput[i]))
|
||||
MaxRGBError[2] = ABS(OutputColorMap[Index].Blue - BlueInput[i]);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,
|
||||
"Quantization L(0) errors: Red = %d, Green = %d, Blue = %d.\n",
|
||||
MaxRGBError[0], MaxRGBError[1], MaxRGBError[2]);
|
||||
#endif /* DEBUG */
|
||||
|
||||
free((char *)ColorArrayEntries);
|
||||
|
||||
*ColorMapSize = NewColorMapSize;
|
||||
|
||||
return GIF_OK;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
Routine to subdivide the RGB space recursively using median cut in each
|
||||
axes alternatingly until ColorMapSize different cubes exists.
|
||||
The biggest cube in one dimension is subdivide unless it has only one entry.
|
||||
Returns GIF_ERROR if failed, otherwise GIF_OK.
|
||||
*******************************************************************************/
|
||||
static int
|
||||
SubdivColorMap(NewColorMapType * NewColorSubdiv,
|
||||
unsigned int ColorMapSize,
|
||||
unsigned int *NewColorMapSize) {
|
||||
|
||||
int MaxSize;
|
||||
unsigned int i, j, Index = 0, NumEntries, MinColor, MaxColor;
|
||||
long Sum, Count;
|
||||
QuantizedColorType *QuantizedColor, **SortArray;
|
||||
|
||||
while (ColorMapSize > *NewColorMapSize) {
|
||||
/* Find candidate for subdivision: */
|
||||
MaxSize = -1;
|
||||
for (i = 0; i < *NewColorMapSize; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
if ((((int)NewColorSubdiv[i].RGBWidth[j]) > MaxSize) &&
|
||||
(NewColorSubdiv[i].NumEntries > 1)) {
|
||||
MaxSize = NewColorSubdiv[i].RGBWidth[j];
|
||||
Index = i;
|
||||
SortRGBAxis = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (MaxSize == -1)
|
||||
return GIF_OK;
|
||||
|
||||
/* Split the entry Index into two along the axis SortRGBAxis: */
|
||||
|
||||
/* Sort all elements in that entry along the given axis and split at
|
||||
* the median. */
|
||||
SortArray = (QuantizedColorType **)malloc(
|
||||
sizeof(QuantizedColorType *) *
|
||||
NewColorSubdiv[Index].NumEntries);
|
||||
if (SortArray == NULL)
|
||||
return GIF_ERROR;
|
||||
for (j = 0, QuantizedColor = NewColorSubdiv[Index].QuantizedColors;
|
||||
j < NewColorSubdiv[Index].NumEntries && QuantizedColor != NULL;
|
||||
j++, QuantizedColor = QuantizedColor->Pnext)
|
||||
SortArray[j] = QuantizedColor;
|
||||
|
||||
qsort(SortArray, NewColorSubdiv[Index].NumEntries,
|
||||
sizeof(QuantizedColorType *), SortCmpRtn);
|
||||
|
||||
/* Relink the sorted list into one: */
|
||||
for (j = 0; j < NewColorSubdiv[Index].NumEntries - 1; j++)
|
||||
SortArray[j]->Pnext = SortArray[j + 1];
|
||||
SortArray[NewColorSubdiv[Index].NumEntries - 1]->Pnext = NULL;
|
||||
NewColorSubdiv[Index].QuantizedColors = QuantizedColor = SortArray[0];
|
||||
free((char *)SortArray);
|
||||
|
||||
/* Now simply add the Counts until we have half of the Count: */
|
||||
Sum = NewColorSubdiv[Index].Count / 2 - QuantizedColor->Count;
|
||||
NumEntries = 1;
|
||||
Count = QuantizedColor->Count;
|
||||
while (QuantizedColor->Pnext != NULL &&
|
||||
(Sum -= QuantizedColor->Pnext->Count) >= 0 &&
|
||||
QuantizedColor->Pnext->Pnext != NULL) {
|
||||
QuantizedColor = QuantizedColor->Pnext;
|
||||
NumEntries++;
|
||||
Count += QuantizedColor->Count;
|
||||
}
|
||||
/* Save the values of the last color of the first half, and first
|
||||
* of the second half so we can update the Bounding Boxes later.
|
||||
* Also as the colors are quantized and the BBoxes are full 0..255,
|
||||
* they need to be rescaled.
|
||||
*/
|
||||
MaxColor = QuantizedColor->RGB[SortRGBAxis]; /* Max. of first half */
|
||||
/* coverity[var_deref_op] */
|
||||
MinColor = QuantizedColor->Pnext->RGB[SortRGBAxis]; /* of second */
|
||||
MaxColor <<= (8 - BITS_PER_PRIM_COLOR);
|
||||
MinColor <<= (8 - BITS_PER_PRIM_COLOR);
|
||||
|
||||
/* Partition right here: */
|
||||
NewColorSubdiv[*NewColorMapSize].QuantizedColors =
|
||||
QuantizedColor->Pnext;
|
||||
QuantizedColor->Pnext = NULL;
|
||||
NewColorSubdiv[*NewColorMapSize].Count = Count;
|
||||
NewColorSubdiv[Index].Count -= Count;
|
||||
NewColorSubdiv[*NewColorMapSize].NumEntries =
|
||||
NewColorSubdiv[Index].NumEntries - NumEntries;
|
||||
NewColorSubdiv[Index].NumEntries = NumEntries;
|
||||
for (j = 0; j < 3; j++) {
|
||||
NewColorSubdiv[*NewColorMapSize].RGBMin[j] =
|
||||
NewColorSubdiv[Index].RGBMin[j];
|
||||
NewColorSubdiv[*NewColorMapSize].RGBWidth[j] =
|
||||
NewColorSubdiv[Index].RGBWidth[j];
|
||||
}
|
||||
NewColorSubdiv[*NewColorMapSize].RGBWidth[SortRGBAxis] =
|
||||
NewColorSubdiv[*NewColorMapSize].RGBMin[SortRGBAxis] +
|
||||
NewColorSubdiv[*NewColorMapSize].RGBWidth[SortRGBAxis] - MinColor;
|
||||
NewColorSubdiv[*NewColorMapSize].RGBMin[SortRGBAxis] = MinColor;
|
||||
|
||||
NewColorSubdiv[Index].RGBWidth[SortRGBAxis] =
|
||||
MaxColor - NewColorSubdiv[Index].RGBMin[SortRGBAxis];
|
||||
|
||||
(*NewColorMapSize)++;
|
||||
}
|
||||
|
||||
return GIF_OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Routine called by qsort to compare two entries.
|
||||
*****************************************************************************/
|
||||
static int
|
||||
SortCmpRtn(const void *Entry1,
|
||||
const void *Entry2) {
|
||||
|
||||
return (*((QuantizedColorType **) Entry1))->RGB[SortRGBAxis] -
|
||||
(*((QuantizedColorType **) Entry2))->RGB[SortRGBAxis];
|
||||
}
|
||||
|
||||
/* end */
|
|
@ -0,0 +1,612 @@
|
|||
#############################################################################
|
||||
# Makefile for building: libQt5GifImage.so.0.1.0
|
||||
# Generated by qmake (3.1) (Qt 5.15.3)
|
||||
# Project: gifimage.pro
|
||||
# Template: lib
|
||||
# Command: /usr/lib/qt5/bin/qmake -o Makefile gifimage.pro
|
||||
#############################################################################
|
||||
|
||||
MAKEFILE = Makefile
|
||||
|
||||
EQ = =
|
||||
|
||||
####### Compiler, tools and options
|
||||
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
DEFINES = -DQT_NO_LINKED_LIST -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_GIFIMAGE_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_DEPRECATED_WARNINGS_SINCE=0x060000 -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB
|
||||
CFLAGS = -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -O2 -std=gnu11 -fvisibility=hidden -fno-exceptions -Wall -Wextra -D_REENTRANT -fPIC $(DEFINES)
|
||||
CXXFLAGS = -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -O2 -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -D_REENTRANT -fPIC $(DEFINES)
|
||||
INCPATH = -I. -I../../include -I../../include/QtGifImage -I../../include/QtGifImage/0.1.0 -I../../include/QtGifImage/0.1.0/QtGifImage -I. -I../3rdParty/giflib -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I.moc -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++
|
||||
QMAKE = /usr/lib/qt5/bin/qmake
|
||||
DEL_FILE = rm -f
|
||||
CHK_DIR_EXISTS= test -d
|
||||
MKDIR = mkdir -p
|
||||
COPY = cp -f
|
||||
COPY_FILE = cp -f
|
||||
COPY_DIR = cp -f -R
|
||||
INSTALL_FILE = install -m 644 -p
|
||||
INSTALL_PROGRAM = install -m 755 -p
|
||||
INSTALL_DIR = cp -f -R
|
||||
QINSTALL = /usr/lib/qt5/bin/qmake -install qinstall
|
||||
QINSTALL_PROGRAM = /usr/lib/qt5/bin/qmake -install qinstall -exe
|
||||
DEL_FILE = rm -f
|
||||
SYMLINK = ln -f -s
|
||||
DEL_DIR = rmdir
|
||||
MOVE = mv -f
|
||||
TAR = tar -cf
|
||||
COMPRESS = gzip -9f
|
||||
DISTNAME = Qt5GifImage0.1.0
|
||||
DISTDIR = /home/wingsummer/Documents/SourceCode/QtGifImage/src/gifimage/.obj/Qt5GifImage0.1.0
|
||||
LINK = g++
|
||||
LFLAGS = -Wl,-z,relro -Wl,--no-undefined -Wl,--version-script,QtGifImage.version -Wl,-O1 -Wl,--enable-new-dtags -shared -Wl,-Bsymbolic-functions -Wl,-soname,libQt5GifImage.so.0
|
||||
LIBS = $(SUBLIBS) /usr/lib/x86_64-linux-gnu/libQt5Gui.so /usr/lib/x86_64-linux-gnu/libQt5Core.so -lpthread -lGL
|
||||
AR = ar cqs
|
||||
RANLIB =
|
||||
SED = sed
|
||||
STRIP = strip
|
||||
|
||||
####### Output directory
|
||||
|
||||
OBJECTS_DIR = .obj/
|
||||
|
||||
####### Files
|
||||
|
||||
SOURCES = ../3rdParty/giflib/dgif_lib.c \
|
||||
../3rdParty/giflib/egif_lib.c \
|
||||
../3rdParty/giflib/gif_err.c \
|
||||
../3rdParty/giflib/gif_hash.c \
|
||||
../3rdParty/giflib/gifalloc.c \
|
||||
../3rdParty/giflib/quantize.c \
|
||||
qgifimage.cpp
|
||||
OBJECTS = .obj/dgif_lib.o \
|
||||
.obj/egif_lib.o \
|
||||
.obj/gif_err.o \
|
||||
.obj/gif_hash.o \
|
||||
.obj/gifalloc.o \
|
||||
.obj/quantize.o \
|
||||
.obj/qgifimage.o
|
||||
DIST = ../../.qmake.conf \
|
||||
../../.qmake.stash \
|
||||
../../include/QtGifImage/headers.pri \
|
||||
../../mkspecs/modules-inst/qt_lib_gifimage.pri \
|
||||
../../mkspecs/modules-inst/qt_lib_gifimage_private.pri \
|
||||
../../mkspecs/modules/qt_lib_gifimage.pri \
|
||||
../3rdParty/giflib.pri \
|
||||
qtgifimage.pri \
|
||||
gifimage.pro qgifglobal.h \
|
||||
qgifimage.h \
|
||||
qgifimage_p.h ../3rdParty/giflib/dgif_lib.c \
|
||||
../3rdParty/giflib/egif_lib.c \
|
||||
../3rdParty/giflib/gif_err.c \
|
||||
../3rdParty/giflib/gif_hash.c \
|
||||
../3rdParty/giflib/gifalloc.c \
|
||||
../3rdParty/giflib/quantize.c \
|
||||
qgifimage.cpp
|
||||
QMAKE_TARGET = Qt5GifImage
|
||||
DESTDIR = ../../lib/
|
||||
TARGET = libQt5GifImage.so.0.1.0
|
||||
TARGETA = ../../lib/libQt5GifImage.a
|
||||
TARGET0 = libQt5GifImage.so
|
||||
TARGETD = libQt5GifImage.so.0.1.0
|
||||
TARGET1 = libQt5GifImage.so.0
|
||||
TARGET2 = libQt5GifImage.so.0.1
|
||||
|
||||
|
||||
first: all
|
||||
####### Build rules
|
||||
|
||||
../../lib/libQt5GifImage.so.0.1.0: QtGifImage.version $(OBJECTS) $(SUBLIBS) $(OBJCOMP)
|
||||
@test -d ../../lib/ || mkdir -p ../../lib/
|
||||
-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
|
||||
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP)
|
||||
-ln -s $(TARGET) $(TARGET0)
|
||||
-ln -s $(TARGET) $(TARGET1)
|
||||
-ln -s $(TARGET) $(TARGET2)
|
||||
-$(DEL_FILE) ../../lib/$(TARGET)
|
||||
-$(MOVE) $(TARGET) ../../lib/$(TARGET)
|
||||
-$(DEL_FILE) ../../lib/$(TARGET0)
|
||||
-$(DEL_FILE) ../../lib/$(TARGET1)
|
||||
-$(DEL_FILE) ../../lib/$(TARGET2)
|
||||
-$(MOVE) $(TARGET0) ../../lib/$(TARGET0)
|
||||
-$(MOVE) $(TARGET1) ../../lib/$(TARGET1)
|
||||
-$(MOVE) $(TARGET2) ../../lib/$(TARGET2)
|
||||
|
||||
|
||||
|
||||
staticlib: ../../lib/libQt5GifImage.a
|
||||
|
||||
../../lib/libQt5GifImage.a: QtGifImage.version $(OBJECTS) $(OBJCOMP)
|
||||
-$(DEL_FILE) $(TARGETA)
|
||||
$(AR) $(TARGETA) $(OBJECTS)
|
||||
|
||||
../../lib/libQt5GifImage.prl:
|
||||
@$(QMAKE) -prl gifimage.pro
|
||||
Makefile: gifimage.pro ../../.qmake.conf ../../.qmake.cache /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/sanitize.conf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base.conf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base-unix.conf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-base.conf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-unix.conf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/qconfig.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_accessibility_support_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dtkcommon.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dtkcore.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dtkgui.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dtkwidget.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_edid_support_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_egl_support_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fb_support_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fontdatabase_support_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_glx_support_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_input_support_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_kms_support_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_platformcompositor_support_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_service_support_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_svg.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_theme_support_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_x11extras.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xkbcommon_support_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml_private.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xmlpatterns.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/qmodule.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_prefix_build_check.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_build_config.prf \
|
||||
../../.qmake.conf \
|
||||
../../.qmake.cache \
|
||||
../../.qmake.stash \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/toolchain.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_build_paths.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_common.prf \
|
||||
../../include/QtGifImage/headers.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_module_headers.prf \
|
||||
../../mkspecs/modules-inst/qt_lib_gifimage.pri \
|
||||
../../mkspecs/modules-inst/qt_lib_gifimage_private.pri \
|
||||
../../mkspecs/modules/qt_lib_gifimage.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_module_pris.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_installs.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_targets.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_module.prf \
|
||||
../3rdParty/giflib.pri \
|
||||
qtgifimage.pri \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resolve_config.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_post.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/cmake_functions.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/create_cmake.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/hide_symbols.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/bsymbolic_functions.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exceptions_off.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_example_installs.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/largefile.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/warn_on.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources_functions.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/moc.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/opengl.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/thread.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qmake_use.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/file_copies.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_build_extra.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_docs.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_docs_targets.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/testcase_targets.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf \
|
||||
gifimage.pro \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/cmake/Qt5ConfigVersion.cmake.in
|
||||
$(QMAKE) -o Makefile gifimage.pro
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/sanitize.conf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base.conf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base-unix.conf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-base.conf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-unix.conf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/qconfig.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_accessibility_support_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dtkcommon.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dtkcore.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dtkgui.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dtkwidget.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_edid_support_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_egl_support_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fb_support_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_fontdatabase_support_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_glx_support_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_input_support_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_kms_support_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_platformcompositor_support_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_service_support_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_svg.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_theme_support_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_x11extras.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xkbcommon_support_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml_private.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xmlpatterns.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/qmodule.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_prefix_build_check.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_build_config.prf:
|
||||
../../.qmake.conf:
|
||||
../../.qmake.cache:
|
||||
../../.qmake.stash:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/toolchain.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_build_paths.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_common.prf:
|
||||
../../include/QtGifImage/headers.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_module_headers.prf:
|
||||
../../mkspecs/modules-inst/qt_lib_gifimage.pri:
|
||||
../../mkspecs/modules-inst/qt_lib_gifimage_private.pri:
|
||||
../../mkspecs/modules/qt_lib_gifimage.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_module_pris.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_installs.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_targets.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_module.prf:
|
||||
../3rdParty/giflib.pri:
|
||||
qtgifimage.pri:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resolve_config.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_post.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/cmake_functions.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/create_cmake.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/hide_symbols.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/bsymbolic_functions.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exceptions_off.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_example_installs.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/largefile.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/warn_on.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources_functions.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/moc.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/opengl.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/thread.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qmake_use.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/file_copies.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_build_extra.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_docs.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_docs_targets.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/testcase_targets.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf:
|
||||
gifimage.pro:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in:
|
||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/cmake/Qt5ConfigVersion.cmake.in:
|
||||
qmake: FORCE
|
||||
@$(QMAKE) -o Makefile gifimage.pro
|
||||
|
||||
qmake_all: FORCE
|
||||
|
||||
../../lib/libQt5GifImage.la ../../lib/pkgconfig/Qt5GifImage.pc:
|
||||
@$(QMAKE) -prl gifimage.pro
|
||||
|
||||
all: Makefile \
|
||||
../../lib/libQt5GifImage.prl \
|
||||
../../lib/libQt5GifImage.la \
|
||||
../../lib/pkgconfig/Qt5GifImage.pc ../../lib/libQt5GifImage.so.0.1.0
|
||||
|
||||
dist: distdir FORCE
|
||||
(cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar) && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR)
|
||||
|
||||
distdir: FORCE
|
||||
@test -d $(DISTDIR) || mkdir -p $(DISTDIR)
|
||||
$(COPY_FILE) --parents $(DIST) $(DISTDIR)/
|
||||
$(COPY_FILE) --parents QtGifImage.version.in $(DISTDIR)/
|
||||
$(COPY_FILE) --parents /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp $(DISTDIR)/
|
||||
$(COPY_FILE) --parents qgifglobal.h qgifimage.h qgifimage_p.h $(DISTDIR)/
|
||||
$(COPY_FILE) --parents ../3rdParty/giflib/dgif_lib.c ../3rdParty/giflib/egif_lib.c ../3rdParty/giflib/gif_err.c ../3rdParty/giflib/gif_hash.c ../3rdParty/giflib/gifalloc.c ../3rdParty/giflib/quantize.c qgifimage.cpp $(DISTDIR)/
|
||||
|
||||
|
||||
clean: compiler_clean
|
||||
-$(DEL_FILE) $(OBJECTS)
|
||||
-$(DEL_FILE) *~ core *.core
|
||||
|
||||
|
||||
distclean: clean include-distclean
|
||||
-$(DEL_FILE) ../../lib/$(TARGET)
|
||||
-$(DEL_FILE) ../../lib/$(TARGET0) ../../lib/$(TARGET1) ../../lib/$(TARGET2) $(TARGETA)
|
||||
-$(DEL_FILE) /home/wingsummer/Documents/SourceCode/QtGifImage/src/gifimage/qdoc_wrapper.sh /home/wingsummer/Documents/SourceCode/QtGifImage/lib/cmake/Qt5GifImage/Qt5GifImageConfig.cmake /home/wingsummer/Documents/SourceCode/QtGifImage/lib/cmake/Qt5GifImage/Qt5GifImageConfigVersion.cmake ../../lib/libQt5GifImage.prl ../../lib/libQt5GifImage.la ../../lib/pkgconfig/Qt5GifImage.pc
|
||||
-$(DEL_FILE) Makefile
|
||||
|
||||
|
||||
####### Sub-libraries
|
||||
|
||||
include-distclean:
|
||||
rm -rf /home/wingsummer/Documents/SourceCode/QtGifImage/include/QtGifImage
|
||||
|
||||
mocclean: compiler_moc_header_clean compiler_moc_objc_header_clean compiler_moc_source_clean
|
||||
|
||||
mocables: compiler_moc_header_make_all compiler_moc_objc_header_make_all compiler_moc_source_make_all
|
||||
|
||||
html_docs:
|
||||
$(MAKE) -f $(MAKEFILE) prepare_docs && $(MAKE) -f $(MAKEFILE) generate_docs
|
||||
|
||||
docs:
|
||||
$(MAKE) -f $(MAKEFILE) html_docs && $(MAKE) -f $(MAKEFILE) qch_docs
|
||||
|
||||
qtattributionsscanner: FORCE
|
||||
/usr/lib/qt5/bin/qtattributionsscanner /home/wingsummer/Documents/SourceCode/QtGifImage --filter QDocModule=qtgifimage -o /home/wingsummer/Documents/SourceCode/QtGifImage/src/gifimage/codeattributions.qdoc
|
||||
|
||||
install_html_docs: install_inst_html_docs
|
||||
|
||||
uninstall_html_docs: uninstall_inst_html_docs
|
||||
|
||||
install_qch_docs: install_inst_qch_docs
|
||||
|
||||
uninstall_qch_docs: uninstall_inst_qch_docs
|
||||
|
||||
install_docs: install_html_docs install_qch_docs
|
||||
|
||||
uninstall_docs: uninstall_html_docs uninstall_qch_docs
|
||||
|
||||
qch_docs:
|
||||
/usr/lib/qt5/bin/qhelpgenerator /home/wingsummer/Documents/SourceCode/QtGifImage/doc/qtgifimage/qtgifimage.qhp -o /home/wingsummer/Documents/SourceCode/QtGifImage/doc/qtgifimage.qch
|
||||
|
||||
prepare_docs: qtattributionsscanner
|
||||
/home/wingsummer/Documents/SourceCode/QtGifImage/src/gifimage/qdoc_wrapper.sh -outputdir /home/wingsummer/Documents/SourceCode/QtGifImage/doc/qtgifimage -installdir /usr/share/qt5/doc /home/wingsummer/Documents/SourceCode/QtGifImage/src/gifimage/doc/qtgifimage.qdocconf -prepare -indexdir /usr/share/qt5/doc -no-link-errors $(INCPATH) -I/usr/include/c++/8 -I/usr/include/x86_64-linux-gnu/c++/8 -I/usr/include/c++/8/backward -I/usr/lib/gcc/x86_64-linux-gnu/8/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/8/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include
|
||||
|
||||
generate_docs:
|
||||
/home/wingsummer/Documents/SourceCode/QtGifImage/src/gifimage/qdoc_wrapper.sh -outputdir /home/wingsummer/Documents/SourceCode/QtGifImage/doc/qtgifimage -installdir /usr/share/qt5/doc /home/wingsummer/Documents/SourceCode/QtGifImage/src/gifimage/doc/qtgifimage.qdocconf -generate -indexdir /usr/share/qt5/doc $(INCPATH) -I/usr/include/c++/8 -I/usr/include/x86_64-linux-gnu/c++/8 -I/usr/include/c++/8/backward -I/usr/lib/gcc/x86_64-linux-gnu/8/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/8/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include
|
||||
|
||||
check: first
|
||||
|
||||
benchmark: first
|
||||
|
||||
compiler_verscriptprocess_make_all: QtGifImage.version
|
||||
compiler_verscriptprocess_clean:
|
||||
-$(DEL_FILE) QtGifImage.version
|
||||
QtGifImage.version: QtGifImage.version.in \
|
||||
qgifimage_p.h
|
||||
perl /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/unix/findclasslist.pl < QtGifImage.version.in > $@
|
||||
|
||||
compiler_rcc_make_all:
|
||||
compiler_rcc_clean:
|
||||
compiler_moc_predefs_make_all: .moc/moc_predefs.h
|
||||
compiler_moc_predefs_clean:
|
||||
-$(DEL_FILE) .moc/moc_predefs.h
|
||||
.moc/moc_predefs.h: /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp
|
||||
g++ -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -O2 -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -dM -E -o .moc/moc_predefs.h /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp
|
||||
|
||||
compiler_moc_header_make_all:
|
||||
compiler_moc_header_clean:
|
||||
compiler_moc_objc_header_make_all:
|
||||
compiler_moc_objc_header_clean:
|
||||
compiler_moc_source_make_all:
|
||||
compiler_moc_source_clean:
|
||||
compiler_yacc_decl_make_all:
|
||||
compiler_yacc_decl_clean:
|
||||
compiler_yacc_impl_make_all:
|
||||
compiler_yacc_impl_clean:
|
||||
compiler_lex_make_all:
|
||||
compiler_lex_clean:
|
||||
compiler_clean: compiler_verscriptprocess_clean compiler_moc_predefs_clean
|
||||
|
||||
####### Compile
|
||||
|
||||
.obj/dgif_lib.o: ../3rdParty/giflib/dgif_lib.c ../3rdParty/giflib/gif_lib.h \
|
||||
../3rdParty/giflib/gif_lib_private.h \
|
||||
../3rdParty/giflib/gif_hash.h
|
||||
$(CC) -c $(CFLAGS) $(INCPATH) -o .obj/dgif_lib.o ../3rdParty/giflib/dgif_lib.c
|
||||
|
||||
.obj/egif_lib.o: ../3rdParty/giflib/egif_lib.c ../3rdParty/giflib/gif_lib.h \
|
||||
../3rdParty/giflib/gif_lib_private.h \
|
||||
../3rdParty/giflib/gif_hash.h
|
||||
$(CC) -c $(CFLAGS) $(INCPATH) -o .obj/egif_lib.o ../3rdParty/giflib/egif_lib.c
|
||||
|
||||
.obj/gif_err.o: ../3rdParty/giflib/gif_err.c ../3rdParty/giflib/gif_lib.h \
|
||||
../3rdParty/giflib/gif_lib_private.h \
|
||||
../3rdParty/giflib/gif_hash.h
|
||||
$(CC) -c $(CFLAGS) $(INCPATH) -o .obj/gif_err.o ../3rdParty/giflib/gif_err.c
|
||||
|
||||
.obj/gif_hash.o: ../3rdParty/giflib/gif_hash.c ../3rdParty/giflib/gif_lib.h \
|
||||
../3rdParty/giflib/gif_hash.h \
|
||||
../3rdParty/giflib/gif_lib_private.h
|
||||
$(CC) -c $(CFLAGS) $(INCPATH) -o .obj/gif_hash.o ../3rdParty/giflib/gif_hash.c
|
||||
|
||||
.obj/gifalloc.o: ../3rdParty/giflib/gifalloc.c ../3rdParty/giflib/gif_lib.h
|
||||
$(CC) -c $(CFLAGS) $(INCPATH) -o .obj/gifalloc.o ../3rdParty/giflib/gifalloc.c
|
||||
|
||||
.obj/quantize.o: ../3rdParty/giflib/quantize.c ../3rdParty/giflib/gif_lib.h \
|
||||
../3rdParty/giflib/gif_lib_private.h \
|
||||
../3rdParty/giflib/gif_hash.h
|
||||
$(CC) -c $(CFLAGS) $(INCPATH) -o .obj/quantize.o ../3rdParty/giflib/quantize.c
|
||||
|
||||
.obj/qgifimage.o: qgifimage.cpp qgifimage.h \
|
||||
qgifglobal.h \
|
||||
qgifimage_p.h \
|
||||
../3rdParty/giflib/gif_lib.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/qgifimage.o qgifimage.cpp
|
||||
|
||||
####### Install
|
||||
|
||||
install_target: first FORCE
|
||||
@test -d $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu || mkdir -p $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu
|
||||
$(QINSTALL_PROGRAM) ../../lib/$(TARGET) $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/$(TARGET)
|
||||
-$(SYMLINK) $(TARGET) $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/$(TARGET0)
|
||||
-$(SYMLINK) $(TARGET) $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/$(TARGET1)
|
||||
-$(SYMLINK) $(TARGET) $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/$(TARGET2)
|
||||
@test -d $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu || mkdir -p $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu
|
||||
$(SED) -e 's,/home/wingsummer/Documents/SourceCode/QtGifImage/lib/,$$$$[QT_INSTALL_LIBS]/,g' -e 's,[^ '\'']*/home/wingsummer/Documents/SourceCode/QtGifImage/lib,,g' -e 's,/usr/lib/x86_64-linux-gnu,$$$$[QT_INSTALL_LIBS],g' ../../lib/libQt5GifImage.prl > $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/libQt5GifImage.prl
|
||||
@test -d $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu || mkdir -p $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu
|
||||
$(SED) -e s,/home/wingsummer/Documents/SourceCode/QtGifImage/lib/,=/usr/lib/x86_64-linux-gnu/,g -e 's,[^ '\'']*/home/wingsummer/Documents/SourceCode/QtGifImage/lib,,g' ../../lib/libQt5GifImage.la > $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/libQt5GifImage.la
|
||||
@test -d $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/pkgconfig || mkdir -p $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/pkgconfig
|
||||
$(SED) -e s,/home/wingsummer/Documents/SourceCode/QtGifImage/lib/,/usr/lib/x86_64-linux-gnu/,g -e 's,[^ '\'']*/home/wingsummer/Documents/SourceCode/QtGifImage/lib,,g' ../../lib/pkgconfig/Qt5GifImage.pc > $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/pkgconfig/Qt5GifImage.pc
|
||||
|
||||
uninstall_target: FORCE
|
||||
-$(DEL_FILE) $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/$(TARGET)
|
||||
-$(DEL_FILE) $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/$(TARGET0)
|
||||
-$(DEL_FILE) $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/$(TARGET1)
|
||||
-$(DEL_FILE) $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/$(TARGET2)
|
||||
-$(DEL_FILE) $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/libQt5GifImage.prl
|
||||
-$(DEL_FILE) $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/libQt5GifImage.la
|
||||
-$(DEL_FILE) $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/pkgconfig/Qt5GifImage.pc
|
||||
-$(DEL_DIR) $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/
|
||||
|
||||
|
||||
install_gen_headers: first FORCE
|
||||
@test -d $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage || mkdir -p $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage
|
||||
$(QINSTALL) /home/wingsummer/Documents/SourceCode/QtGifImage/include/QtGifImage/QGifImage $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/QGifImage
|
||||
$(QINSTALL) /home/wingsummer/Documents/SourceCode/QtGifImage/include/QtGifImage/qtgifimageversion.h $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/qtgifimageversion.h
|
||||
$(QINSTALL) /home/wingsummer/Documents/SourceCode/QtGifImage/include/QtGifImage/QtGifImageVersion $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/QtGifImageVersion
|
||||
$(QINSTALL) /home/wingsummer/Documents/SourceCode/QtGifImage/include/QtGifImage/QtGifImage $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/QtGifImage
|
||||
|
||||
uninstall_gen_headers: FORCE
|
||||
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/QtGifImage
|
||||
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/QtGifImageVersion
|
||||
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/qtgifimageversion.h
|
||||
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/QGifImage
|
||||
-$(DEL_DIR) $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/
|
||||
|
||||
|
||||
install_targ_headers: first FORCE
|
||||
@test -d $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage || mkdir -p $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage
|
||||
$(QINSTALL) /home/wingsummer/Documents/SourceCode/QtGifImage/src/gifimage/qgifglobal.h $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/qgifglobal.h
|
||||
$(QINSTALL) /home/wingsummer/Documents/SourceCode/QtGifImage/src/gifimage/qgifimage.h $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/qgifimage.h
|
||||
$(QINSTALL) /home/wingsummer/Documents/SourceCode/QtGifImage/include/QtGifImage/QtGifImageDepends $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/QtGifImageDepends
|
||||
|
||||
uninstall_targ_headers: FORCE
|
||||
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/QtGifImageDepends
|
||||
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/qgifimage.h
|
||||
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/qgifglobal.h
|
||||
-$(DEL_DIR) $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/
|
||||
|
||||
|
||||
install_private_headers: first FORCE
|
||||
@test -d $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/0.1.0/QtGifImage/private || mkdir -p $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/0.1.0/QtGifImage/private
|
||||
$(QINSTALL) /home/wingsummer/Documents/SourceCode/QtGifImage/src/gifimage/qgifimage_p.h $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/0.1.0/QtGifImage/private/qgifimage_p.h
|
||||
|
||||
uninstall_private_headers: FORCE
|
||||
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/0.1.0/QtGifImage/private/qgifimage_p.h
|
||||
-$(DEL_DIR) $(INSTALL_ROOT)/usr/include/x86_64-linux-gnu/qt5/QtGifImage/0.1.0/QtGifImage/private/
|
||||
|
||||
|
||||
install_pritarget: first FORCE
|
||||
@test -d $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules || mkdir -p $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules
|
||||
$(QINSTALL) /home/wingsummer/Documents/SourceCode/QtGifImage/mkspecs/modules-inst/qt_lib_gifimage.pri $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gifimage.pri
|
||||
|
||||
uninstall_pritarget: FORCE
|
||||
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gifimage.pri
|
||||
-$(DEL_DIR) $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/
|
||||
|
||||
|
||||
install_privpritarget: first FORCE
|
||||
@test -d $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules || mkdir -p $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules
|
||||
$(QINSTALL) /home/wingsummer/Documents/SourceCode/QtGifImage/mkspecs/modules-inst/qt_lib_gifimage_private.pri $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gifimage_private.pri
|
||||
|
||||
uninstall_privpritarget: FORCE
|
||||
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gifimage_private.pri
|
||||
-$(DEL_DIR) $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/
|
||||
|
||||
|
||||
install_cmake_qt5_module_files: first FORCE
|
||||
@test -d $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/cmake/Qt5GifImage || mkdir -p $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/cmake/Qt5GifImage
|
||||
$(QINSTALL) /home/wingsummer/Documents/SourceCode/QtGifImage/lib/cmake/Qt5GifImage/Qt5GifImageConfig.cmake $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/cmake/Qt5GifImage/Qt5GifImageConfig.cmake
|
||||
$(QINSTALL) /home/wingsummer/Documents/SourceCode/QtGifImage/lib/cmake/Qt5GifImage/Qt5GifImageConfigVersion.cmake $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/cmake/Qt5GifImage/Qt5GifImageConfigVersion.cmake
|
||||
|
||||
uninstall_cmake_qt5_module_files: FORCE
|
||||
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/cmake/Qt5GifImage/Qt5GifImageConfigVersion.cmake
|
||||
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/cmake/Qt5GifImage/Qt5GifImageConfig.cmake
|
||||
-$(DEL_DIR) $(INSTALL_ROOT)/usr/lib/x86_64-linux-gnu/cmake/Qt5GifImage/
|
||||
|
||||
|
||||
install_inst_html_docs: FORCE
|
||||
@test -d $(INSTALL_ROOT)/usr/share/qt5/doc || mkdir -p $(INSTALL_ROOT)/usr/share/qt5/doc
|
||||
$(QINSTALL) /home/wingsummer/Documents/SourceCode/QtGifImage/doc/qtgifimage $(INSTALL_ROOT)/usr/share/qt5/doc/qtgifimage
|
||||
|
||||
uninstall_inst_html_docs: FORCE
|
||||
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/qt5/doc/qtgifimage
|
||||
-$(DEL_DIR) $(INSTALL_ROOT)/usr/share/qt5/doc/
|
||||
|
||||
|
||||
install_inst_qch_docs: FORCE
|
||||
@test -d $(INSTALL_ROOT)/usr/share/qt5/doc || mkdir -p $(INSTALL_ROOT)/usr/share/qt5/doc
|
||||
$(QINSTALL) /home/wingsummer/Documents/SourceCode/QtGifImage/doc/qtgifimage.qch $(INSTALL_ROOT)/usr/share/qt5/doc/qtgifimage.qch
|
||||
|
||||
uninstall_inst_qch_docs: FORCE
|
||||
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/qt5/doc/qtgifimage.qch
|
||||
-$(DEL_DIR) $(INSTALL_ROOT)/usr/share/qt5/doc/
|
||||
|
||||
|
||||
install: install_target install_gen_headers install_targ_headers install_private_headers install_pritarget install_privpritarget install_cmake_qt5_module_files FORCE
|
||||
|
||||
uninstall: uninstall_target uninstall_gen_headers uninstall_targ_headers uninstall_private_headers uninstall_pritarget uninstall_privpritarget uninstall_cmake_qt5_module_files FORCE
|
||||
|
||||
FORCE:
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
Qt_5_PRIVATE_API {
|
||||
qt_private_api_tag*;
|
||||
};
|
||||
Qt_5 { *; };
|
||||
Qt_5.0 {} Qt_5;
|
||||
Qt_5.1 {} Qt_5.0;
|
||||
Qt_5.2 {} Qt_5.1;
|
||||
Qt_5.3 {} Qt_5.2;
|
||||
Qt_5.4 {} Qt_5.3;
|
||||
Qt_5.5 {} Qt_5.4;
|
||||
Qt_5.6 {} Qt_5.5;
|
||||
Qt_5.7 {} Qt_5.6;
|
||||
Qt_5.8 {} Qt_5.7;
|
||||
Qt_5.9 {} Qt_5.8;
|
||||
Qt_5.10 {} Qt_5.9;
|
||||
Qt_5.11 {} Qt_5.10;
|
||||
Qt_5.12 {} Qt_5.11;
|
||||
Qt_5.13 {} Qt_5.12;
|
||||
Qt_5.14 {} Qt_5.13;
|
||||
Qt_5.15 { qt_version_tag; } Qt_5.14;
|
|
@ -0,0 +1,21 @@
|
|||
Qt_5_PRIVATE_API {
|
||||
qt_private_api_tag*;
|
||||
@FILE:/home/wingsummer/Documents/SourceCode/QtGifImage/src/gifimage/qgifimage_p.h@
|
||||
};
|
||||
Qt_5 { *; };
|
||||
Qt_5.0 {} Qt_5;
|
||||
Qt_5.1 {} Qt_5.0;
|
||||
Qt_5.2 {} Qt_5.1;
|
||||
Qt_5.3 {} Qt_5.2;
|
||||
Qt_5.4 {} Qt_5.3;
|
||||
Qt_5.5 {} Qt_5.4;
|
||||
Qt_5.6 {} Qt_5.5;
|
||||
Qt_5.7 {} Qt_5.6;
|
||||
Qt_5.8 {} Qt_5.7;
|
||||
Qt_5.9 {} Qt_5.8;
|
||||
Qt_5.10 {} Qt_5.9;
|
||||
Qt_5.11 {} Qt_5.10;
|
||||
Qt_5.12 {} Qt_5.11;
|
||||
Qt_5.13 {} Qt_5.12;
|
||||
Qt_5.14 {} Qt_5.13;
|
||||
Qt_5.15 { qt_version_tag; } Qt_5.14;
|
|
@ -0,0 +1,79 @@
|
|||
include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
|
||||
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
|
||||
|
||||
project = QtGifImage
|
||||
description = Qt GifImage Reference Documentation
|
||||
url = http://qtgifimage.debao.me
|
||||
version = $QT_VERSION
|
||||
|
||||
qhp.projects = QtGifImage
|
||||
|
||||
qhp.QtGifImage.file = qtgifimage.qhp
|
||||
qhp.QtGifImage.namespace = me.debao.qtgifimage.$QT_VERSION_TAG
|
||||
qhp.QtGifImage.virtualFolder = qtgifimage
|
||||
qhp.QtGifImage.indexTitle = Qt GifImage
|
||||
qhp.QtGifImage.indexRoot =
|
||||
|
||||
qhp.QtGifImage.filterAttributes = qtgifimage $QT_VERSION qtrefdoc
|
||||
qhp.QtGifImage.customFilters.Qt.name = QtGifImage $QT_VERSION
|
||||
qhp.QtGifImage.customFilters.Qt.filterAttributes = qtgifimage $QT_VERSION
|
||||
qhp.QtGifImage.subprojects = overviews classes qmltypes examples
|
||||
qhp.QtGifImage.subprojects.overviews.title = Overview
|
||||
qhp.QtGifImage.subprojects.overviews.indexTitle = Qt GifImage
|
||||
qhp.QtGifImage.subprojects.overviews.selectors = fake:page,group,module
|
||||
qhp.QtGifImage.subprojects.classes.title = C++ Classes
|
||||
qhp.QtGifImage.subprojects.classes.indexTitle = Qt GifImage C++ Classes
|
||||
qhp.QtGifImage.subprojects.classes.selectors = class fake:headerfile
|
||||
qhp.QtGifImage.subprojects.classes.sortPages = true
|
||||
qhp.QtGifImage.subprojects.examples.title = Examples
|
||||
qhp.QtGifImage.subprojects.examples.indexTitle = Qt GifImage Examples
|
||||
qhp.QtGifImage.subprojects.examples.selectors = fake:example
|
||||
|
||||
tagfile = ../../../doc/qtgifimage/qtgifimage.tags
|
||||
|
||||
headerdirs += ..
|
||||
|
||||
sourcedirs += ..
|
||||
|
||||
exampledirs += ../../../examples/gifimage \
|
||||
snippets/
|
||||
|
||||
# Specify the install path under QT_INSTALL_EXAMPLES
|
||||
examplesinstallpath = gifimage
|
||||
|
||||
imagedirs += images
|
||||
|
||||
depends += qtcore qtdoc qtgui
|
||||
|
||||
HTML.footer = \
|
||||
" </div>\n" \
|
||||
" </div>\n" \
|
||||
" </div>\n" \
|
||||
" </div>\n" \
|
||||
"</div>\n" \
|
||||
"<div class=\"footer\">\n" \
|
||||
" <div class=\"qt13a-copyright\" id=\"copyright\">\n" \
|
||||
" <div class=\"qt13a-container\">\n" \
|
||||
" <p>\n" \
|
||||
" <acronym title=\"Copyright\">©</acronym> 2013 Debao Zhang. \n" \
|
||||
" Documentation contributions included herein are the copyrights of\n" \
|
||||
" their respective owners.</p>\n" \
|
||||
" <acronym title=\"Copyright\">©</acronym> 2017 jiangcaiyang. \n" \
|
||||
" Documentation contributions included herein are the copyrights of\n" \
|
||||
" their respective owners.</p>\n" \
|
||||
" <p>\n" \
|
||||
" The documentation provided herein is licensed under the terms of the\n" \
|
||||
" <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU Free Documentation\n" \
|
||||
" License version 1.3</a> as published by the Free Software Foundation.</p>\n" \
|
||||
" <p>\n" \
|
||||
" Documentation sources may be obtained from <a href=\"https://github.com/dbzhang800/QtGifImage\">\n" \
|
||||
" github.com/dbzhang800</a> and <a href=\"http://doc.qtdream.com/qtgifimage\">\n" \
|
||||
" http://doc.qtdream.com/qtgifimage</a>.</p>\n" \
|
||||
" <p>\n" \
|
||||
" Qt and their respective logos are trademarks of Digia Plc \n" \
|
||||
" in Finland and/or other countries worldwide. All other trademarks are property\n" \
|
||||
" of their respective owners. <a title=\"Privacy Policy\"\n" \
|
||||
" href=\"http://en.gitorious.org/privacy_policy/\">Privacy Policy</a></p>\n" \
|
||||
" </div>\n" \
|
||||
" </div>\n" \
|
||||
"</div>\n" \
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
//! [0]
|
||||
#include <QtGifImage>
|
||||
//! [0]
|
||||
|
||||
//! [1]
|
||||
#include <QtGifImage>
|
||||
//! [1]
|
|
@ -0,0 +1,3 @@
|
|||
#! [1]
|
||||
QT += gifimage
|
||||
#! [1]
|
|
@ -0,0 +1,8 @@
|
|||
/*!
|
||||
\group qtgifimage-examples
|
||||
\title Qt GifImage Examples
|
||||
\brief Examples for the Qt GifImage module
|
||||
\ingroup all-examples
|
||||
|
||||
Qt GifImage comes with the following examples:
|
||||
*/
|
|
@ -0,0 +1,71 @@
|
|||
/****************************************************************************
|
||||
** Copyright (c) 2013 Debao Zhang <hello@debao.me>
|
||||
** All right reserved.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\title Qt GifImage
|
||||
\page index.html
|
||||
\brief Qt GifImage provides functionality for handling .gif files.
|
||||
|
||||
The \l{Qt GifImage C++ Classes}{Qt GifImage Module} provides a set of classes to read and write .gif files.
|
||||
The library can be used to
|
||||
|
||||
\list
|
||||
\li Generate a new .gif file from a list of QImage files.
|
||||
\li Extract frames to a list of QImage files.
|
||||
\endlist
|
||||
|
||||
\image demo1.gif
|
||||
|
||||
\table
|
||||
\row
|
||||
\li Source code: \li \l{https://github.com/dbzhang800/QtGifImage}
|
||||
\row
|
||||
\li Issures: \li \l{https://github.com/dbzhang800/QtGifImage/issues}
|
||||
\row
|
||||
\li License: \li MIT
|
||||
\endtable
|
||||
|
||||
\section1 Getting Started
|
||||
|
||||
To include the definitions of the module's classes, using the following directive:
|
||||
|
||||
\code
|
||||
#include <QtGifImage>
|
||||
\endcode
|
||||
|
||||
To link against the module, add this line to your qmake .pro file:
|
||||
|
||||
\code
|
||||
QT += gifimage
|
||||
\endcode
|
||||
|
||||
More information can be found in \l{Qt GifImage Build} page.
|
||||
|
||||
\section1 Related information
|
||||
\list
|
||||
\li \l{Qt GifImage C++ Classes}
|
||||
\li \l{Qt GifImage Examples}
|
||||
\endlist
|
||||
*/
|
|
@ -0,0 +1,34 @@
|
|||
/****************************************************************************
|
||||
** Copyright (c) 2013 Debao Zhang <hello@debao.me>
|
||||
** All right reserved.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\module QtGifImage
|
||||
\title Qt GifImage C++ Classes
|
||||
\ingroup modules
|
||||
|
||||
\brief The Qt GifImage module provides functionality for handling .gif files.
|
||||
|
||||
*/
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/*!
|
||||
\page building
|
||||
\title Qt GifImage Build
|
||||
|
||||
\section1 Usage(1): Use Qt GifImage as Qt5's addon module
|
||||
|
||||
1. Download the source code from \l {https://github.com/dbzhang800/QtGifImage/archive/master.zip} {github.com}.
|
||||
|
||||
2. Put the source code in any directory you like. At the toplevel directory run
|
||||
|
||||
\note Perl is needed in this step.
|
||||
|
||||
\code
|
||||
qmake
|
||||
make
|
||||
make install
|
||||
\endcode
|
||||
|
||||
The library, the header files, and others will be installed to your system.
|
||||
|
||||
3. Add following line to your qmake's project file:
|
||||
|
||||
\code
|
||||
QT += gifimage
|
||||
\endcode
|
||||
|
||||
4. Then, using Qt Qt GifImage in your code
|
||||
|
||||
\section1 Usage(2): Use source code directly
|
||||
|
||||
The package contains a qtgifimage.pri file that allows you to integrate
|
||||
the component into applications that use qmake for the build step.
|
||||
|
||||
1. Download the source code from \l {https://github.com/dbzhang800/QtGifImage/archive/master.zip} {github.com}
|
||||
|
||||
2. Put the source code in any directory you like. For example, 3rdparty:
|
||||
|
||||
\code
|
||||
|-- project.pro
|
||||
|-- ....
|
||||
|-- 3rdparty\
|
||||
| |-- qtgifimage\
|
||||
| |
|
||||
\endcode
|
||||
|
||||
3. Add following line to your qmake project file:
|
||||
|
||||
\code
|
||||
include(3rdparty/qtgifimage/src/gifimage/qtgifimage.pri)
|
||||
\endcode
|
||||
|
||||
4. Then, using Qt GifImage in your code
|
||||
*/
|
|
@ -0,0 +1,15 @@
|
|||
TARGET = QtGifImage
|
||||
|
||||
load(qt_module)
|
||||
|
||||
CONFIG += build_gifimage_lib
|
||||
|
||||
include(qtgifimage.pri)
|
||||
|
||||
QMAKE_TARGET_COMPANY = "Debao Zhang"
|
||||
QMAKE_TARGET_COPYRIGHT = "Copyright (C) 2013 Debao Zhang <hello@debao.me>"
|
||||
QMAKE_TARGET_DESCRIPTION = ".gif file reader and wirter for Qt"
|
||||
|
||||
# 这些是文档的部分
|
||||
OTHER_FILES += $$QMAKE_DOCS doc/src/*.qdoc
|
||||
QMAKE_DOCS = $$PWD/doc/qtgifimage.qdocconf
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
QT_VERSION=0.1.0
|
||||
export QT_VERSION
|
||||
QT_VER=0.1
|
||||
export QT_VER
|
||||
QT_VERSION_TAG=010
|
||||
export QT_VERSION_TAG
|
||||
QT_INSTALL_DOCS=/usr/share/qt5/doc
|
||||
export QT_INSTALL_DOCS
|
||||
BUILDDIR=/home/wingsummer/Documents/SourceCode/QtGifImage/src/gifimage
|
||||
export BUILDDIR
|
||||
exec /usr/lib/qt5/bin/qdoc "$@"
|
|
@ -0,0 +1,39 @@
|
|||
/****************************************************************************
|
||||
** Copyright (c) 2013 Debao Zhang <hello@debao.me>
|
||||
** All right reserved.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QGIFGLOBAL_H
|
||||
#define QGIFGLOBAL_H
|
||||
#include <QtGlobal>
|
||||
|
||||
#if !defined(QT_STATIC) && !defined(GIFIMAGE_NO_LIB)
|
||||
# if defined(QT_BUILD_GIFIMAGE_LIB)
|
||||
# define Q_GIFIMAGE_EXPORT Q_DECL_EXPORT
|
||||
# else
|
||||
# define Q_GIFIMAGE_EXPORT Q_DECL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define Q_GIFIMAGE_EXPORT
|
||||
#endif
|
||||
|
||||
#endif // QGIFGLOBAL_H
|
|
@ -0,0 +1,705 @@
|
|||
/****************************************************************************
|
||||
** Copyright (c) 2013 Debao Zhang <hello@debao.me>
|
||||
** All right reserved.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "qgifimage.h"
|
||||
#include "qgifimage_p.h"
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QImage>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace {
|
||||
int writeToIODevice(GifFileType *gifFile, const GifByteType *data,
|
||||
int maxSize) {
|
||||
return int(static_cast<QIODevice *>(gifFile->UserData)
|
||||
->write(reinterpret_cast<const char *>(data), maxSize));
|
||||
}
|
||||
|
||||
int readFromIODevice(GifFileType *gifFile, GifByteType *data, int maxSize) {
|
||||
return int(static_cast<QIODevice *>(gifFile->UserData)
|
||||
->read(reinterpret_cast<char *>(data), maxSize));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
QGifImagePrivate::QGifImagePrivate(QGifImage *p)
|
||||
: loopCount(0), defaultDelayTime(1000), q_ptr(p) {}
|
||||
|
||||
QGifImagePrivate::~QGifImagePrivate() {}
|
||||
|
||||
QVector<QRgb>
|
||||
QGifImagePrivate::colorTableFromColorMapObject(ColorMapObject *colorMap,
|
||||
int transColorIndex) const {
|
||||
QVector<QRgb> colorTable;
|
||||
if (colorMap) {
|
||||
for (int idx = 0; idx < colorMap->ColorCount; ++idx) {
|
||||
GifColorType gifColor = colorMap->Colors[idx];
|
||||
QRgb color = qRgba(gifColor.Red, gifColor.Green, gifColor.Blue,
|
||||
idx != transColorIndex ? 0xFF : 0);
|
||||
// For non-transparent color, set the alpha to opaque.
|
||||
// modified by wingsummer
|
||||
colorTable.append(color);
|
||||
}
|
||||
}
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
ColorMapObject *
|
||||
QGifImagePrivate::colorTableToColorMapObject(QVector<QRgb> colorTable) const {
|
||||
if (colorTable.isEmpty())
|
||||
return nullptr;
|
||||
|
||||
ColorMapObject *cmap = (ColorMapObject *)malloc(sizeof(ColorMapObject));
|
||||
// num of colors must be a power of 2
|
||||
int numColors = 1 << GifBitSize(colorTable.size());
|
||||
cmap->ColorCount = numColors;
|
||||
// Maybe a bug of giflib, BitsPerPixel is used as size of the color table
|
||||
// size.
|
||||
cmap->BitsPerPixel = GifBitSize(colorTable.size()); // Todo!
|
||||
cmap->SortFlag = false;
|
||||
|
||||
GifColorType *colorValues = new GifColorType[ulong(numColors)];
|
||||
for (int idx = 0; idx < colorTable.size(); ++idx) {
|
||||
colorValues[idx].Red = uchar(qRed(colorTable[idx]));
|
||||
colorValues[idx].Green = uchar(qGreen(colorTable[idx]));
|
||||
colorValues[idx].Blue = uchar(qBlue(colorTable[idx]));
|
||||
}
|
||||
|
||||
cmap->Colors = colorValues;
|
||||
|
||||
return cmap;
|
||||
}
|
||||
|
||||
QSize QGifImagePrivate::getCanvasSize() const {
|
||||
// If canvasSize has been set by user.
|
||||
if (canvasSize.isValid())
|
||||
return canvasSize;
|
||||
|
||||
// Calc the right canvasSize from the frame size.
|
||||
int width = -1;
|
||||
int height = -1;
|
||||
for (QGifFrameInfoData info : frameInfos) {
|
||||
int w = info.image.width() + info.offset.x();
|
||||
int h = info.image.height() + info.offset.y();
|
||||
if (w > width)
|
||||
width = w;
|
||||
if (h > height)
|
||||
height = h;
|
||||
}
|
||||
return QSize(width, height);
|
||||
}
|
||||
|
||||
int QGifImagePrivate::getFrameTransparentColorIndex(
|
||||
const QGifFrameInfoData &frameInfo) const {
|
||||
int index = -1;
|
||||
|
||||
QColor transColor = frameInfo.transparentColor.isValid()
|
||||
? frameInfo.transparentColor
|
||||
: defaultTransparentColor;
|
||||
|
||||
if (transColor.isValid()) {
|
||||
if (!frameInfo.image.colorTable().isEmpty())
|
||||
index = frameInfo.image.colorTable().indexOf(transColor.rgb());
|
||||
else if (!globalColorTable.isEmpty())
|
||||
index = globalColorTable.indexOf(transColor.rgb());
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
bool QGifImagePrivate::load(QIODevice *device) {
|
||||
static int interlacedOffset[] = {0, 4, 2,
|
||||
1}; /* The way Interlaced image should. */
|
||||
static int interlacedJumps[] = {8, 8, 4,
|
||||
2}; /* be read - offsets and jumps... */
|
||||
|
||||
int error;
|
||||
GifFileType *gifFile = DGifOpen(device, readFromIODevice, &error);
|
||||
|
||||
if (!gifFile) {
|
||||
q_ptr->_lasterr = error;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (DGifSlurp(gifFile) == GIF_ERROR)
|
||||
return false;
|
||||
|
||||
canvasSize.setWidth(gifFile->SWidth);
|
||||
canvasSize.setHeight(gifFile->SHeight);
|
||||
if (gifFile->SColorMap) {
|
||||
globalColorTable = colorTableFromColorMapObject(gifFile->SColorMap);
|
||||
if (gifFile->SBackGroundColor < globalColorTable.size())
|
||||
bgColor = QColor(globalColorTable[gifFile->SBackGroundColor]);
|
||||
}
|
||||
|
||||
for (int idx = 0; idx < gifFile->ImageCount; ++idx) {
|
||||
SavedImage gifImage = gifFile->SavedImages[idx];
|
||||
int top = gifImage.ImageDesc.Top;
|
||||
int left = gifImage.ImageDesc.Left;
|
||||
int width = gifImage.ImageDesc.Width;
|
||||
int height = gifImage.ImageDesc.Height;
|
||||
|
||||
QGifFrameInfoData frameInfo;
|
||||
GraphicsControlBlock gcb;
|
||||
DGifSavedExtensionToGCB(gifFile, idx, &gcb);
|
||||
int transColorIndex = gcb.TransparentColor;
|
||||
|
||||
QVector<QRgb> colorTable;
|
||||
if (gifImage.ImageDesc.ColorMap)
|
||||
colorTable = colorTableFromColorMapObject(gifImage.ImageDesc.ColorMap,
|
||||
transColorIndex);
|
||||
else if (transColorIndex != -1)
|
||||
colorTable =
|
||||
colorTableFromColorMapObject(gifFile->SColorMap, transColorIndex);
|
||||
else
|
||||
colorTable = globalColorTable;
|
||||
|
||||
if (transColorIndex != -1)
|
||||
frameInfo.transparentColor = colorTable[transColorIndex];
|
||||
frameInfo.delayTime = gcb.DelayTime * 10; // convert to milliseconds
|
||||
frameInfo.interlace = gifImage.ImageDesc.Interlace;
|
||||
frameInfo.offset = QPoint(left, top);
|
||||
|
||||
QImage image(width, height, QImage::Format_Indexed8);
|
||||
image.setOffset(QPoint(left, top)); // Maybe useful for some users.
|
||||
image.setColorTable(colorTable);
|
||||
if (transColorIndex != -1)
|
||||
image.fill(uint(transColorIndex));
|
||||
else if (!globalColorTable.isEmpty())
|
||||
image.fill(uint(gifFile->SBackGroundColor)); //! ToDo
|
||||
|
||||
if (gifImage.ImageDesc.Interlace) {
|
||||
int line = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int row = interlacedOffset[i]; row < height;
|
||||
row += interlacedJumps[i]) {
|
||||
memcpy(image.scanLine(row), gifImage.RasterBits + line * width,
|
||||
size_t(width));
|
||||
line++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int row = 0; row < height; row++) {
|
||||
memcpy(image.scanLine(row), gifImage.RasterBits + row * width,
|
||||
size_t(width));
|
||||
}
|
||||
}
|
||||
|
||||
// Extract other data for the image.
|
||||
if (idx == 0) {
|
||||
if (gifImage.ExtensionBlockCount > 2) {
|
||||
ExtensionBlock *extBlock = gifImage.ExtensionBlocks;
|
||||
if (extBlock->Function == APPLICATION_EXT_FUNC_CODE &&
|
||||
extBlock->ByteCount == 8) {
|
||||
if (QByteArray((char *)extBlock->Bytes) ==
|
||||
QByteArray("NETSCAPE2.0")) {
|
||||
ExtensionBlock *block = gifImage.ExtensionBlocks + 1;
|
||||
if (block->ByteCount == 3) {
|
||||
loopCount =
|
||||
uchar(block->Bytes[1]) + uchar((block->Bytes[2]) << 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
frameInfo.image = image;
|
||||
frameInfos.append(frameInfo);
|
||||
}
|
||||
|
||||
DGifCloseFile(gifFile);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QGifImagePrivate::save(QIODevice *device,
|
||||
Qt::ImageConversionFlags flags) const {
|
||||
int error;
|
||||
GifFileType *gifFile = EGifOpen(device, writeToIODevice, &error);
|
||||
if (!gifFile) {
|
||||
q_ptr->_lasterr = error;
|
||||
return false;
|
||||
}
|
||||
|
||||
QSize _canvasSize = getCanvasSize();
|
||||
gifFile->SWidth = _canvasSize.width();
|
||||
gifFile->SHeight = _canvasSize.height();
|
||||
gifFile->SColorResolution = 8;
|
||||
if (!globalColorTable.isEmpty()) {
|
||||
gifFile->SColorMap = colorTableToColorMapObject(globalColorTable);
|
||||
int idx = globalColorTable.indexOf(bgColor.rgba());
|
||||
gifFile->SBackGroundColor = idx == -1 ? 0 : idx;
|
||||
}
|
||||
|
||||
gifFile->ImageCount = frameInfos.size();
|
||||
gifFile->SavedImages = new SavedImage[ulong(frameInfos.size())];
|
||||
for (int idx = 0; idx < frameInfos.size(); ++idx) {
|
||||
const QGifFrameInfoData frameInfo = frameInfos.at(idx);
|
||||
QImage image = frameInfo.image;
|
||||
if (image.format() != QImage::Format_Indexed8) {
|
||||
if (!globalColorTable.isEmpty())
|
||||
image = image.convertToFormat(QImage::Format_Indexed8, globalColorTable,
|
||||
flags);
|
||||
else
|
||||
image = image.convertToFormat(QImage::Format_Indexed8, flags);
|
||||
}
|
||||
|
||||
SavedImage *gifImage = gifFile->SavedImages + idx;
|
||||
|
||||
gifImage->ImageDesc.Left = frameInfo.offset.x();
|
||||
gifImage->ImageDesc.Top = frameInfo.offset.y();
|
||||
gifImage->ImageDesc.Width = image.width();
|
||||
gifImage->ImageDesc.Height = image.height();
|
||||
gifImage->ImageDesc.Interlace = frameInfo.interlace;
|
||||
|
||||
if (!image.colorTable().isEmpty() &&
|
||||
(image.colorTable() != globalColorTable))
|
||||
gifImage->ImageDesc.ColorMap =
|
||||
colorTableToColorMapObject(image.colorTable());
|
||||
else
|
||||
gifImage->ImageDesc.ColorMap = nullptr;
|
||||
|
||||
GifByteType *data = (GifByteType *)malloc(
|
||||
ulong(image.width() * image.height()) * sizeof(GifByteType));
|
||||
for (int row = 0; row < image.height(); ++row) {
|
||||
memcpy(data + row * image.width(), image.scanLine(row),
|
||||
ulong(image.width()));
|
||||
}
|
||||
gifImage->RasterBits = data;
|
||||
|
||||
if (idx == 0) {
|
||||
uchar data8[12] = "NETSCAPE2.0";
|
||||
GifAddExtensionBlock(&gifImage->ExtensionBlockCount,
|
||||
&gifImage->ExtensionBlocks,
|
||||
APPLICATION_EXT_FUNC_CODE, 11, data8);
|
||||
uchar data[3];
|
||||
data[0] = 0x01;
|
||||
data[1] = loopCount & 0xFF;
|
||||
data[2] = (loopCount >> 8) & 0xFF;
|
||||
GifAddExtensionBlock(&gifImage->ExtensionBlockCount,
|
||||
&gifImage->ExtensionBlocks, CONTINUE_EXT_FUNC_CODE,
|
||||
3, data);
|
||||
}
|
||||
|
||||
GraphicsControlBlock gcbBlock;
|
||||
gcbBlock.DisposalMode = 0;
|
||||
gcbBlock.UserInputFlag = false;
|
||||
gcbBlock.TransparentColor = getFrameTransparentColorIndex(frameInfo);
|
||||
|
||||
if (frameInfo.delayTime != -1)
|
||||
gcbBlock.DelayTime = frameInfo.delayTime / 10; // convert from
|
||||
// milliseconds
|
||||
else
|
||||
gcbBlock.DelayTime = defaultDelayTime / 10;
|
||||
|
||||
EGifGCBToSavedExtension(&gcbBlock, gifFile, idx);
|
||||
}
|
||||
|
||||
EGifSpew(gifFile);
|
||||
// EGifCloseFile(gifFile);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
\class QGifImage
|
||||
\inmodule QtGifImage
|
||||
\brief Class used to read/wirte .gif files.
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs a gif image
|
||||
*/
|
||||
QGifImage::QGifImage() : d_ptr(new QGifImagePrivate(this)) {}
|
||||
|
||||
/*!
|
||||
Constructs a gif image and tries to load the image from the
|
||||
file with the given \a fileName
|
||||
*/
|
||||
QGifImage::QGifImage(const QString &fileName)
|
||||
: d_ptr(new QGifImagePrivate(this)) {
|
||||
load(fileName);
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a gif image with the given \a size
|
||||
*/
|
||||
QGifImage::QGifImage(const QSize &size) : d_ptr(new QGifImagePrivate(this)) {
|
||||
d_ptr->canvasSize = size;
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the gif image and cleans up.
|
||||
*/
|
||||
QGifImage::~QGifImage() { delete d_ptr; }
|
||||
|
||||
/*!
|
||||
Return global color table.
|
||||
*/
|
||||
QVector<QRgb> QGifImage::globalColorTable() const {
|
||||
Q_D(const QGifImage);
|
||||
return d->globalColorTable;
|
||||
}
|
||||
|
||||
/*!
|
||||
Return background color of the gif canvas. It only makes sense when
|
||||
global color table is not empty.
|
||||
*/
|
||||
QColor QGifImage::backgroundColor() const {
|
||||
Q_D(const QGifImage);
|
||||
return d->bgColor;
|
||||
}
|
||||
|
||||
/*!
|
||||
Set the global color table \a colors and background color \a bgColor.
|
||||
\a bgColor must be one the color in \a colors.
|
||||
|
||||
Unlike other image formats that support alpha (e.g. png), GIF does not
|
||||
support semi-transparent pixels. So the alpha channel of the color table
|
||||
will be ignored.
|
||||
*/
|
||||
void QGifImage::setGlobalColorTable(const QVector<QRgb> &colors,
|
||||
const QColor &bgColor) {
|
||||
Q_D(QGifImage);
|
||||
d->globalColorTable = colors;
|
||||
d->bgColor = bgColor;
|
||||
}
|
||||
|
||||
/*!
|
||||
Return the default delay in milliseconds. The default value is 1000 ms.
|
||||
|
||||
The time delay can be different for every frame.
|
||||
*/
|
||||
int QGifImage::defaultDelay() const {
|
||||
Q_D(const QGifImage);
|
||||
return d->defaultDelayTime;
|
||||
}
|
||||
|
||||
/*!
|
||||
Set the default \a delay in milliseconds.
|
||||
*/
|
||||
void QGifImage::setDefaultDelay(int delay) {
|
||||
Q_D(QGifImage);
|
||||
d->defaultDelayTime = delay;
|
||||
}
|
||||
|
||||
/*!
|
||||
Return the default transparent color.
|
||||
|
||||
The transparent color can be different for every frame.
|
||||
*/
|
||||
QColor QGifImage::defaultTransparentColor() const {
|
||||
Q_D(const QGifImage);
|
||||
return d->defaultTransparentColor;
|
||||
}
|
||||
|
||||
/*!
|
||||
Set the default transparent \a color.
|
||||
|
||||
Unlike other image formats that support alpha (e.g. png), GIF does
|
||||
not support semi-transparent pixels. The way to achieve transparency
|
||||
is to set a color that will be transparent when rendering the GIF.
|
||||
So, if you set the transparent color to black, the black pixels in
|
||||
the gif file will be transparent.
|
||||
*/
|
||||
void QGifImage::setDefaultTransparentColor(const QColor &color) {
|
||||
Q_D(QGifImage);
|
||||
d->defaultTransparentColor = color;
|
||||
}
|
||||
|
||||
/*!
|
||||
Return the loop count.
|
||||
*/
|
||||
int QGifImage::loopCount() const {
|
||||
Q_D(const QGifImage);
|
||||
return d->loopCount;
|
||||
}
|
||||
|
||||
/*!
|
||||
Set the loop count. The default value of \a loop is 0, which means loop
|
||||
forever.
|
||||
*/
|
||||
void QGifImage::setLoopCount(int loop) {
|
||||
Q_D(QGifImage);
|
||||
d->loopCount = loop;
|
||||
}
|
||||
|
||||
/*!
|
||||
Insert the QImage object \a frame at position \a index with \a delay.
|
||||
|
||||
As gif file only support indexed image, so all the \a frame will be
|
||||
converted to the QImage::Format_Indexed8 format. Global color table will be
|
||||
used in the convertion if it has been set.
|
||||
|
||||
QImage::offset() will be used when insert the QImage to the gif canvas.
|
||||
*/
|
||||
void QGifImage::insertFrame(int index, const QImage &frame, int delay) {
|
||||
Q_D(QGifImage);
|
||||
|
||||
QGifFrameInfoData data;
|
||||
data.image = frame;
|
||||
data.delayTime = delay;
|
||||
data.offset = frame.offset();
|
||||
|
||||
d->frameInfos.insert(index, data);
|
||||
}
|
||||
|
||||
/*!
|
||||
\overload
|
||||
|
||||
Insert the QImage object \a frame at position \a index with the given \a
|
||||
offset and \a delay.
|
||||
|
||||
As gif file only support indexed image, so all the \a frame will be
|
||||
converted to the QImage::Format_Indexed8 format. Global color table will be
|
||||
used in the convertion if it has been set.
|
||||
*/
|
||||
void QGifImage::insertFrame(int index, const QImage &frame,
|
||||
const QPoint &offset, int delay) {
|
||||
Q_D(QGifImage);
|
||||
QGifFrameInfoData data;
|
||||
data.image = frame;
|
||||
data.delayTime = delay;
|
||||
data.offset = offset;
|
||||
|
||||
d->frameInfos.insert(index, data);
|
||||
}
|
||||
|
||||
/*!
|
||||
Append the QImage object \a frame with \a delay.
|
||||
|
||||
As gif file only support indexed image, so all the \a frame will be
|
||||
converted to the QImage::Format_Indexed8 format. Global color table will be
|
||||
used in the convertion if it has been set.
|
||||
|
||||
QImage::offset() will be used when insert the QImage to the gif canvas.
|
||||
*/
|
||||
void QGifImage::addFrame(const QImage &frame, int delay) {
|
||||
Q_D(QGifImage);
|
||||
|
||||
QGifFrameInfoData data;
|
||||
data.image = frame;
|
||||
data.delayTime = delay;
|
||||
data.offset = frame.offset();
|
||||
|
||||
d->frameInfos.append(data);
|
||||
}
|
||||
|
||||
/*!
|
||||
\overload
|
||||
Append the QImage object \a frame with the given \a offset and \a delay.
|
||||
*/
|
||||
void QGifImage::addFrame(const QImage &frame, const QPoint &offset, int delay) {
|
||||
Q_D(QGifImage);
|
||||
|
||||
QGifFrameInfoData data;
|
||||
data.image = frame;
|
||||
data.delayTime = delay;
|
||||
data.offset = offset;
|
||||
|
||||
d->frameInfos.append(data);
|
||||
}
|
||||
|
||||
/*!
|
||||
Return frame count contained in the gif file.
|
||||
*/
|
||||
int QGifImage::frameCount() const {
|
||||
Q_D(const QGifImage);
|
||||
return d->frameInfos.count();
|
||||
}
|
||||
|
||||
/*!
|
||||
Return the image at \a index.
|
||||
*/
|
||||
QImage QGifImage::frame(int index) const {
|
||||
Q_D(const QGifImage);
|
||||
if (index < 0 || index >= d->frameInfos.size())
|
||||
return QImage();
|
||||
|
||||
return d->frameInfos[index].image;
|
||||
}
|
||||
|
||||
/*!
|
||||
Return the offset value of the frame at \a index
|
||||
*/
|
||||
QPoint QGifImage::frameOffset(int index) const {
|
||||
Q_D(const QGifImage);
|
||||
if (index < 0 || index >= d->frameInfos.size())
|
||||
return QPoint();
|
||||
|
||||
return d->frameInfos[index].offset;
|
||||
}
|
||||
|
||||
/*!
|
||||
Set the \a offset value for the frame at \a index
|
||||
*/
|
||||
void QGifImage::setFrameOffset(int index, const QPoint &offset) {
|
||||
Q_D(QGifImage);
|
||||
if (index < 0 || index >= d->frameInfos.size())
|
||||
return;
|
||||
d->frameInfos[index].offset = offset;
|
||||
}
|
||||
|
||||
/*!
|
||||
Return the delay value of the frame at \a index
|
||||
*/
|
||||
int QGifImage::frameDelay(int index) const {
|
||||
Q_D(const QGifImage);
|
||||
if (index < 0 || index >= d->frameInfos.size())
|
||||
return -1;
|
||||
|
||||
return d->frameInfos[index].delayTime;
|
||||
}
|
||||
|
||||
/*!
|
||||
Set the \a delay value for the frame at \a index
|
||||
*/
|
||||
void QGifImage::setFrameDelay(int index, int delay) {
|
||||
Q_D(QGifImage);
|
||||
if (index < 0 || index >= d->frameInfos.size())
|
||||
return;
|
||||
d->frameInfos[index].delayTime = delay;
|
||||
}
|
||||
|
||||
/*!
|
||||
Return the transparent color of the frame at \a index
|
||||
*/
|
||||
QColor QGifImage::frameTransparentColor(int index) const {
|
||||
Q_D(const QGifImage);
|
||||
if (index < 0 || index >= d->frameInfos.size())
|
||||
return QColor();
|
||||
|
||||
return d->frameInfos[index].transparentColor;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the transparent \a color of the frame \a index. Unlike other image
|
||||
formats that support alpha (e.g. PNG), GIF does not support semi-transparent
|
||||
pixels. The way to achieve transparency is to set a color that will be
|
||||
transparent when rendering the GIF. So, if you set the transparent color to
|
||||
black, the black pixels in your gif file will be transparent.
|
||||
*/
|
||||
void QGifImage::setFrameTransparentColor(int index, const QColor &color) {
|
||||
Q_D(QGifImage);
|
||||
if (index < 0 || index >= d->frameInfos.size())
|
||||
return;
|
||||
d->frameInfos[index].transparentColor = color;
|
||||
}
|
||||
|
||||
/*!
|
||||
Saves the gif image to the file with the given \a fileName.
|
||||
\a flags specifies the conversion method when image data transfered
|
||||
to file.
|
||||
Returns \c true if the image was successfully saved; otherwise
|
||||
returns \c false.
|
||||
\sa {Image Formats}{Image Formats}
|
||||
*/
|
||||
bool QGifImage::save(const QString &fileName,
|
||||
Qt::ImageConversionFlags flags) const {
|
||||
Q_D(const QGifImage);
|
||||
QFile file(fileName);
|
||||
if (file.open(QIODevice::WriteOnly))
|
||||
return d->save(&file, flags);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int QGifImage::getLastError() { return _lasterr; }
|
||||
|
||||
void QGifImage::removeFrame(int index) {
|
||||
Q_D(QGifImage);
|
||||
d->frameInfos.removeAt(index);
|
||||
}
|
||||
|
||||
void QGifImage::reverse() {
|
||||
Q_D(QGifImage);
|
||||
auto &l = d->frameInfos;
|
||||
std::reverse(l.begin(), l.end());
|
||||
}
|
||||
|
||||
void QGifImage::flip(FlipDirection dir) {
|
||||
Q_D(QGifImage);
|
||||
d->canvasSize = d->canvasSize.transposed();
|
||||
for (auto &item : d->frameInfos) {
|
||||
auto &img = item.image;
|
||||
switch (dir) {
|
||||
case FlipDirection::Horizontal:
|
||||
img = img.mirrored();
|
||||
break;
|
||||
case FlipDirection::Vertical:
|
||||
img = img.mirrored(false, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QGifImage::rotate(bool clockwise) {
|
||||
Q_D(QGifImage);
|
||||
d->canvasSize = d->canvasSize.transposed();
|
||||
QTransform trans;
|
||||
trans.rotate(clockwise ? 90.0 : -90.0);
|
||||
for (auto &item : d->frameInfos) {
|
||||
auto &img = item.image;
|
||||
img = img.transformed(trans);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\overload
|
||||
|
||||
This function writes a QImage to the given \a device.
|
||||
*/
|
||||
bool QGifImage::save(QIODevice *device) const {
|
||||
Q_D(const QGifImage);
|
||||
if (device->openMode() | QIODevice::WriteOnly)
|
||||
return d->save(device);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
Loads an gif image from the file with the given \a fileName. Returns \c true
|
||||
if the image was successfully loaded; otherwise invalidates the image and
|
||||
returns \c false.
|
||||
*/
|
||||
bool QGifImage::load(const QString &fileName) {
|
||||
Q_D(QGifImage);
|
||||
QFile file(fileName);
|
||||
if (file.open(QIODevice::ReadOnly))
|
||||
return d->load(&file);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
\overload
|
||||
|
||||
This function reads a gif image from the given \a device. This can,
|
||||
for example, be used to load an image directly into a QByteArray.
|
||||
*/
|
||||
bool QGifImage::load(QIODevice *device) {
|
||||
Q_D(QGifImage);
|
||||
if (device->openMode() | QIODevice::ReadOnly)
|
||||
return d->load(device);
|
||||
|
||||
return false;
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
/****************************************************************************
|
||||
** Copyright (c) 2013 Debao Zhang <hello@debao.me>
|
||||
** All right reserved.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QGIFIMAGE_H
|
||||
#define QGIFIMAGE_H
|
||||
|
||||
#include "qgifglobal.h"
|
||||
#include <QColor>
|
||||
#include <QImage>
|
||||
#include <QList>
|
||||
#include <QVector>
|
||||
|
||||
enum class FlipDirection { Horizontal, Vertical };
|
||||
|
||||
class QGifImagePrivate;
|
||||
class Q_GIFIMAGE_EXPORT QGifImage {
|
||||
Q_DECLARE_PRIVATE(QGifImage)
|
||||
public:
|
||||
QGifImage();
|
||||
QGifImage(const QString &fileName);
|
||||
QGifImage(const QSize &size);
|
||||
~QGifImage();
|
||||
|
||||
QVector<QRgb> globalColorTable() const;
|
||||
QColor backgroundColor() const;
|
||||
void setGlobalColorTable(const QVector<QRgb> &colors,
|
||||
const QColor &bgColor = QColor());
|
||||
int defaultDelay() const;
|
||||
void setDefaultDelay(int internal);
|
||||
QColor defaultTransparentColor() const;
|
||||
void setDefaultTransparentColor(const QColor &color);
|
||||
|
||||
int loopCount() const;
|
||||
void setLoopCount(int loop);
|
||||
|
||||
int frameCount() const;
|
||||
QImage frame(int index) const;
|
||||
|
||||
void addFrame(const QImage &frame, int delay = -1);
|
||||
void addFrame(const QImage &frame, const QPoint &offset, int delay = -1);
|
||||
void insertFrame(int index, const QImage &frame, int delay = -1);
|
||||
void insertFrame(int index, const QImage &frame, const QPoint &offset,
|
||||
int delay = -1);
|
||||
|
||||
QPoint frameOffset(int index) const;
|
||||
void setFrameOffset(int index, const QPoint &offset);
|
||||
int frameDelay(int index) const;
|
||||
void setFrameDelay(int index, int delay);
|
||||
QColor frameTransparentColor(int index) const;
|
||||
void setFrameTransparentColor(int index, const QColor &color);
|
||||
|
||||
bool load(QIODevice *device);
|
||||
bool load(const QString &fileName);
|
||||
bool save(QIODevice *device) const;
|
||||
bool save(const QString &fileName,
|
||||
Qt::ImageConversionFlags flags = Qt::AutoColor) const;
|
||||
|
||||
//================================
|
||||
// extended by wingsummer
|
||||
|
||||
public:
|
||||
int getLastError(); //获取最后一个错误号
|
||||
void removeFrame(int index); //删除帧
|
||||
void reverse(); //反转帧
|
||||
void flip(FlipDirection dir); //反转帧图像
|
||||
void rotate(bool clockwise = true); //旋转90度图像,默认为顺时针
|
||||
|
||||
private:
|
||||
int _lasterr;
|
||||
//================================
|
||||
|
||||
private:
|
||||
QGifImagePrivate *const d_ptr;
|
||||
};
|
||||
|
||||
#endif // QGIFIMAGE_H
|
|
@ -0,0 +1,72 @@
|
|||
/****************************************************************************
|
||||
** Copyright (c) 2013 Debao Zhang <hello@debao.me>
|
||||
** All right reserved.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QGIFIMAGE_P_H
|
||||
#define QGIFIMAGE_P_H
|
||||
|
||||
#include "qgifimage.h"
|
||||
|
||||
#include "gif_lib.h"
|
||||
|
||||
#include <QColor>
|
||||
#include <QVector>
|
||||
|
||||
class QGifFrameInfoData {
|
||||
public:
|
||||
QGifFrameInfoData() : delayTime(-1), interlace(false) {}
|
||||
QImage image;
|
||||
QPoint offset; // offset info of QImage will lost when convert from One format
|
||||
// to another.
|
||||
int delayTime;
|
||||
bool interlace;
|
||||
QColor transparentColor;
|
||||
};
|
||||
|
||||
class QGifImagePrivate {
|
||||
Q_DECLARE_PUBLIC(QGifImage)
|
||||
public:
|
||||
QGifImagePrivate(QGifImage *p);
|
||||
~QGifImagePrivate();
|
||||
bool load(QIODevice *device);
|
||||
bool save(QIODevice *device,
|
||||
Qt::ImageConversionFlags flags = Qt::AutoColor) const;
|
||||
QVector<QRgb> colorTableFromColorMapObject(ColorMapObject *object,
|
||||
int transColorIndex = -1) const;
|
||||
ColorMapObject *colorTableToColorMapObject(QVector<QRgb> colorTable) const;
|
||||
QSize getCanvasSize() const;
|
||||
int getFrameTransparentColorIndex(const QGifFrameInfoData &info) const;
|
||||
|
||||
QSize canvasSize;
|
||||
int loopCount;
|
||||
int defaultDelayTime;
|
||||
QColor defaultTransparentColor;
|
||||
|
||||
QVector<QRgb> globalColorTable;
|
||||
QColor bgColor;
|
||||
QList<QGifFrameInfoData> frameInfos;
|
||||
|
||||
QGifImage *q_ptr;
|
||||
};
|
||||
|
||||
#endif // QGIFIMAGE_P_H
|
|
@ -0,0 +1,15 @@
|
|||
INCLUDEPATH += $$PWD
|
||||
DEPENDPATH += $$PWD
|
||||
|
||||
QT += core gui
|
||||
!build_gifimage_lib:DEFINES += GIFIMAGE_NO_LIB
|
||||
|
||||
include($$PWD/../3rdParty/giflib.pri)
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/qgifglobal.h \
|
||||
$$PWD/qgifimage.h \
|
||||
$$PWD/qgifimage_p.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/qgifimage.cpp
|
|
@ -0,0 +1,73 @@
|
|||
<h1 align="center"> WingSummer.WingGifEditor</h1>
|
||||
|
||||
<p align="center">
|
||||
<img alt="PEHexExplorer" src="images/icon.png">
|
||||
<p align="center">羽云 GIF 编辑器</p>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img alt="作者" src="authorband.svg">
|
||||
<img alt="开源协议" src="licenseband.svg">
|
||||
</p>
|
||||
|
||||
- 开源不易,给个 Star 或者 [捐助](#捐助) 吧
|
||||
|
||||
|
||||
## WingGifEditor
|
||||
|
||||
  本软件是基于 QT 编写的 GIF 编辑器,采用 C++ 进行开发,目的是让 Deepin 上具有简单易用的 GIF 编辑器。`Windows`上有一个十分强大都既是 GIF 录屏工具又是强大 GIF 编辑器`ScreenToGif`。但 Linux 上只有强大的 GIF 录屏工具,但没有简单好用满足基本编辑需求的 GIF 编辑器。于是乎,我给开发了一个简易的 GIF 编辑器,它具有基本的编辑功能,简单方便。
|
||||
|
||||
  有关本软件提建议的时候不要天马行空,本软件的定位是提供简单易用满足基本需求的 GIF 编辑器,并不是像`ScreenToGif`,一是没有相关基础知识,自己一个人搞不动;二是没必要,我不想把这个软件搞个大而全,配合`Gimp`等优秀的图像编辑器作为辅助,来编辑 GIF 图像绰绰有余了。
|
||||
|
||||
### 软件架构
|
||||
|
||||
  本软件基于`QtGifImage`,它是解析编码 GIF 的基础库,是`jiangcaiyang`同志维护的一个`QtGifImage`分支,仓库 [传送门](https://github.com/jiangcaiyang/QtGifImage) 。
|
||||
|
||||
### 参与贡献
|
||||
|
||||
1. 如果您有想参与本软件代码开发递交,请在 pull request 联系我。
|
||||
2. 本项目支持捐助,如有意愿请到本仓库通过微信或者支付宝的方式进行,一瓶水的价钱足以提高我的维护该项目的热情,感谢大家的支持。
|
||||
3. 如果您想提交修复或者增进程序的代码,请在 pull request 递交。
|
||||
4. 任何成功参与代码 Bug 修复以及增进程序功能的同志和 Sponsor ,都会在本仓库 ReadMe 和附属说明文件中体现,您如果是其中之一,本人可以按照您合理的意愿来进行说明。
|
||||
|
||||
|
||||
**加入我们并不意味着就是代码的维护,你可以选择下列一项或多项进行参与:**
|
||||
|
||||
1. 代码维护:实现新功能或修复 BUG ,对代码进行维护和升级。
|
||||
2. 文档编辑:主要是接口文档和教程需要撰写编辑,这很重要。
|
||||
3. 参与讨论:主要是讨论本项目未来发展和方向等。
|
||||
4. 编写插件:一起增强该软件的功能。
|
||||
|
||||
### 协议
|
||||
|
||||
  本软件仓库遵循`AGPL-3.0`协议,不得将本软件用于协议之外的用途。
|
||||
|
||||
## 效果图
|
||||
|
||||
<p align="center">
|
||||
<img alt="效果图" src="">
|
||||
<p align="center">羽云 GIF 编辑器</p>
|
||||
</p>
|
||||
|
||||
## 捐助
|
||||
|
||||
**<p align="center">您的每一份支持都将是本项目推进的强大动力,十分感谢您的支持</p>**
|
||||
|
||||
<p align="center">
|
||||
|
||||
<img alt="支付宝" src="支付宝捐助.jpg" height=50% width=50%>
|
||||
<p align="center">感谢支持</p>
|
||||
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img alt="微信" src="微信捐助.png" height=50% width=50%>
|
||||
<p align="center">感谢支持</p>
|
||||
|
||||
</p>
|
||||
|
||||
## 有关仓库
|
||||
|
||||
## WIKI
|
||||
|
||||
## 应用商店
|
|
@ -0,0 +1,18 @@
|
|||
QT += core gui dtkwidget
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
include($$PWD/QtGifImage/gifimage/qtgifimage.pri)
|
||||
|
||||
TARGET = WingGifEditor
|
||||
TEMPLATE = app
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
gifeditorscene.cpp
|
||||
|
||||
RESOURCES += resources.qrc
|
||||
|
||||
HEADERS += mainwindow.h \
|
||||
gifeditorscene.h
|
|
@ -0,0 +1,326 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.8.2, 2022-07-24T12:55:37. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{53169195-bb7e-419d-918f-e1c72f0d9f93}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
<value type="int">0</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
||||
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
|
||||
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
||||
<value type="QString" key="language">Cpp</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
|
||||
<value type="QString" key="language">QmlJS</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
|
||||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
||||
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
||||
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
|
||||
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
||||
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
|
||||
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
||||
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
||||
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
||||
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
||||
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
||||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
||||
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey"/>
|
||||
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">桌面</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">桌面</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{9b22cfeb-9c98-4637-a559-7b87025ecbb7}</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/wingsummer/QT Project/build-WingGifEditor-unknown-Debug</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/wingsummer/QT Project/build-WingGifEditor-unknown-Release</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/wingsummer/QT Project/build-WingGifEditor-unknown-Profile</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">部署</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy Configuration</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
||||
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
|
||||
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
||||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
||||
<value type="int">0</value>
|
||||
<value type="int">1</value>
|
||||
<value type="int">2</value>
|
||||
<value type="int">3</value>
|
||||
<value type="int">4</value>
|
||||
<value type="int">5</value>
|
||||
<value type="int">6</value>
|
||||
<value type="int">7</value>
|
||||
<value type="int">8</value>
|
||||
<value type="int">9</value>
|
||||
<value type="int">10</value>
|
||||
<value type="int">11</value>
|
||||
<value type="int">12</value>
|
||||
<value type="int">13</value>
|
||||
<value type="int">14</value>
|
||||
</valuelist>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">WingGifEditor</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/wingsummer/QT Project/WingGifEditor/WingGifEditor.pro</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">WingGifEditor.pro</value>
|
||||
<value type="QString" key="RunConfiguration.Arguments"></value>
|
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||
<value type="int">1</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||
<value type="int">20</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Version</variable>
|
||||
<value type="int">20</value>
|
||||
</data>
|
||||
</qtcreator>
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="130" height="20" role="img" aria-label="Author: Wingsummer"><title>Author: Wingsummer</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="130" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="47" height="20" fill="#555"/><rect x="47" width="83" height="20" fill="#97ca00"/><rect width="130" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="245" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="370">Author</text><text x="245" y="140" transform="scale(.1)" fill="#fff" textLength="370">Author</text><text aria-hidden="true" x="875" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="730">Wingsummer</text><text x="875" y="140" transform="scale(.1)" fill="#fff" textLength="730">Wingsummer</text></g></svg>
|
After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1,18 @@
|
|||
#include "gifeditorscene.h"
|
||||
#include <QGraphicsView>
|
||||
|
||||
GifEditorScene::GifEditorScene(QObject *parent) : QGraphicsScene(parent) {}
|
||||
|
||||
void GifEditorScene::setBackgroundImage(QImage img) {
|
||||
m_back = QPixmap::fromImage(img);
|
||||
}
|
||||
|
||||
void GifEditorScene::drawBackground(QPainter *painter, const QRectF &rect) {
|
||||
Q_UNUSED(rect)
|
||||
if (views().count() == 0)
|
||||
return;
|
||||
QGraphicsView *pView = views().first();
|
||||
QRect contentRect = pView->viewport()->contentsRect();
|
||||
QRectF sceneRect = pView->mapToScene(contentRect).boundingRect();
|
||||
painter->drawPixmap(sceneRect, m_back, QRect());
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef GIFEDITOR_H
|
||||
#define GIFEDITOR_H
|
||||
|
||||
#include <QGraphicsScene>
|
||||
|
||||
class GifEditorScene : public QGraphicsScene {
|
||||
Q_OBJECT
|
||||
public:
|
||||
GifEditorScene(QObject *parent = nullptr);
|
||||
|
||||
void setBackgroundImage(QImage img);
|
||||
|
||||
protected:
|
||||
void drawBackground(QPainter *painter, const QRectF &rect) override;
|
||||
|
||||
QPixmap m_back;
|
||||
};
|
||||
|
||||
#endif // GIFEDITOR_H
|
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.7 KiB |
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="112" height="20" role="img" aria-label="License: AGPL-3.0"><title>License: AGPL-3.0</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="112" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="51" height="20" fill="#555"/><rect x="51" width="61" height="20" fill="#e05d44"/><rect width="112" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="265" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="410">License</text><text x="265" y="140" transform="scale(.1)" fill="#fff" textLength="410">License</text><text aria-hidden="true" x="805" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">AGPL-3.0</text><text x="805" y="140" transform="scale(.1)" fill="#fff" textLength="510">AGPL-3.0</text></g></svg>
|
After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1,31 @@
|
|||
#include "mainwindow.h"
|
||||
#include <DApplication>
|
||||
#include <DApplicationSettings>
|
||||
#include <DTitlebar>
|
||||
#include <DWidgetUtil>
|
||||
|
||||
DWIDGET_USE_NAMESPACE
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
DApplication a(argc, argv);
|
||||
a.setOrganizationName("WingCloud");
|
||||
a.setApplicationName("WingGifEditor");
|
||||
a.setApplicationVersion("1.0");
|
||||
a.setProductIcon(QIcon(":/images/icon.png"));
|
||||
a.setProductName(QObject::tr("WingGifEditor"));
|
||||
a.setApplicationDescription(
|
||||
QObject::tr("A tiny easy2use gif editor for Deepin"));
|
||||
|
||||
a.loadTranslator();
|
||||
a.setApplicationDisplayName(QObject::tr("WingGifEditor"));
|
||||
|
||||
// 保存程序的窗口主题设置
|
||||
DApplicationSettings as;
|
||||
Q_UNUSED(as)
|
||||
|
||||
MainWindow w;
|
||||
w.show();
|
||||
Dtk::Widget::moveToCenter(&w);
|
||||
return a.exec();
|
||||
}
|
|
@ -0,0 +1,471 @@
|
|||
#include "mainwindow.h"
|
||||
#include <DMenu>
|
||||
#include <DMessageManager>
|
||||
#include <DTitlebar>
|
||||
#include <DToolBar>
|
||||
#include <QFileDialog>
|
||||
#include <QListWidgetItem>
|
||||
#include <QShortcut>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
#define ICONRES(name) QIcon(":/images/" name ".png")
|
||||
|
||||
MainWindow::MainWindow(DMainWindow *parent) : DMainWindow(parent) {
|
||||
setMinimumSize(600, 500);
|
||||
setWindowTitle(tr("WingGifEditor"));
|
||||
setWindowIcon(ICONRES("icon"));
|
||||
auto w = new QWidget(this);
|
||||
setCentralWidget(w);
|
||||
auto vlayout = new QVBoxLayout(w);
|
||||
editor = new DGraphicsView(w);
|
||||
|
||||
vlayout->addWidget(editor);
|
||||
imglist = new QListWidget(w);
|
||||
imglist->setFlow(QListWidget::TopToBottom);
|
||||
imglist->setViewMode(QListWidget::IconMode);
|
||||
imglist->setSelectionMode(
|
||||
QAbstractItemView::SelectionMode::ExtendedSelection);
|
||||
imglist->setIconSize(QSize(100, 100));
|
||||
imglist->setFixedHeight(120);
|
||||
imglist->setLayoutDirection(Qt::LayoutDirection::LeftToRight);
|
||||
imglist->setResizeMode(QListView::Adjust);
|
||||
vlayout->addWidget(imglist);
|
||||
|
||||
connect(imglist, &QListWidget::itemSelectionChanged, this, [=] {
|
||||
auto scene = new QGraphicsScene(editor);
|
||||
scene->addPixmap(QPixmap::fromImage(gif.frame(imglist->currentRow())));
|
||||
editor->setScene(scene);
|
||||
});
|
||||
|
||||
auto title = titlebar();
|
||||
title->setIcon(QIcon()); // TODO
|
||||
title->setTitle(tr("WingGifEditor"));
|
||||
|
||||
auto menu = new DMenu(this);
|
||||
QAction *a;
|
||||
|
||||
auto keyselrev =
|
||||
QKeySequence(Qt::KeyboardModifier::ControlModifier | Qt::Key_I);
|
||||
auto keygoto =
|
||||
QKeySequence(Qt::KeyboardModifier::ControlModifier | Qt::Key_G);
|
||||
auto keybeginframe = QKeySequence(Qt::Key_Home);
|
||||
auto keylastframe = QKeySequence(Qt::Key_Left);
|
||||
auto keynextframe = QKeySequence(Qt::Key_Right);
|
||||
auto keyendframe = QKeySequence(Qt::Key_End);
|
||||
auto keyplay = QKeySequence(Qt::Key_F5);
|
||||
auto keypause = QKeySequence(Qt::Key_F10);
|
||||
auto keyreduceframe =
|
||||
QKeySequence(Qt::KeyboardModifier::ControlModifier | Qt::Key_D);
|
||||
auto keyrmleft =
|
||||
QKeySequence(Qt::KeyboardModifier::ControlModifier | Qt::Key_J);
|
||||
auto keyrmright =
|
||||
QKeySequence(Qt::KeyboardModifier::ControlModifier | Qt::Key_K);
|
||||
auto keyrev = QKeySequence(Qt::KeyboardModifier::ControlModifier |
|
||||
Qt::KeyboardModifier::ShiftModifier | Qt::Key_I);
|
||||
auto keymvl =
|
||||
QKeySequence(Qt::KeyboardModifier::ControlModifier | Qt::Key_BracketLeft);
|
||||
auto keymvr = QKeySequence(Qt::KeyboardModifier::ControlModifier |
|
||||
Qt::Key_BracketRight);
|
||||
auto keysetdelay =
|
||||
QKeySequence(Qt::KeyboardModifier::ControlModifier | Qt::Key_T);
|
||||
auto keyscaledelay =
|
||||
QKeySequence(Qt::KeyboardModifier::ControlModifier |
|
||||
Qt::KeyboardModifier::ShiftModifier | Qt::Key_T);
|
||||
|
||||
#define AddMenuIconAction(Icon, Title, Slot, Owner) \
|
||||
a = new QAction(Owner); \
|
||||
a->setText(Title); \
|
||||
a->setIcon(ICONRES(Icon)); \
|
||||
connect(a, &QAction::triggered, this, &Slot); \
|
||||
Owner->addAction(a);
|
||||
|
||||
#define AddMenuAction(Title, Slot, Owner) \
|
||||
a = new QAction(Owner); \
|
||||
a->setText(Title); \
|
||||
connect(a, &QAction::triggered, this, &Slot); \
|
||||
Owner->addAction(a);
|
||||
|
||||
#define AddMenuShortcutAction(Icon, Title, Slot, Owner, ShortCut) \
|
||||
AddMenuIconAction(Icon, Title, Slot, Owner); \
|
||||
a->setShortcut(ShortCut); \
|
||||
a->setShortcutVisibleInContextMenu(true);
|
||||
|
||||
#define AddToolSubMenuShortcutAction(Icon, Title, Slot, ShortCut) \
|
||||
AddMenuShortcutAction(Icon, Title, Slot, tm, ShortCut)
|
||||
|
||||
auto tm = new QMenu(this);
|
||||
tm->setIcon(ICONRES("file"));
|
||||
tm->setTitle(tr("File"));
|
||||
|
||||
auto m = new QMenu(this);
|
||||
m->setIcon(ICONRES("new"));
|
||||
m->setTitle(tr("New"));
|
||||
AddMenuIconAction("pics", tr("NewFromPics"), MainWindow::on_new_frompics, m);
|
||||
AddMenuIconAction("gifs", tr("NewFromGifs"), MainWindow::on_new_fromgifs, m);
|
||||
tm->addMenu(m);
|
||||
|
||||
AddMenuShortcutAction("open", tr("Open"), MainWindow::on_open, tm,
|
||||
QKeySequence::Open);
|
||||
AddMenuShortcutAction("save", tr("Save"), MainWindow::on_save, tm,
|
||||
QKeySequence::Save);
|
||||
AddMenuShortcutAction("saveas", tr("SaveAs"), MainWindow::on_saveas, tm,
|
||||
QKeySequence::SaveAs);
|
||||
tm->addSeparator();
|
||||
AddMenuShortcutAction("close", tr("Close"), MainWindow::on_exit, tm,
|
||||
QKeySequence::Close);
|
||||
|
||||
menu->addMenu(tm);
|
||||
|
||||
tm = new QMenu(this);
|
||||
tm->setTitle(tr("Edit"));
|
||||
tm->setIcon(ICONRES("edit"));
|
||||
AddMenuShortcutAction("undo", tr("Undo"), MainWindow::on_undo, tm,
|
||||
QKeySequence::Undo);
|
||||
AddMenuShortcutAction("redo", tr("Redo"), MainWindow::on_redo, tm,
|
||||
QKeySequence::Redo);
|
||||
tm->addSeparator();
|
||||
AddMenuShortcutAction("cut", tr("Cut"), MainWindow::on_cut, tm,
|
||||
QKeySequence::Cut);
|
||||
AddMenuShortcutAction("copy", tr("Copy"), MainWindow::on_copy, tm,
|
||||
QKeySequence::Copy);
|
||||
AddMenuShortcutAction("paste", tr("Paste"), MainWindow::on_paste, tm,
|
||||
QKeySequence::Paste);
|
||||
AddMenuShortcutAction("del", tr("Delete"), MainWindow::on_del, tm,
|
||||
QKeySequence::Delete);
|
||||
tm->addSeparator();
|
||||
AddMenuShortcutAction("selall", tr("SelectAll"), MainWindow::on_selall, tm,
|
||||
QKeySequence::SelectAll);
|
||||
AddMenuShortcutAction("desel", tr("Deselect"), MainWindow::on_desel, tm,
|
||||
QKeySequence::Deselect);
|
||||
AddMenuShortcutAction("selrev", tr("ReverseSelection"),
|
||||
MainWindow::on_selreverse, tm, keyselrev);
|
||||
tm->addSeparator();
|
||||
AddMenuShortcutAction("jmp", tr("Goto"), MainWindow::on_goto, tm, keygoto);
|
||||
menu->addMenu(tm);
|
||||
|
||||
tm = new QMenu(this);
|
||||
tm->setIcon(ICONRES("play"));
|
||||
tm->setTitle(tr("Play"));
|
||||
AddMenuShortcutAction("first", tr("FirstFrame"), MainWindow::on_beginframe,
|
||||
tm, keybeginframe);
|
||||
AddMenuShortcutAction("back", tr("LastFrame"), MainWindow::on_last, tm,
|
||||
keylastframe);
|
||||
AddMenuShortcutAction("gifplay", tr("Play"), MainWindow::on_play, tm,
|
||||
keyplay);
|
||||
AddMenuShortcutAction("pause", tr("Stop"), MainWindow::on_stop, tm, keypause);
|
||||
AddMenuShortcutAction("foreword", tr("NextFrame"), MainWindow::on_next, tm,
|
||||
keynextframe);
|
||||
AddMenuShortcutAction("last", tr("EndFrame"), MainWindow::on_last, tm,
|
||||
keylastframe);
|
||||
title->setMenu(menu);
|
||||
|
||||
tm = new QMenu(this);
|
||||
tm->setIcon(ICONRES("pic"));
|
||||
tm->setTitle(tr("Picture"));
|
||||
AddMenuShortcutAction("rmframe", tr("ReduceFrame"),
|
||||
MainWindow::on_decreaseframe, tm, keyreduceframe);
|
||||
AddMenuShortcutAction("rml", tr("DeleteBefore"), MainWindow::on_delbefore, tm,
|
||||
keyrmleft);
|
||||
AddMenuShortcutAction("rmr", tr("DeleteAfter"), MainWindow::on_delafter, tm,
|
||||
keyrmright);
|
||||
tm->addSeparator();
|
||||
AddMenuShortcutAction("mvf", tr("MoveLeft"), MainWindow::on_moveleft, tm,
|
||||
keymvl);
|
||||
AddMenuShortcutAction("mvb", tr("MoveRight"), MainWindow::on_moveright, tm,
|
||||
keymvr);
|
||||
AddMenuShortcutAction("reverse", tr("Reverse"), MainWindow::on_reverse, tm,
|
||||
keyrev);
|
||||
AddMenuAction(tr("CreateReverse"), MainWindow::on_createreverse, tm);
|
||||
tm->addSeparator();
|
||||
AddMenuShortcutAction("setdelay", tr("SetDelay"), MainWindow::on_setdelay, tm,
|
||||
keysetdelay);
|
||||
AddMenuShortcutAction("scaledelay", tr("ScaleDelay"),
|
||||
MainWindow::on_scaledelay, tm, keyscaledelay);
|
||||
menu->addMenu(tm);
|
||||
|
||||
auto toolbar = new DToolBar(this);
|
||||
|
||||
#define AddToolBarAction(Icon, Owner, Slot, ToolTip) \
|
||||
a = new QAction(Owner); \
|
||||
a->setIcon(ICONRES(Icon)); \
|
||||
connect(a, &QAction::triggered, this, &Slot); \
|
||||
a->setToolTip(ToolTip); \
|
||||
Owner->addAction(a);
|
||||
|
||||
#define AddToolBarTool(Icon, Slot, ToolTip) \
|
||||
AddToolBarAction(Icon, toolbar, Slot, ToolTip)
|
||||
|
||||
AddToolBarTool("open", MainWindow::on_open, tr("Open"));
|
||||
AddToolBarTool("saveas", MainWindow::on_saveas, tr("SaveAs"));
|
||||
AddToolBarTool("del", MainWindow::on_del, tr("Del"));
|
||||
AddToolBarTool("reverse", MainWindow::on_reverse, tr("Reverse"));
|
||||
addToolBar(toolbar);
|
||||
|
||||
status = new DStatusBar(this);
|
||||
setStatusBar(status);
|
||||
}
|
||||
|
||||
void MainWindow::refreshImglist() {
|
||||
imglist->clear();
|
||||
for (int i = 0; i < gif.frameCount(); i++) {
|
||||
new QListWidgetItem(QIcon(QPixmap::fromImage(gif.frame(i))),
|
||||
QString("%1 %2 ms").arg(i).arg(gif.frameDelay(i)),
|
||||
imglist);
|
||||
}
|
||||
}
|
||||
|
||||
QString MainWindow::formatErrCode(int err) {
|
||||
switch (err) {
|
||||
case E_GIF_ERR_OPEN_FAILED:
|
||||
return tr("Failed to open given file");
|
||||
case E_GIF_ERR_WRITE_FAILED:
|
||||
return tr("Failed to write to given file");
|
||||
case E_GIF_ERR_HAS_SCRN_DSCR:
|
||||
return tr("Screen descriptor has already been set");
|
||||
case E_GIF_ERR_HAS_IMAG_DSCR:
|
||||
return tr("Image descriptor is still active");
|
||||
case E_GIF_ERR_NO_COLOR_MAP:
|
||||
return tr("Neither global nor local color map");
|
||||
case E_GIF_ERR_DATA_TOO_BIG:
|
||||
return tr("Number of pixels bigger than width * height");
|
||||
case E_GIF_ERR_NOT_ENOUGH_MEM:
|
||||
return tr("Failed to allocate required memory");
|
||||
case E_GIF_ERR_DISK_IS_FULL:
|
||||
return tr("Write failed (disk full?)");
|
||||
break;
|
||||
case E_GIF_ERR_CLOSE_FAILED:
|
||||
return tr("Failed to close given file");
|
||||
case E_GIF_ERR_NOT_WRITEABLE:
|
||||
return tr("Given file was not opened for write");
|
||||
case D_GIF_ERR_OPEN_FAILED:
|
||||
return tr("Failed to open given file");
|
||||
case D_GIF_ERR_READ_FAILED:
|
||||
return tr("Failed to read from given file");
|
||||
case D_GIF_ERR_NOT_GIF_FILE:
|
||||
return tr("Data is not in GIF format");
|
||||
case D_GIF_ERR_NO_SCRN_DSCR:
|
||||
return tr("No screen descriptor detected");
|
||||
case D_GIF_ERR_NO_IMAG_DSCR:
|
||||
return tr("No Image Descriptor detected");
|
||||
case D_GIF_ERR_NO_COLOR_MAP:
|
||||
return tr("Neither global nor local color map");
|
||||
case D_GIF_ERR_WRONG_RECORD:
|
||||
return tr("Wrong record type detected");
|
||||
case D_GIF_ERR_DATA_TOO_BIG:
|
||||
return tr("Number of pixels bigger than width * height");
|
||||
break;
|
||||
case D_GIF_ERR_NOT_ENOUGH_MEM:
|
||||
return tr("Failed to allocate required memory");
|
||||
break;
|
||||
case D_GIF_ERR_CLOSE_FAILED:
|
||||
return tr("Failed to close given file");
|
||||
break;
|
||||
case D_GIF_ERR_NOT_READABLE:
|
||||
return tr("Given file was not opened for read");
|
||||
break;
|
||||
case D_GIF_ERR_IMAGE_DEFECT:
|
||||
return tr("Image is defective, decoding aborted");
|
||||
break;
|
||||
case D_GIF_ERR_EOF_TOO_SOON:
|
||||
return tr("Image EOF detected before image complete");
|
||||
break;
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_new_frompics() {}
|
||||
|
||||
void MainWindow::on_new_fromgifs() {}
|
||||
|
||||
void MainWindow::on_open() {
|
||||
auto filename = QFileDialog::getOpenFileName(this, tr("ChooseFile"),
|
||||
lastusedpath, "Gif (*.gif)");
|
||||
if (filename.isEmpty())
|
||||
return;
|
||||
lastusedpath = QFileInfo(filename).absoluteDir().absolutePath();
|
||||
if (!gif.load(filename)) {
|
||||
DMessageManager::instance()->sendMessage(this, ICONRES("icon"),
|
||||
formatErrCode(gif.getLastError()));
|
||||
return;
|
||||
}
|
||||
curfilename = filename;
|
||||
refreshImglist();
|
||||
imglist->setCurrentRow(0);
|
||||
}
|
||||
|
||||
void MainWindow::on_del() {
|
||||
QList<int> indices;
|
||||
for (auto item : imglist->selectionModel()->selectedIndexes()) {
|
||||
indices.append(item.row());
|
||||
}
|
||||
std::sort(indices.begin(), indices.end());
|
||||
int offset = 0;
|
||||
for (auto item : indices) {
|
||||
gif.removeFrame(item - offset);
|
||||
offset++;
|
||||
}
|
||||
for (auto item : imglist->selectedItems()) {
|
||||
imglist->removeItemWidget(item);
|
||||
delete item;
|
||||
}
|
||||
for (int i = indices.first(); i < imglist->count(); i++) {
|
||||
imglist->item(i)->setText(
|
||||
QString("%1 %2 ms").arg(i).arg(gif.frameDelay(i)));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_selall() { imglist->selectAll(); }
|
||||
|
||||
void MainWindow::on_selreverse() {
|
||||
auto len = imglist->count();
|
||||
for (auto i = 0; i < len; i++) {
|
||||
auto item = imglist->item(i);
|
||||
item->setSelected(!item->isSelected());
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_desel() {
|
||||
auto cur = imglist->currentRow();
|
||||
imglist->setCurrentRow(cur);
|
||||
}
|
||||
|
||||
void MainWindow::on_goto() {}
|
||||
|
||||
void MainWindow::on_beginframe() { imglist->setCurrentRow(0); }
|
||||
|
||||
void MainWindow::on_last() {
|
||||
auto pos = imglist->currentRow();
|
||||
if (pos > 0) {
|
||||
imglist->setCurrentRow(pos - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_play() {}
|
||||
|
||||
void MainWindow::on_stop() {}
|
||||
|
||||
void MainWindow::on_next() {
|
||||
auto pos = imglist->currentRow();
|
||||
auto max = imglist->count();
|
||||
if (pos < max - 1) {
|
||||
imglist->setCurrentRow(pos + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_endframe() { imglist->setCurrentRow(imglist->count() - 1); }
|
||||
|
||||
void MainWindow::on_decreaseframe() {}
|
||||
|
||||
void MainWindow::on_delbefore() {
|
||||
auto len = imglist->currentRow();
|
||||
for (auto i = 0; i < len; i++) {
|
||||
gif.removeFrame(0);
|
||||
auto del = imglist->item(i);
|
||||
imglist->removeItemWidget(del);
|
||||
delete del;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_delafter() {
|
||||
auto len = imglist->count() - imglist->currentRow() - 1;
|
||||
auto pos = imglist->currentRow() + 1;
|
||||
for (auto i = 0; i < len; i++) {
|
||||
gif.removeFrame(pos);
|
||||
auto del = imglist->item(pos);
|
||||
imglist->removeItemWidget(del);
|
||||
delete del;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_saveas() {
|
||||
auto filename = QFileDialog::getSaveFileName(this, tr("ChooseSaveFile"),
|
||||
lastusedpath, "Gif (*.gif)");
|
||||
if (filename.isEmpty())
|
||||
return;
|
||||
lastusedpath = QFileInfo(filename).absoluteDir().absolutePath();
|
||||
if (gif.save(filename)) {
|
||||
DMessageManager::instance()->sendMessage(this, ICONRES("saveas"),
|
||||
tr("SaveAsSuccess"));
|
||||
} else {
|
||||
DMessageManager::instance()->sendMessage(this, ICONRES("saveas"),
|
||||
formatErrCode(gif.getLastError()));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_exit() { close(); }
|
||||
|
||||
void MainWindow::on_undo() {}
|
||||
|
||||
void MainWindow::on_redo() {}
|
||||
|
||||
void MainWindow::on_copy() {}
|
||||
|
||||
void MainWindow::on_cut() {}
|
||||
|
||||
void MainWindow::on_paste() {}
|
||||
|
||||
void MainWindow::on_save() {
|
||||
if (curfilename.isEmpty()) {
|
||||
on_saveas();
|
||||
return;
|
||||
}
|
||||
|
||||
if (gif.save(curfilename)) {
|
||||
DMessageManager::instance()->sendMessage(this, ICONRES("save"),
|
||||
tr("SaveAsSuccess"));
|
||||
} else {
|
||||
DMessageManager::instance()->sendMessage(this, ICONRES("save"),
|
||||
formatErrCode(gif.getLastError()));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_reverse() {
|
||||
gif.reverse();
|
||||
refreshImglist();
|
||||
}
|
||||
|
||||
void MainWindow::on_moveleft() {}
|
||||
|
||||
void MainWindow::on_moveright() {}
|
||||
|
||||
void MainWindow::on_createreverse() {}
|
||||
|
||||
void MainWindow::on_setdelay() {}
|
||||
|
||||
void MainWindow::on_scaledelay() {}
|
||||
|
||||
void MainWindow::on_insertpic() {}
|
||||
|
||||
void MainWindow::on_merge() {}
|
||||
|
||||
void MainWindow::on_scalepic() {}
|
||||
|
||||
void MainWindow::on_cutpic() {}
|
||||
|
||||
void MainWindow::on_fliph() {
|
||||
gif.flip(FlipDirection::Horizontal);
|
||||
refreshImglist();
|
||||
}
|
||||
|
||||
void MainWindow::on_flipv() {
|
||||
gif.flip(FlipDirection::Vertical);
|
||||
refreshImglist();
|
||||
}
|
||||
|
||||
void MainWindow::on_clockwise() {
|
||||
gif.rotate();
|
||||
refreshImglist();
|
||||
}
|
||||
|
||||
void MainWindow::on_anticlockwise() {
|
||||
gif.rotate(false);
|
||||
refreshImglist();
|
||||
}
|
||||
|
||||
void MainWindow::on_about() {}
|
||||
|
||||
void MainWindow::on_sponsor() {}
|
||||
|
||||
void MainWindow::on_wiki() {}
|
|
@ -0,0 +1,109 @@
|
|||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include "QtGifImage/gifimage/qgifimage.h"
|
||||
#include "gifeditorscene.h"
|
||||
#include <DGraphicsView>
|
||||
#include <DLabel>
|
||||
#include <DMainWindow>
|
||||
#include <DStatusBar>
|
||||
#include <QListWidget>
|
||||
|
||||
DWIDGET_USE_NAMESPACE
|
||||
|
||||
enum GifError {
|
||||
E_GIF_ERR_OPEN_FAILED = 1,
|
||||
E_GIF_ERR_WRITE_FAILED,
|
||||
E_GIF_ERR_HAS_SCRN_DSCR,
|
||||
E_GIF_ERR_HAS_IMAG_DSCR,
|
||||
E_GIF_ERR_NO_COLOR_MAP,
|
||||
E_GIF_ERR_DATA_TOO_BIG,
|
||||
E_GIF_ERR_NOT_ENOUGH_MEM,
|
||||
E_GIF_ERR_DISK_IS_FULL,
|
||||
E_GIF_ERR_CLOSE_FAILED,
|
||||
E_GIF_ERR_NOT_WRITEABLE,
|
||||
D_GIF_ERR_OPEN_FAILED = 101,
|
||||
D_GIF_ERR_READ_FAILED,
|
||||
D_GIF_ERR_NOT_GIF_FILE,
|
||||
D_GIF_ERR_NO_SCRN_DSCR,
|
||||
D_GIF_ERR_NO_IMAG_DSCR,
|
||||
D_GIF_ERR_NO_COLOR_MAP,
|
||||
D_GIF_ERR_WRONG_RECORD,
|
||||
D_GIF_ERR_DATA_TOO_BIG,
|
||||
D_GIF_ERR_NOT_ENOUGH_MEM,
|
||||
D_GIF_ERR_CLOSE_FAILED,
|
||||
D_GIF_ERR_NOT_READABLE,
|
||||
D_GIF_ERR_IMAGE_DEFECT,
|
||||
D_GIF_ERR_EOF_TOO_SOON
|
||||
};
|
||||
|
||||
class MainWindow : public DMainWindow {
|
||||
Q_OBJECT
|
||||
public:
|
||||
MainWindow(DMainWindow *parent = nullptr);
|
||||
|
||||
private:
|
||||
void refreshImglist();
|
||||
QString formatErrCode(int err);
|
||||
|
||||
private:
|
||||
void on_new_frompics();
|
||||
void on_new_fromgifs();
|
||||
void on_open();
|
||||
void on_save();
|
||||
void on_saveas();
|
||||
void on_exit();
|
||||
|
||||
void on_undo();
|
||||
void on_redo();
|
||||
void on_copy();
|
||||
void on_cut();
|
||||
void on_paste();
|
||||
void on_del();
|
||||
void on_selall();
|
||||
void on_selreverse();
|
||||
void on_desel();
|
||||
void on_goto();
|
||||
|
||||
void on_beginframe();
|
||||
void on_last();
|
||||
void on_play();
|
||||
void on_stop();
|
||||
void on_next();
|
||||
void on_endframe();
|
||||
|
||||
void on_decreaseframe();
|
||||
void on_delbefore();
|
||||
void on_delafter();
|
||||
void on_reverse();
|
||||
void on_moveleft();
|
||||
void on_moveright();
|
||||
void on_createreverse();
|
||||
void on_setdelay();
|
||||
void on_scaledelay();
|
||||
void on_insertpic();
|
||||
void on_merge();
|
||||
|
||||
void on_scalepic();
|
||||
void on_cutpic();
|
||||
void on_fliph();
|
||||
void on_flipv();
|
||||
void on_clockwise();
|
||||
void on_anticlockwise();
|
||||
void on_applypic();
|
||||
|
||||
void on_about();
|
||||
void on_sponsor();
|
||||
void on_wiki();
|
||||
|
||||
private:
|
||||
DGraphicsView *editor;
|
||||
QListWidget *imglist;
|
||||
DStatusBar *status;
|
||||
QGifImage gif;
|
||||
|
||||
QString lastusedpath;
|
||||
QString curfilename;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
git add .
|
||||
read -p "请输入 Comment: " -r COMMENT
|
||||
git commit -m "$COMMENT"
|
||||
git push -u gitlink "master"
|
||||
git push -u origin "master"
|
|
@ -0,0 +1,49 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>images/open.png</file>
|
||||
<file>images/save.png</file>
|
||||
<file>images/saveas.png</file>
|
||||
<file>images/del.png</file>
|
||||
<file>images/reverse.png</file>
|
||||
<file>images/author.jpg</file>
|
||||
<file>images/author.png</file>
|
||||
<file>images/new.png</file>
|
||||
<file>images/paste.png</file>
|
||||
<file>images/qt.png</file>
|
||||
<file>images/redo.png</file>
|
||||
<file>images/saved.png</file>
|
||||
<file>images/saveg.png</file>
|
||||
<file>images/soft.png</file>
|
||||
<file>images/sponsor.png</file>
|
||||
<file>images/undo.png</file>
|
||||
<file>images/unsaved.png</file>
|
||||
<file>images/wiki.png</file>
|
||||
<file>images/close.png</file>
|
||||
<file>images/file.png</file>
|
||||
<file>images/edit.png</file>
|
||||
<file>images/pics.png</file>
|
||||
<file>images/gifs.png</file>
|
||||
<file>images/copy.png</file>
|
||||
<file>images/cut.png</file>
|
||||
<file>images/desel.png</file>
|
||||
<file>images/selall.png</file>
|
||||
<file>images/selrev.png</file>
|
||||
<file>images/jmp.png</file>
|
||||
<file>images/play.png</file>
|
||||
<file>images/back.png</file>
|
||||
<file>images/first.png</file>
|
||||
<file>images/foreword.png</file>
|
||||
<file>images/gifplay.png</file>
|
||||
<file>images/last.png</file>
|
||||
<file>images/pause.png</file>
|
||||
<file>images/rmframe.png</file>
|
||||
<file>images/rml.png</file>
|
||||
<file>images/rmr.png</file>
|
||||
<file>images/pic.png</file>
|
||||
<file>images/mvb.png</file>
|
||||
<file>images/mvf.png</file>
|
||||
<file>images/setdelay.png</file>
|
||||
<file>images/scaledelay.png</file>
|
||||
<file>images/icon.png</file>
|
||||
</qresource>
|
||||
</RCC>
|