2 Commits

451 changed files with 55314 additions and 0 deletions

6
.gitmodules vendored Normal file
View File

@@ -0,0 +1,6 @@
[submodule "sources/freemint"]
path = sources/freemint
url = https://github.com/freemint/freemint
[submodule "sources/emutos"]
path = sources/emutos
url = https://github.com/emutos/emutos

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
sources/bg_blue/16to10.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

BIN
sources/bg_blue/16to9.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

BIN
sources/bg_blue/4to3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

File diff suppressed because one or more lines are too long

151
sources/bg_blue/readme.txt Normal file
View File

@@ -0,0 +1,151 @@
BG_BLUE_STRUCTURE - Background Images for the FireBee Computer
--------------------------------------------------------------
Introduction
------------
Thank you for downloading the BG_BLUE_STRUCTURE set of background images
for the FireBee computer. The supplied images can be used as background
image in the FreeMiNT/XaAES or the FreeMiNT/MyAES environments. The
following sizes are available: 4x3 (1600x1200), 16x9 (1920x1080), 16x10
(1920x1200), 1024x768, 1280x1024.
Authors
----------
FireBee Logo idea: Friederike Dreyer (& Mathias Wittau)
FireBee Logo artwork: Jean-Pierre Feicht
BG concept & design: Mathias Wittau
The ACP Team
LICENSE: CC BY-NC-SA 4.0
Version: 1.0
Release date: 2015/09/10
DISCLAIMER
----------
This archive is PROVIDED AS IT IS, and the authors DISCLAIM ALL
RESPONSIBILITY FOR ANY LOSS OR DAMAGE resulting from the use of this pack
of backgrounds, no matter how it is caused.
How to set a BG image
---------------------
FreeMiNT/XaAES
--------------
XaAES is capable of displaying a wallpaper in all colour depths and
resolutions. However, *setting* a wallpaper is not straightforward, but
it is done by pressing a keys combination which takes a snapshot of the
current screen and set it as the desktop background. As you probably
don't want your GEM desktop as wallpaper, you need a program capable of
displaying a picture in fullscreen, and then set the desktop background.
1.Open the picture of your choice in zView, the image viewer available
in your FireBee setup. It's recommended to use the same proportions of
your current screen res.
2.Press 'F10' to display the picture in zView fullscreen mode.
3.Press the following keyboard combination:
CONTROL+ALT+":"
You might have to press Shift to get the ":", e.g. Shift+".". In this
case, the keyboard combination will be Control+Alt+Shift+".". Now XaAES
saves this picture as background in:
c:/mint/1-19-cur/xaaes/<resolution.colour>/xa_form.mfd
4.Close zView. The picture formerly displayed in fullscreen by zView is
now your desktop background.
Please note that this background will be used in your current colour
depth and screenres only. If you switch to another resolution and you
want to keep the same wallpaper, you will have to repeat the steps
above. The generated backgrounds will be available at every resolution
change.
FreeMiNT MyAES
--------------
In MyAES, the BG image is always named desk.jpg and by default is
located inside the skin=C:\gemsys\myaes\skins\<theme> folder. This path
is set in the myaes configuration file and can be changed.
Be aware that the skin\<theme> folder contains all the images for the
window's theme in use, and modifying the contents other than the
desk.jpg image, will affect the overall look.
Setting up a BG image
----------------------
1. Select the source BG image matching your preferred screenres;
2. Rename or Copy/Rename it into desk.jpg;
3. Move or Rename or Delete the current BG image, by default:
(C:\gemsys\myaes\skins\<theme>\desk.jpg);
4. Copy/move the new desk.img to the skin/<theme> folder;
5. Reboot.
The selected desk.img image will be used in all screenres as MyAES
will automatically tile the background images smaller than current
screenres and crop the right/bottom edges of those bigger.
System Requirements
-------------------
- A poweful TOS platform with TC screen depth;
- A Multitasking OS (such as FreeMiNT/XaAES or FreeMiNT/MyAES) and a
desktop;
- the OS extension NVDI or the NVDI palette is recommanded (required to
display correctly the 256 colors icon sets for the fireBee).
Licence
-------
This background images set is licensed by the Authors listed in the
"Authors" section of this readme file, under a:
CREATIVE COMMONS ATTIBUTION-NONCOMMERCIAL-SHAREALIKE 4.0 INTERNATIONAL
(CC BY-NC-SA 4.0)
https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode
Under this licence, you are free to:
Share - copy and redistribute the material in any medium or format
Adapt - remix, transform, and build upon the material
The licensor cannot revoke these freedoms as long as you follow the
license terms.
Under the following terms:
Attribution - You must give appropriate credit, provide a link to the
license, and indicate if changes were made. You may do so in any
reasonable manner, but not in any way that suggests the licensor
endorses you or your use.
NonCommercial - You may not use the material for commercial purposes.
ShareAlike - If you remix, transform, or build upon the material, you
must distribute your contributions under the same license as the
original.
No additional restrictions - You may not apply legal terms or
technological measures that legally restrict others from doing anything
the license permits.
Notices:
You do not have to comply with the license for elements of the material
in the public domain or where your use is permitted by an applicable
exception or limitation.
No warranties are given. The license may not give you all of the
permissions necessary for your intended use. For example, other rights
such as publicity, privacy, or moral rights may limit how you use the
material.
For the full text of the licence see the LICENSE.TXT document.

View File

@@ -0,0 +1 @@
Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)

Binary file not shown.

1
sources/emutos Submodule

Submodule sources/emutos added at 777991d439

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,37 @@
-COMPILE
>System
Basic system software/Setup tools
>Tools
The software you need
>Internet
and Network
>Development tools
Programmieren...
>Others
Unsorted documentations
#
.welcome.hyp
System
.firebee.hyp
System
.TERADESK.HYP
System
.THING.HYP
System
.THINGICN.HYP
System
.cops.hyp
System
.xaaes.hyp
#
./DE/RSM.HYP
Development tools
.BGH.HYP
Development tools
.BGH2RSM.HYP
Development tools
.OVERLAY.HYP
Development tools
.rsm2cs.hyp
Development tools
#

BIN
sources/fb_hyps/catalog.hyp Normal file

Binary file not shown.

BIN
sources/fb_hyps/catalog.ref Normal file

Binary file not shown.

280
sources/fb_hyps/catalog.stg Normal file
View File

@@ -0,0 +1,280 @@
@database "Hypertext of Hypertexts"
@options "-ains"
@author "ACP"
@$VER: Catalog (@:"__DATE__")
@subject "TOP"
@node "Main" "Available Hypertexts"
@{0U}Available Hypertexts FireBee@{0}
EN @{"DE" LINK "DE"} @{"FR" LINK "FR"} @{"RU" LINK "RU"} @{"NL" LINK "NL"}
@line 1 59 0
@{"System" link "System"}
Basic system software/Setup tools
@{"Tools" link "Tools"}
The software you need
@{"Network" link "Network"}
Connection to other computers
@{"Development tools" link "Development tools"}
Compiler, Resource editor...
@{"Others" link "Others"}
Unsorted documentations
@endnode
@node "System"
@toc "Main"
@{0U}System FireBee@{0}
@{"Welcome to the FireBee" link welcome.hyp}
Version: 1.0
@{"FireBee/FireTOS documentation" link firebee.hyp}
Program: March 16 2014 Doc: July 25 2011
@{"TeraDesk" link TERADESK.HYP}
Version: 4.08 (July 2019)
@{"Thing! Desktop" link THING.HYP}
Version: 1.27 (23/8/1998)
@{"ThingIcon" link THINGICN.HYP}
Version: 1.10
@{"XaAES" link XAAES.HYP}
Version: 1.6.4beta
@{"COntrolPanel Server" LINK cops.hyp}
Version: 1.07 (15. July 1997)
@{"FlashTool" LINK C:\flasher\readme.txt}
Version: 2.01
@{"TosWin2" link C:\guides\DE\toswin2.hyp} (only german)
Version: 2.7
@endnode
@node "Tools"
@toc "Main"
@{0U}Tools FireBee@{0}
@{"68k Emulator" link C:\tools\68kemu\README.txt}
Version: (17/03/2012)
@{"lzip" LINK C:\tools\lzip\lzip.txt}
Version: 1.0
@{"QED Texteditor" link C:\guides\qed.hyp}
Version: 5.0.5
@{"Qextract" LINK C:\tools\qextract\qextract.txt}
Version: 0.7
@{"Simple Boot Manager" LINK C:\tools\sboot-03\readme.txt}
Version: 0.3
@{"ST-Guide+Tools EN" LINK "stg_en"}
@{"Synctime" SYSTEM "C:\tools\synctime\doc\synctime.htm"}
Version: 1.3
@{"zView Guide" link ZVIEW.HYP}
Version: BETA7a (25/12/05)
@endnode
@node "stg_en" "ST-Guide+Tools EN"
@{0U}ST-Guide+Tools EN FireBee@{0}
@{"ST-Guide" LINK st-guide.hyp}
Version: 1.5e (1997)
@{"HCP Hypertext compiler" LINK hcp.hyp}
Version: 2.0e (1997)
@{"RefLink" LINK reflink.hyp}
Version: 1.02 (1997)
@{"STool" LINK stool.hyp}
Version: 1.00e (1997)
@endnode
@node "Network"
@toc "Main"
@{0U}Network FireBee@{0}
## @{"NFS Client lmount" LINK lmount.hyp}
## Version: 1.0 (2019)
@endnode
@node "Development tools"
@toc "Main"
@{0U}Development tools FireBee@{0}
@{"ResourceMaster EN" link rsm.hyp}
Version: 3.6
@{"AHCC" link ahcc.hyp}
Version: 5.6
@{"DIGGER" link digger.hyp}
Version: 8.1
@{"GFA Basic Editor" LINK "GBE"}
Version: 1.71
@{"TOS - The Operating System" link TOS.HYP}
Version: December 19, 2008
@endnode
@node "GBE" "GFA Basic Editor"
@toc "Development tools"
@{0U}GFA Basic Editor FireBee@{0}
@{"GBE" link gbe.hyp}
Version: 1.71
@{"GBE libraries" link gbe_lib.hyp}
@{"Devpac 3" link devpac3.hyp}
@{"GFA Basic" link gfabacic.hyp}
(original Atari version)
@{"Atari Compendium" link compend.hyp}
Version: 1.25
@endnode
@node "Others"
@toc "Main"
@{0U}Others FireBee@{0}
@endnode
@node "DE" "German Hypertexts"
@toc "Main"
@{0U}German Hypertexts FireBee@{0}
@{"TeraDesk" link C:\guides\DE\TERADESK.HYP}
Version: 4.08 (July 2019)
@{"Thing! Desktop" link C:\guides\DE\THING.HYP}
Version: 1.27D (23/8/1998)
@{"ThingIcon" link C:\guides\DE\THINGICN.HYP}
Version: 1.10D
@{"COntrolPanel Server" LINK C:\guides\DE\cops.hyp}
Version: 1.08D
@{"QED Texteditor" link C:\guides\DE\qed.hyp}
Version: 5.0.5
@{"ResourceMaster DE" link "rsm_de"}
@{"ST-Guide+Tools DE" LINK "stg_de"}
@{"TOS - Das Betriebssystem" link C:\guides\DE\TOS_HYP.HYP}
Version: M<>rz 28, 2016
@{"TosWin2" link C:\guides\DE\toswin2.hyp}
Version: 2.7
@endnode
@node "rsm_de" "ResourceMaster DE"
@toc "DE"
@{0U}ResourceMaster DE FireBee@{0}
@{"ResourceMaster" link C:\guides\DE\RSM.HYP}
Version: 3.65
@{"BGH" link C:\guides\DE\BGH.HYP}
Version: 1.4
@{"BGH to RSM" link C:\guides\DE\BGH2RSM.HYP}
Version: 1.2
@{"ResourceMaster-Overlays" link C:\guides\DE\OVERLAY.HYP}
Version: ?
@{"RSM to C-Source" link C:\guides\DE\rsm2cs.hyp}
Version: 1.03
@{"SRSCSIZE" link C:\guides\DE\srscsize.txt}
Version: Mai 9, 2000
@endnode
@node "stg_de" "ST-Guide+Tools DE"
@toc "DE"
@{0U}ST-Guide+Tools DE FireBee@{0}
@{"ST-Guide" LINK C:\guides\DE\st-guide.hyp}
Version: 1.5d (1997)
@{"HCP Hypertext compiler" LINK C:\guides\DE\hcp.hyp}
Version: 2.0d (1997)
@{"RefLink" LINK C:\guides\DE\reflink.hyp}
Version: 1.02 (1997)
@{"STool" LINK C:\guides\DE\stool.hyp}
Version: 1.00d (1997)
@endnode
@node "FR" "French Hypertexts"
@toc "Main"
@{0U}French Hypertexts FireBee@{0}
@{"Thing! Desktop" link C:\guides\FR\THING.TXT}
Version: 1.27E (23/8/1998)
@{"ThingIcon" link C:\guides\THINGICN.TXT}
Version: 1.10E
@endnode
@node "RU" "Russian Hypertexts"
@toc "Main"
@{0U}Russian Hypertexts FireBee@{0}
@{"TeraDesk" link C:\guides\RU\TERADESK.HYP}
Version: 4.08 (July 2019)
@endnode
@node "NL" " Dutch Hypertexts"
@{0U}Dutch Hypertexts FireBee@{0}
@{"QED Texteditor" link C:\guides\NL\qed.hyp}
Program: 5.0.5 Doc: 5.0.2
@endnode

View File

@@ -0,0 +1,16 @@
Notes for creating HypViews catalog.hyp file on FireBee:
- Please do NOT use ST-Guides "stool.tos" for creating a catalog.hyp file!
It works, but stool.tos don't accept pathnames in the catalog.cfg configuration
file and so the "multi-language structure" of FireBees /guides/ folder is
not working sufficiently.
So please see the the included "catalog.cfg" only as an example.
- If you want to add categories, .hyp files or "external" (.txt) files to your
catalog, edit file "catalog.stg" with texteditor QED. Just copy and paste
a "neighbour entry" link, edit name and path to your needs and save the file.
After that, drag and drop the file "catalog.stg" on compiler c:/tools/stgui15/st-guide/hcp.ttp
and the new catalog will be created.
If you have problems with that, please send me an email: latzmaster@gmx.de

BIN
sources/fb_hyps/clock.img Normal file

Binary file not shown.

BIN
sources/fb_hyps/desktop.img Normal file

Binary file not shown.

BIN
sources/fb_hyps/doc_dir.img Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
sources/fb_hyps/network.img Normal file

Binary file not shown.

BIN
sources/fb_hyps/screens.img Normal file

Binary file not shown.

BIN
sources/fb_hyps/weblink.img Normal file

Binary file not shown.

BIN
sources/fb_hyps/welcome.hyp Normal file

Binary file not shown.

2139
sources/fb_hyps/welcome.stg Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

BIN
sources/firehyp/firebee.hyp Normal file

Binary file not shown.

BIN
sources/firehyp/firebee.ref Normal file

Binary file not shown.

1513
sources/firehyp/firebee.stg Normal file

File diff suppressed because it is too large Load Diff

1083
sources/firehyp/firebee.u Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
sources/firehyp/img/v4e.img Normal file

Binary file not shown.

1
sources/freemint Submodule

Submodule sources/freemint added at ec33ec29b4

Binary file not shown.

View File

@@ -0,0 +1,503 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
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 this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
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
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser 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 Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "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
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY 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
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey 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 library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

View File

@@ -0,0 +1,89 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <osbind.h>
#include <mintbind.h>
#include <gem.h>
#include <ldg.h>
#include <types2b.h>
#include <zcodec.h>
int main( int argc, char *argv[])
{
IMAGE *test_img = NULL;
MFDB *resize = NULL, screen = {0};
int16 xy[8];
/* We load the wanted codecs but if we want to
load the entire codecs's pack, we can do "codecs_init( "all"); */
if( !codecs_init( "gif.ldg"))
Cconws("can't init the codec \n\r");
if ( argc > 1)
{ /* we load the dragged picture, we put - 1 to both w and h options because we don't want zoom */
if( ! (test_img = load_img( argv[argc - 1], -1, -1, 0)))
{
Cconws("can't load image \n\r");
codecs_quit();
return 0;
}
}
else
{
Cconws("Drag and Drop a gif image\n\r");
codecs_quit();
return 0;
}
xy[0] = 0;
xy[1] = 0;
xy[2] = test_img->image[0].fd_w - 1;
xy[3] = test_img->image[0].fd_h - 1;
xy[4] = 20;
xy[5] = 20;
xy[6] = xy[4] + xy[2];
xy[7] = xy[5] + xy[3];
if ( test_img->image[0].fd_nplanes == 1)
{
int16 color[2] = { 0, 1};
vrt_cpyfm( vdi_handle, MD_REPLACE, xy, &test_img->image[0], &screen, color);
}
else
vro_cpyfm( vdi_handle, S_ONLY, xy, &test_img->image[0], &screen);
if( !( resize = pic_resize( &test_img->image[0],64, 64, 1)))
{
Cconws("can't resize image \n\r");
delete_img( test_img);
codecs_quit();
return 0;
}
xy[0] = 0;
xy[1] = 0;
xy[2] = resize->fd_w - 1;
xy[3] = resize->fd_h - 1;
xy[4] = 20 + test_img->image[0].fd_w - 1;
xy[5] = 20;
xy[6] = xy[4] + xy[2];
xy[7] = xy[5] + xy[3];
/* draw the image */
if ( resize->fd_nplanes == 1)
{
int16 color[2] = { 0, 1};
vrt_cpyfm( vdi_handle, MD_REPLACE, xy, resize, &screen, color);
}
else
vro_cpyfm( vdi_handle, S_ONLY, xy, resize, &screen);
delete_mfdb( resize, 1);
delete_img( test_img);
codecs_quit();
return 0;
}

View File

@@ -0,0 +1,41 @@
ifeq ($(CROSS),yes)
AS = m68k-atari-mint-as
CC = m68k-atari-mint-gcc
STACK = m68k-atari-mint-stack
INCLUDE_PATH = /home/zorro/cross-tools/include
LIB_PATH = /home/zorro/cross-tools/lib
else
AS = as
CC = gcc
STACK = stack
INCLUDE_PATH = /usr/GEM/include
LIB_PATH = /usr/GEM/lib
endif
STACKSIZE = 128k
COMPRESS = upx
OPTIMISATION = -O2 -fomit-frame-pointer -finline-functions
CPU = -m68020-60
LIB = -lzcodec -lgem -lldg
CFLAGS = $(CPU) $(OPTIMISATION) -Wall -I$(INCLUDE_PATH)
OBJ = main.o
PROGRAM = exemple.app
all: $(PROGRAM) stack #compress
$(PROGRAM): $(OBJ)
$(CC) -o$@ $(OBJ) -Xlinker -s -L$(LIB_PATH) $(LIB)
stack:
$(STACK) -S $(STACKSIZE) $(PROGRAM)
compress:
$(COMPRESS) $(PROGRAM)
clean:
rm -f *.o

View File

@@ -0,0 +1,43 @@
#ifndef __2B_UNIVERSAL_TYPES__
#define __2B_UNIVERSAL_TYPES__
typedef signed char int8;
typedef unsigned char uint8;
typedef signed long int32;
typedef unsigned long uint32;
typedef int32 fix31;
#ifdef __GNUC__
typedef signed short int16;
typedef unsigned short uint16;
#define __2B_HAS64_SUPPORT /* Compiler supports 64 Bit Integers */
typedef signed long long int64;
typedef unsigned long long uint64;
#else /* Compiler doesn't support 64 Bit Integers */
typedef signed int int16;
typedef unsigned int uint16;
typedef struct
{
int32 hi;
uint32 lo;
} int64;
typedef struct
{
int32 hi;
uint32 lo;
} loff_t;
typedef struct
{
uint32 hi;
uint32 lo;
} uint64;
#endif
typedef int32 boolean;
#endif /* __2B_UNIVERSAL_TYPES__ */

View File

@@ -0,0 +1,29 @@
#ifndef __ZCODECLIB_ZCODEC_H__
#define __ZCODECLIB_ZCODEC_H__
#include <types2b.h>
struct LDG;
struct MFDB;
typedef struct
{
int16 page; /* Number of page/image in the file */
uint16 *delay; /* Animation delay in millise. between each frame */
MFDB *image; /* The Image itself */
}IMAGE;
extern int16 planar, vdi_handle, nplanes, vdi_work_in[10], vdi_work_out[57];
extern LDG *ldg_mem;
extern int16 codecs_init( char *codec_name);
extern void codecs_quit( void);
extern IMAGE *load_img( const char *file, int16 w, int16 h, int16 keep_ratio);
extern void delete_img( IMAGE *img);
extern MFDB *pic_resize( MFDB *in, int16 w, int16 h, int16 keep_ratio);
extern void delete_mfdb( MFDB *bm, int16 nbr);
#define shared_malloc( s) _ldg_malloc( s, ldg_global[2]);
#define shared_free( s) _ldg_free( s, ldg_global[2]);
#endif

View File

@@ -0,0 +1,28 @@
ifeq ($(CROSS),yes)
AS = m68k-atari-mint-as
AR = m68k-atari-mint-ar
CC = m68k-atari-mint-gcc
STACK = m68k-atari-mint-stack
else
AS = as
CC = gcc
STACK = stack
endif
OPTIMISATION = -O2 -fomit-frame-pointer
CPU = -m68020-60
CFLAGS = $(CPU) $(OPTIMISATION) -Wall -I../include -I/usr/local/include
VDI_OBJ = zvdi/p2c.o zvdi/color.o zvdi/dither.o zvdi/raster.o zvdi/raresize.o zvdi/vdi.o
OBJ = $(VDI_OBJ) img.o resize.o codecs.o mfdb.o load_img.o ztext.o mem.o
TARGET = ../lib/m68020-60/libzcodec.a
$(TARGET): $(OBJ)
rm -f $@
$(AR) cru $@ $^
clean:
rm -f *.o zvdi/*.o *.O zvdi/*.O *~ $(TARGET)

View File

@@ -0,0 +1,146 @@
#include "general.h"
#include "ztext.h"
#ifdef __PUREC__
#include "zvdi\vdi.h"
#else
#include "zvdi/vdi.h"
#endif
/* Prototype */
int16 plugins_init( void);
void plugins_quit( void);
/* LDG function */
void CDECL( *codec_init)( void) = NULL;
static int16 vdi_initialised = 0;
static int16 mem_initialised = 0;
/* Global variable */
int16 plugins_nbr = 0;
LDG *codecs[100];
/*==================================================================================*
* void plugins_quit: *
* unload all the codec from memory. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void codecs_quit( void)
{
int16 i;
for( i = 0; i < plugins_nbr; i++)
{
ldg_close( codecs[i], ldg_global);
}
mem_quit();
}
/*==================================================================================*
* void plugins_init: *
* load codec(s) to memory. *
*----------------------------------------------------------------------------------*
* input: *
* codec_name: the name of the codec to load, if this one is "all", we load *
* the codec. *
*----------------------------------------------------------------------------------*
* returns: *
* 0 if error. *
*==================================================================================*/
int16 codecs_init( char *codec_name)
{
char *env_ldg, current_dir[1024], plugin_dir[1024];
DIR *dir;
LDG_INFOS *cook;
struct dirent *de;
int16 len;
char extention[4];
shel_envrn( &env_ldg, "LDGPATH=");
if( ldg_cookie( LDG_COOKIE, ( int32*)&cook))
strcpy( plugin_dir, cook->path);
else if( env_ldg)
strcpy( plugin_dir, env_ldg);
else
strcpy( plugin_dir, "C:\\gemsys\\ldg\\");
len = ( int16)strlen( plugin_dir);
if( plugin_dir[len-1] != '\\')
strcat( plugin_dir, "\\");
strcat( plugin_dir, "codecs");
current_dir[0] = 'A' + Dgetdrv();
current_dir[1] = ':';
Dgetpath( current_dir + 2, 0);
if( vdi_initialised == 0)
if( !( vdi_initialised = vdi_init()))
return( 0);
if( mem_initialised == 0)
if( !( mem_initialised = mem_init()))
return( 0);
if ( chdir( plugin_dir) != 0)
{
mem_quit();
return( 0);
}
if( strcmp ( codec_name, "all") == 0)
{
if (( dir = opendir( ".")) != NULL)
{
while(( de = readdir( dir)) != NULL)
{
if (( strcmp( de->d_name, ".") == 0) || ( strcmp( de->d_name, "..") == 0))
continue;
strcpy ( extention, de->d_name + strlen( de->d_name) - 3);
str2lower( extention);
if( strcmp ( extention, "ldg") == 0)
{
if ( ( codecs[plugins_nbr] = ldg_open( de->d_name, ldg_global)))
{
if ( ( codec_init = ldg_find( "plugin_init", codecs[plugins_nbr])))
{
codec_init();
plugins_nbr++;
}
else
ldg_close( codecs[plugins_nbr], ldg_global);
}
}
}
closedir( dir);
}
}
else if ( ( codecs[plugins_nbr] = ldg_open( codec_name, ldg_global)))
{
if ( ( codec_init = ldg_find( "plugin_init", codecs[plugins_nbr])))
{
codec_init();
plugins_nbr++;
}
else
ldg_close( codecs[plugins_nbr], ldg_global);
}
chdir( current_dir);
return plugins_nbr;
}

View File

@@ -0,0 +1,2 @@
extern LDG *codecs[100];
extern int16 plugins_nbr;

View File

@@ -0,0 +1,48 @@
/*
* zcodeclib.
* Copyright (c) 2001-2005 Zorro ( zorro270@yahoo.fr)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef __PUREC__
#include <tos.h>
#elif defined (__GNUC__)
#include <osbind.h>
#include <mintbind.h>
#include <dirent.h>
#include <unistd.h>
#endif
#include <gemx.h>
#include <ldg.h>
#include <ldg/mem.h>
#include <types2b.h>
#include "mem.h"
#define shared_malloc( s) _ldg_malloc( s, ldg_global[2]);
#define shared_free( s) _ldg_free( s, ldg_global[2]);
#ifndef MIN
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
#ifndef TRUE
# define TRUE 1
# define FALSE 0
#endif

View File

@@ -0,0 +1,53 @@
#include "general.h"
#include "mfdb.h"
#include "load_img.h"
IMAGE *init_img( int16 page, int16 w, int16 h, int16 planes)
{
IMAGE *data;
int16 i;
data = ( IMAGE *)shared_malloc( sizeof( IMAGE));
if( data == NULL)
return NULL;
data->page = page;
data->delay = NULL;
data->image = ( MFDB *)shared_malloc( sizeof( MFDB) * page);
if( data->image == NULL)
{
shared_free( data);
return NULL;
}
for ( i = 0 ; i < page ; i++)
{
if ( !init_mfdb( &data->image[i], w, h, planes))
{
if( i)
delete_mfdb( data->image, i + 1);
shared_free( data->image);
shared_free( data);
return NULL;
}
}
return data;
}
void delete_img( IMAGE *data)
{
if( data == NULL)
return;
delete_mfdb( data->image, data->page);
if( data->delay)
shared_free( data->delay);
shared_free( data);
}

View File

@@ -0,0 +1,3 @@
extern IMAGE *init_img( int16 page, int16 w, int16 h, int16 planes);
extern void delete_img( IMAGE *data);

View File

@@ -0,0 +1,265 @@
#include "general.h"
#include "codecs.h"
#include "load_img.h"
#include "img.h"
#include "ztext.h"
#ifdef __PUREC__
#include "zvdi\color.h"
#include "zvdi\raster.h"
#include "zvdi\vdi.h"
#else
#include "zvdi/color.h"
#include "zvdi/raster.h"
#include "zvdi/vdi.h"
#endif
boolean decoder_init_done = FALSE;
void ( *raster) ( DECDATA, void *dst);
void ( *raster_cmap) ( DECDATA, void *);
void ( *raster_true) ( DECDATA, void *);
void ( *cnvpal_color) ( IMGINFO, DECDATA);
void ( *raster_gray) ( DECDATA, void *);
void CDECL ( *decoder_quit) ( IMGINFO);
boolean CDECL ( *decoder_init) ( const char *, IMGINFO);
boolean CDECL ( *decoder_read) ( IMGINFO, uint8 *);
static IMAGE *setup ( IMGINFO info, DECDATA data, int16 w, int16 h, int16 keep_ratio)
{
int16 n_planes = ( ( info->planes == 1 && info->components == 1) ? 1: nplanes);
uint16 display_w, display_h;
int16 wanted_w = ( w > 0 ? w : info->width), wanted_h = ( h > 0 ? h : info->height);
float precise_x, precise_y;
size_t src_line_size;
IMAGE *image;
/* the image size is different that the original and we want to keep the aspect ratio */
if( keep_ratio && ( info->width != wanted_w) && ( info->height != wanted_h))
{
float factor = MAX( ( float)info->height / ( float)wanted_h, ( float)info->width / ( float)wanted_w);
precise_x = ( float)info->width / factor;
precise_y = ( float)info->height / factor;
display_w = ( ( uint16)precise_x > 0 ? ( uint16)precise_x : 16);
display_h = ( ( uint16)precise_y > 0 ? ( uint16)precise_y : 16);
data->IncXfx = ((( uint32)info->width << 16) + ( display_w >> 1)) / display_w;
data->IncYfx = ((( uint32)info->height << 16) + ( display_h >> 1)) / display_h;
}
else if(( info->width != wanted_w) && ( info->height != wanted_h))
{
float x_factor = ( float)info->width / ( float)wanted_w;
float y_factor = ( float)info->height / ( float)wanted_h;
precise_x = ( float)info->width / x_factor;
precise_y = ( float)info->height / y_factor;
display_w = ( ( uint16)precise_x > 0 ? ( uint16)precise_x : 16);
display_h = ( ( uint16)precise_y > 0 ? ( uint16)precise_y : 16);
data->IncXfx = ((( uint32)info->width << 16) + ( display_w >> 1)) / display_w;
data->IncYfx = ((( uint32)info->height << 16) + ( display_h >> 1)) / display_h;
}
else
{
display_w = info->width;
display_h = info->height;
data->IncXfx = 0x10000uL;
data->IncYfx = 0x10000uL;
}
image = init_img( info->page, display_w, display_h, n_planes);
if( image == NULL)
return NULL;
/* we assume that the pixel size is minimum 8 bits because some GNU libraries return 1 and 4 bits format like 8 bits ones.
We add also a little more memory for avoid buffer overflow for plugin badly coded. */
src_line_size = ( info->width + 64) * info->components;
data->RowBuf = ( uint8*)shared_malloc( src_line_size);
if( !data->RowBuf)
return NULL;
if(( info->planes == 1 && info->components == 1) || nplanes > 8)
data->DthBuf = NULL;
else
{
size_t size = ( display_w + 15) * 3;
data->DthBuf = shared_malloc( size);
if( data->DthBuf == NULL)
return NULL;
memset( data->DthBuf, 0, size);
}
data->DthWidth = display_w;
data->PixMask = ( 1 << info->planes) - 1;
data->LnSize = image->image[0].fd_wdwidth * n_planes;
if ( info->planes == 1 && info->components == 1)
{
cnvpal_mono( info, data);
raster = raster_mono;
}
else
{
if ( info->indexed_color)
{
( *cnvpal_color)( info, data);
raster = raster_cmap;
}
else
raster = ( info->components >= 3 ? raster_true : raster_gray);
}
image->delay = NULL;
return image;
}
static inline void read_img ( IMAGE *img, IMGINFO info, DECDATA data)
{
uint16 *dst;
int16 y_dst, i, y, img_h = info->height;
int32 line_size = data->LnSize;
uint8 *buf = data->RowBuf;
for ( i = 0; i < img->page; i++)
{
uint32 scale = ( data->IncYfx + 1) >> 1;
y_dst = img->image[0].fd_h;
dst = img->image[i].fd_addr;
if( info->orientation == DOWN_TO_UP)
{
dst += data->LnSize * ( y_dst - 1);
line_size = -data->LnSize;
}
info->page_wanted = i;
for( y = 1; y <= img_h; y++)
{
if( !decoder_read( info, buf))
return;
while(( scale >> 16) < y)
{
( *raster)( data, dst);
dst += line_size;
scale += data->IncYfx;
if (!--y_dst) break;
}
}
if( img->delay != NULL )
{
img->delay[i] = info->delay;
}
}
}
void quit_img( IMGINFO info, DECDATA data)
{
if( decoder_init_done == TRUE)
decoder_quit( info);
if( data->DthBuf)
shared_free( data->DthBuf);
if( data->RowBuf)
shared_free( data->RowBuf);
shared_free( data);
shared_free( info);
decoder_init_done = FALSE;
}
boolean get_pic_info( const char *file, IMGINFO info)
{
int16 i, j, c = 0;
char extention[3+1], plugin[3];
strcpy ( extention, file + strlen( file) - 3);
str2upper( extention);
/* We check if a plug-ins can do the job */
for( i = 0; i < plugins_nbr; i++, c = 0)
{
for( j = 0; j < codecs[i]->user_ext; j++)
{
plugin[0] = codecs[i]->infos[c++];
plugin[1] = codecs[i]->infos[c++];
plugin[2] = codecs[i]->infos[c++];
if( strncmp ( extention, plugin, 3) == 0)
{
if ( !( decoder_init = ldg_find( "reader_init", codecs[i]))
|| !( decoder_read = ldg_find( "reader_read", codecs[i]))
|| !( decoder_quit = ldg_find( "reader_quit", codecs[i])))
{
return FALSE;
}
return decoder_init( file, info);
}
}
}
/* I wish that it will never append ! */
return FALSE;
}
IMAGE *load_img( const char *file, int16 w, int16 h, int16 keep_ratio)
{
IMGINFO info;
DECDATA data;
IMAGE *img;
/* One codec or more must be present */
if( codecs[0] == NULL)
return( NULL);
info = ( img_info *)shared_malloc( sizeof( img_info));
if( !info)
return( NULL);
data = ( dec_data *)shared_malloc( sizeof( dec_data));
if( !data)
{
shared_free( info);
return ( NULL);
}
info->background_color = 0xFFFFFF;
info->thumbnail = FALSE;
if (( decoder_init_done = get_pic_info( file, info)) == FALSE)
{
shared_free( data);
shared_free( info);
return ( NULL);
}
img = setup ( info, data, w, h, keep_ratio);
if( img == NULL)
{
delete_img( img);
quit_img( info, data);
return ( NULL);
}
read_img ( img, info, data);
quit_img( info, data);
return ( img);
}

View File

@@ -0,0 +1,92 @@
#define UP_TO_DOWN 0
#define DOWN_TO_UP 1
typedef struct
{
uint8 red;
uint8 green;
uint8 blue;
} COLOR_MAP;
typedef struct _img_info *IMGINFO;
typedef struct _img_info
{
/* Data returned by the decoder Picture's initialisation */
uint16 width; /* Picture width */
uint16 height; /* Picture Height */
uint16 components; /* Picture components */
uint16 planes; /* Picture bits by pixel */
uint32 colors; /* Picture colors number */
int16 orientation; /* picture orientation: UP_TO_DOWN or DONW_TO_UP ( ex: TGA) */
uint16 page; /* Number of page/image in the file */
uint16 delay; /* Animation delay in 200th sec. between each frame. */
uint16 num_comments; /* Lines in the file's comment. ( 0 if none) */
uint16 max_comments_length; /* The length of the greater line in the comment */
int16 indexed_color; /* Picture has a palette: 0) No 1) Yes */
int16 memory_alloc; /* where to do the memory allocation for the reader_read
function buffer, possible values are ST_RAM or TT_RAM */
COLOR_MAP palette[256]; /* Palette in standard RGB format */
/* data send to the codec */
uint32 background_color; /* The wanted background's color in hexa */
int16 thumbnail; /* 1 if true else 0.
Some format have thumbnail inside the picture, if 1, we
want only this thumbnail and not the image itself */
uint16 page_wanted; /* The wanted page to get for the reader_read() function
The first page is 0 and the last is img_info->page - 1 */
/* The following variable are only for Information Prupose, the zview doesn't
use it for decoding routine but only for the information dialog */
int8 info[40]; /* Picture's info, for ex: "Gif 87a" */
int8 compression[5]; /* Compression type, ex: "LZW" */
uint16 real_width; /* Real picture width( if the thumbnail variable is 1) */
uint16 real_height; /* Ral picture Height( if the thumbnail variable is 1) */
/* Private data for the plugin */
void *_priv_ptr;
void *_priv_ptr_more;
void *__priv_ptr_more;
int32 _priv_var;
int32 _priv_var_more;
} img_info;
typedef struct _dec_data *DECDATA;
typedef struct _dec_data
{
uint8 *RowBuf;
void *DthBuf;
uint8 *DstBuf;
uint16 DthWidth;
uint16 PixMask;
int32 LnSize;
uint32 IncXfx;
uint32 IncYfx;
uint32 Pixel[256];
} dec_data;
typedef struct _img
{
int16 page; /* Number of page/image in the file */
uint16 *delay; /* Animation delay in millise. between each frame */
MFDB *image; /* The Image itself */
}IMAGE;
extern void ( *raster) ( DECDATA, void *dst);
extern void ( *raster_cmap) ( DECDATA, void *);
extern void ( *raster_true) ( DECDATA, void *);
extern void ( *cnvpal_color)( IMGINFO, DECDATA);
extern void ( *raster_gray) ( DECDATA, void *);
extern IMAGE *load_img( const char *file, int16 w, int16 h, int16 keep_ratio);

View File

@@ -0,0 +1,55 @@
#include "general.h"
/* Prototype */
void mem_quit( void);
int16 mem_init( void);
LDG *ldg_mem = NULL;
/*==================================================================================*
* int16 mem_init: *
* Initialise the memory manager. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* '1' if all is OK else '0' *
*==================================================================================*/
int16 mem_init( void)
{
ldg_mem = ldg_open( "C:\\gemsys\\ldg\\mem.ldg", ldg_global);
if( !ldg_mem)
ldg_mem = ldg_open( "mem.ldg", ldg_global);
_ldg_malloc = ldg_find( "ldg_malloc", ldg_mem);
_ldg_free = ldg_find( "ldg_free", ldg_mem);
_ldg_allocmode = ldg_find( "ldg_allocmode", ldg_mem);
if ( !ldg_mem || !_ldg_malloc || !_ldg_free || !_ldg_allocmode)
return( 0);
ldg_allocmode( 0L);
return( 1);
}
/*==================================================================================*
* void mem_quit: *
* close the memory manager. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void mem_quit( void)
{
if( ldg_mem)
ldg_close( ldg_mem, ldg_global);
}

View File

@@ -0,0 +1,4 @@
extern int16 mem_init( void);
extern void mem_quit( void);

View File

@@ -0,0 +1,71 @@
#include "general.h"
/* Prototype */
int16 init_mfdb( MFDB *bm, int16 width, int16 height, int16 planes);
void delete_mfdb( MFDB *bm, int16 nbr);
/*==================================================================================*
* int16 init_mfdb: *
* fit a MFDB with the parameters suppplied. *
*----------------------------------------------------------------------------------*
* input: *
* bm -> The MFDB to fit. *
* width -> Image's width. *
* height -> Image's height. *
* planes -> Screen planes or 1 if the image is monochrome. *
*----------------------------------------------------------------------------------*
* returns: *
* '0' if error or the memory size allocated. *
*==================================================================================*/
int16 init_mfdb( MFDB *bm, int16 width, int16 height, int16 planes)
{
uint32 length;
bm->fd_w = width;
bm->fd_h = height;
bm->fd_wdwidth = ( width >> 4) + (( width % 16) != 0);
bm->fd_stand = 0;
bm->fd_nplanes = planes;
bm->fd_r1 = 0;
bm->fd_r2 = 0;
bm->fd_r3 = 0;
length = (( (( uint32)bm->fd_wdwidth << 1 ) * ( uint32)bm->fd_nplanes) * ( uint32)bm->fd_h) + 256L;
bm->fd_addr = shared_malloc( length);
if ( bm->fd_addr)
return ( 1);
else
return ( 0);
}
/*==================================================================================*
* int16 delete_mfdb: *
* free the data of MFDB struct. *
*----------------------------------------------------------------------------------*
* input: *
* bm -> pointer to the MFDB to delete. *
* nbr -> The number of MFDB struct. to delete. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void delete_mfdb( MFDB *bm, int16 nbr)
{
register int16 i;
if( nbr == 0 || bm == NULL)
return;
for ( i = 0; i < nbr; i++)
{
if ( bm[i].fd_addr)
shared_free( bm[i].fd_addr);
}
shared_free( bm);
}

View File

@@ -0,0 +1,2 @@
extern int16 init_mfdb( MFDB *bm, int16 width, int16 height, int16 planes);
extern void delete_mfdb( MFDB *bm, int16 nbr);

View File

@@ -0,0 +1,162 @@
#include "general.h"
#include "load_img.h"
#include "mfdb.h"
#ifdef __PUREC__
#include "zvdi\raresize.h"
#include "zvdi\vdi.h"
#include "zvdi\p2c.h"
#else
#include "zvdi/raresize.h"
#include "zvdi/vdi.h"
#include "zvdi/p2c.h"
#endif
void ( *resize)( DECDATA, void *dst);
void ( *my_resize)( DECDATA, void *dst);
extern int32 plane2packed( int32 no_words, int32 plane_length, int16 no_planes, void *src, void *dst);
static int16 resize_setup( MFDB *in, MFDB *out, DECDATA data, int16 w, int16 h, int16 keep_ratio)
{
uint16 display_w, display_h;
float precise_x, precise_y;
/* the image size is different that the original and we want to keep the aspect ratio */
if( keep_ratio)
{
float factor = MAX( ( float)in->fd_h / ( float)h, ( float)in->fd_w / ( float)w);
precise_x = ( float)in->fd_w / factor;
precise_y = ( float)in->fd_h / factor;
display_w = ( ( uint16)precise_x > 0 ? ( uint16)precise_x : 16);
display_h = ( ( uint16)precise_y > 0 ? ( uint16)precise_y : 16);
data->IncXfx = ((( uint32)in->fd_w << 16) + ( display_w >> 1)) / display_w;
data->IncYfx = ((( uint32)in->fd_h << 16) + ( display_h >> 1)) / display_h;
}
else
{
float x_factor = ( float)in->fd_w / ( float)w;
float y_factor = ( float)in->fd_h / ( float)h;
precise_x = ( float)in->fd_w / x_factor;
precise_y = ( float)in->fd_h / y_factor;
display_w = ( ( uint16)precise_x > 0 ? ( uint16)precise_x : 16);
display_h = ( ( uint16)precise_y > 0 ? ( uint16)precise_y : 16);
data->IncXfx = ((( uint32)in->fd_w << 16) + ( display_w >> 1)) / display_w;
data->IncYfx = ((( uint32)in->fd_h << 16) + ( display_h >> 1)) / display_h;
}
if ( !init_mfdb( out, display_w, display_h, in->fd_nplanes))
return ( 0);
data->RowBuf = in->fd_addr;
if( planar)
{
data->DstBuf = shared_malloc((( uint32)in->fd_wdwidth << 4 ) + 256uL);
if( data->DstBuf == NULL)
{
delete_mfdb( out, 1);
return ( 0);
}
}
else
data->DstBuf = NULL;
data->DthWidth = display_w;
data->LnSize = out->fd_wdwidth * out->fd_nplanes;
if( out->fd_nplanes == 1)
my_resize = resize_mono;
else
my_resize = resize;
return( 1);
}
static inline void resize_img( MFDB *in, MFDB *out, DECDATA data)
{
uint16 *dst = out->fd_addr;
int16 y = 0;
int32 in_line_size = (( uint32)in->fd_wdwidth << 1 ) * ( uint32)in->fd_nplanes,
out_line_size = data->LnSize;
uint32 scale = ( data->IncYfx + 1) >> 1;
int16 y_dst = out->fd_h;
while ( y < in->fd_h)
{
y++;
if( planar)
{
if( ( scale >> 16) < y)
planar_to_chunky( data->RowBuf, data->DstBuf, in->fd_w);
}
while (( scale >> 16) < y)
{
my_resize( data, dst);
dst += out_line_size;
scale += data->IncYfx;
if ( !--y_dst) break;
}
data->RowBuf += in_line_size;
}
}
/*==================================================================================*
* pic_resize: *
* Create a resized MFDB. *
*----------------------------------------------------------------------------------*
* in: The src MFDB. *
* img: The target MFDB. *
*----------------------------------------------------------------------------------*
* returns: '0' if error else 1. *
*==================================================================================*/
MFDB *pic_resize( MFDB *in, int16 w, int16 h, int16 keep_ratio)
{
DECDATA data;
MFDB *out;
/* 2 planes zoom not available */
if( in->fd_nplanes == 2)
return NULL;
out = ( MFDB *)shared_malloc( sizeof( MFDB));
if( out == NULL)
return NULL;
data = ( dec_data *)shared_malloc( sizeof( dec_data));
if( !data)
{
shared_free( out);
return NULL;
}
if( !resize_setup( in, out, data, w, h, keep_ratio))
{
shared_free( data);
shared_free( out);
return NULL;
}
resize_img ( in, out, data);
if( data->DstBuf)
shared_free( data->DstBuf);
shared_free( data);
return( out);
}

View File

@@ -0,0 +1,3 @@
extern void ( *resize)( DECDATA, void *dst);
extern MFDB *pic_resize( MFDB *in, int16 w, int16 h, int16 keep_ratio);

View File

@@ -0,0 +1,78 @@
#include "general.h"
/* Local variable */
typedef struct
{
char upper;
char lower;
} CUL;
static CUL c[] = { {'A', 'a'}, {'B', 'b'}, {'C', 'c'}, {'D', 'd'}, {'E', 'e'}, {'F', 'f'}, {'G', 'g'}, {'H', 'h'},
{'I', 'i'}, {'J', 'j'}, {'K', 'k'}, {'L', 'l'}, {'M', 'm'}, {'N', 'n'}, {'O', 'o'}, {'P', 'p'},
{'Q', 'q'}, {'R', 'r'}, {'S', 's'}, {'T', 't'}, {'U', 'u'}, {'V', 'v'}, {'W', 'w'}, {'X', 'x'},
{'Y', 'y'}, {'Z', 'z'}, {'<EFBFBD>', '<EFBFBD>'}, {'<EFBFBD>', '<EFBFBD>'}, {'<EFBFBD>', '<EFBFBD>'}, {0xb6, '<EFBFBD>'}, {'<EFBFBD>', '<EFBFBD>'}, {'<EFBFBD>', '<EFBFBD>'},
{'<EFBFBD>', '<EFBFBD>'}, {'<EFBFBD>', '<EFBFBD>'}, {'<EFBFBD>', '<EFBFBD>'}, {0xb7, 0xb0}, {0xb8, 0xb1}, {0xb2, 0xb3}, {0xb5, 0xb4} };
/* Prototype */
void str2lower(char *str);
void str2upper(char *str);
/*==================================================================================*
* str2lower: *
* Transforms all letters in the string to lower case. *
*----------------------------------------------------------------------------------*
* returns: - *
*----------------------------------------------------------------------------------*
* str: Pointer to null terminated string. *
*==================================================================================*/
void str2lower(char *str)
{
int16 i, k;
i = 0;
while (str[i] != '\0')
{
for (k = 0; k < (sizeof(c) / sizeof(CUL)); k++)
{
if (c[k].upper == str[i])
{
str[i] = c[k].lower;
break;
}
}
i++;
}
}
/*==================================================================================*
* str2upper: *
* Transforms all letters in the string to uper case. *
*----------------------------------------------------------------------------------*
* returns: - *
*----------------------------------------------------------------------------------*
* str: Pointer to null terminated string. *
*==================================================================================*/
void str2upper(char *str)
{
int16 i, k;
i = 0;
while (str[i] != '\0')
{
for (k = 0; k < (sizeof(c) / sizeof(CUL)); k++)
{
if (c[k].lower == str[i])
{
str[i] = c[k].upper;
break;
}
}
i++;
}
}

View File

@@ -0,0 +1,5 @@
extern void size_to_text( char *txt, float size);
extern void str2lower(char *str);
extern void str2upper(char *str);
extern int16 name_shorter( int16 handle, int16 max_size, char *str);
extern char *zstrncpy( char *dst, const char *src, size_t n);

View File

@@ -0,0 +1,200 @@
#ifdef __PUREC__
#include "..\general.h"
#include "..\load_img.h"
#else
#include "../general.h"
#include "../load_img.h"
#endif
#include "vdi.h"
typedef struct
{
uint8 satur;
uint8 red, green, blue;
} SRGB;
static SRGB screen_colortab[256];
/* prototype */
void save_colors(void);
int16 remap_color (int32 value);
uint32 color_lookup ( uint32 rgb, int16 *trans);
void cnvpal_mono ( IMGINFO info, DECDATA data);
void cnvpal_1_2 (IMGINFO info, DECDATA data);
void cnvpal_4_8( IMGINFO info, DECDATA data);
void cnvpal_15( IMGINFO info, DECDATA data);
void cnvpal_high( IMGINFO info, DECDATA data);
void cnvpal_true( IMGINFO info, DECDATA data);
static uint8 saturation (uint8 * rgb)
{
uint8 satr;
if (rgb[0] >= rgb[1])
{
if (rgb[1] >= rgb[2])
satr = rgb[0] - rgb[2];
else if (rgb[0] > rgb[2])
satr = rgb[0] - rgb[1];
else
satr = rgb[2] - rgb[1];
}
else if (rgb[1] >= rgb[2])
{
if (rgb[0] >= rgb[2])
satr = rgb[1] - rgb[2];
else
satr = rgb[1] - rgb[0];
}
else
satr = rgb[2] - rgb[0];
return satr;
}
void save_colors(void)
{
register int16 i;
int16 colors = 1 << nplanes;
for( i = 0; i < colors; i++)
{
int16 coltab[3];
vq_color( vdi_handle, i, 1, coltab);
screen_colortab[i].red = ((((int32)coltab[0] << 8 ) - coltab[0]) + 500) / 1000;
screen_colortab[i].green = ((((int32)coltab[1] << 8 ) - coltab[1]) + 500) / 1000;
screen_colortab[i].blue = ((((int32)coltab[2] << 8 ) - coltab[2]) + 500) / 1000;
screen_colortab[i].satur = saturation ( &screen_colortab[i].red);
}
}
int16 remap_color (int32 value)
{
int16 red = ((uint8*)&value)[1];
int16 green = ((uint8*)&value)[2];
int16 blue = ((uint8*)&value)[3];
int16 satur = saturation (((uint8*)&value) +1);
int16 best_fit = 0;
uint16 best_err = 0xFFFFu;
int16 max_color = 1 << nplanes;
int16 i = 0;
value = ( value & 0x00FFFFFFl) | (( int32)satur << 24);
do
{
if ( *( int32*)&screen_colortab[i] == value)
{
/* gotcha! */
best_fit = i;
break;
}
else
{
uint16 err =
( red > screen_colortab[i].red ? red - screen_colortab[i].red : screen_colortab[i].red - red)
+ (green > screen_colortab[i].green ? green - screen_colortab[i].green : screen_colortab[i].green - green)
+ (blue > screen_colortab[i].blue ? blue - screen_colortab[i].blue : screen_colortab[i].blue - blue)
+ (satur > screen_colortab[i].satur ? satur - screen_colortab[i].satur : screen_colortab[i].satur - satur);
if (err <= best_err)
{
best_err = err;
best_fit = i;
}
}
} while (++i < max_color);
return best_fit;
}
uint32 color_lookup ( uint32 rgb, int16 *trans)
{
uint8 idx = ((rgb & ~0xFFuL) == ~0xFFuL ? rgb : remap_color (rgb));
return ( (( int32)(trans ? trans[idx] : idx) << 24) | (*(int32*)&screen_colortab[idx] & 0x00FFFFFFuL));
}
void cnvpal_mono ( IMGINFO info, DECDATA data)
{
/* if ( info->indexed_color)
{
uint32 bgnd, fgnd;
bgnd = (((( int32)info->palette[0].red <<8) | info->palette[0].green) <<8) | info->palette[0].blue;
fgnd = (((( int32)info->palette[1].red <<8) | info->palette[1].green) <<8) | info->palette[1].blue;
data->Pixel[0] = remap_color ( bgnd);
data->Pixel[1] = remap_color ( fgnd);
}
else
*/ {
data->Pixel[0] = G_WHITE;
data->Pixel[1] = G_BLACK;
}
}
void cnvpal_1_2 (IMGINFO info, DECDATA data)
{
register int32 i;
for( i = 0; i < info->colors; i++)
{
data->Pixel[i] = ( int16)info->palette[i].red * 5 + ( int16)info->palette[i].green * 9 + (( int16)info->palette[i].blue << 1);
}
}
void cnvpal_4_8( IMGINFO info, DECDATA data)
{
register int32 i;
for( i = 0; i < info->colors; i++)
{
uint32 rgb = (((( int32)info->palette[i].red << 8) | info->palette[i].green) << 8) | info->palette[i].blue;
data->Pixel[i] = rgb | (( int32)pixel_val[remap_color ( rgb)] << 24);
}
}
void cnvpal_15( IMGINFO info, DECDATA data)
{
register int32 i;
for( i = 0; i < info->colors; i++)
{
data->Pixel[i] = (( int16)( info->palette[i].red & 0xF8) << 7) | (( int16)( info->palette[i].green & 0xF8) << 2) | ( info->palette[i].blue >> 3);
}
}
void cnvpal_high( IMGINFO info, DECDATA data)
{
register int32 i;
for( i = 0; i < info->colors; i++)
{
data->Pixel[i] = (( int16)( info->palette[i].red & 0xF8) << 8) | (( int16)( info->palette[i].green & 0xFC) << 3) | ( info->palette[i].blue >> 3);
}
}
void cnvpal_true ( IMGINFO info, DECDATA data)
{
register int32 i;
for( i = 0; i < info->colors; i++)
{
data->Pixel[i] = (((( int32)info->palette[i].red << 8) | info->palette[i].green) << 8) | info->palette[i].blue;
}
}

View File

@@ -0,0 +1,14 @@
extern void save_colors( void);
extern int16 remap_color( int32 value);
extern uint32 color_lookup( uint32 rgb, int16 *trans);
extern void cnvpal_mono( IMGINFO info, DECDATA data);
extern void cnvpal_1_2( IMGINFO info, DECDATA data);
extern void cnvpal_4_8( IMGINFO info, DECDATA data);
extern void cnvpal_15( IMGINFO info, DECDATA data);
extern void cnvpal_high( IMGINFO info, DECDATA data);
extern void cnvpal_true( IMGINFO info, DECDATA data);
extern void ( *cnvpal_color)( IMGINFO, DECDATA);

View File

@@ -0,0 +1,46 @@
#ifdef __PUREC__
#include "..\general.h"
#else
#include "../general.h"
#endif
extern uint32 cube216[216];
extern uint32 graymap[32];
/* prototype */
inline uint8 dither_true ( uint8 * rgb, int16 * err, int8 ** buf);
inline uint8 dither_gray( uint8 *gray, int16 *err, int8 **buf);
inline uint8 dither_true ( uint8 * rgb, int16 * err, int8 ** buf)
{
int8 *dth = *buf;
unsigned short r = (( err[0] += ( int16)dth[0] + rgb[0]) <= 42 ? 0 : err[0] >= 213 ? 5 : ( err[0] * 3) >> 7);
unsigned short g = (( err[1] += ( int16)dth[1] + rgb[1]) <= 42 ? 0 : err[1] >= 213 ? 5 : ( err[1] * 3) >> 7);
unsigned short b = (( err[2] += ( int16)dth[2] + rgb[2]) <= 42 ? 0 : err[2] >= 213 ? 5 : ( err[2] * 3) >> 7);
uint8 * irgb = ( uint8*)&cube216[( r * 6 + g) * 6 + b];
err[0] -= irgb[1];
dth[0] = ( err[0] <= -254 ? ( err[0] =- 127) : err[0] >= +254 ? ( err[0] =+ 127) : ( err[0] >>= 1));
err[1] -= irgb[2];
dth[1] = ( err[1] <= -254 ? ( err[1] =- 127) : err[1] >= +254 ? ( err[1] =+ 127) : ( err[1] >>= 1));
err[2] -= irgb[3];
dth[2] = ( err[2] <= -254 ? ( err[2] = -127) : err[2] >= +254 ? ( err[2] = +127) : ( err[2] >>= 1));
( *buf) += 3;
return irgb[0];
}
inline uint8 dither_gray( uint8 *gray, int16 *err, int8 **buf)
{
int8 *dth = *buf;
unsigned short idx = (( err[0] += ( int16)dth[0] + gray[0]) <= 0x07 ? 0 : err[0] >= 0xF8 ? 0x1F : err[0] >> 3);
uint8 *irgb = ( uint8*)&graymap[idx];
err[0] -= irgb[1];
dth[0] = ( err[0] <= -254 ? ( err[0] = -127) : err[0] >= +254 ? ( err[0] =+ 127) : ( err[0] >>= 1));
(*buf) += 1;
return irgb[0];
}

View File

@@ -0,0 +1,2 @@
extern inline uint8 dither_true ( uint8 * rgb, int16 * err, int8 ** buf);
extern inline uint8 dither_gray( uint8 *gray, int16 *err, int8 **buf);

View File

@@ -0,0 +1,87 @@
#ifdef __PUREC__
#include "..\general.h"
#else
#include "../general.h"
#endif
void ( *planar_to_chunky)( uint8 *in, uint8 *out, int16 width);
inline void planar8_to_chunky8( uint8 *in, uint8 *out, int16 width)
{
uint8 *l;
uint16 x, c, p0, p1, p2, p3, p4, p5, p6, p7;
for( x = 0, l = in; x < width; l += 16)
{
p0 = ( l[0] << 8) | l[1];
p1 = ( l[2] << 8) | l[3];
p2 = ( l[4] << 8) | l[5];
p3 = ( l[6] << 8) | l[7];
p4 = ( l[8] << 8) | l[9];
p5 = ( l[10] << 8) | l[11];
p6 = ( l[12] << 8) | l[13];
p7 = ( l[14] << 8) | l[15];
for ( c = 0; c < 16; c++)
{
out[x++] = ((p0 >> 15) & 1) | ((p1 >> 14) & 2) | ((p2 >> 13) & 4) | ((p3 >> 12) & 8) |
((p4 >> 11) & 16) | ((p5 >> 10) & 32)| ((p6 >> 9) & 64) | ((p7 >> 8) & 128);
p0 <<= 1;
p1 <<= 1;
p2 <<= 1;
p3 <<= 1;
p4 <<= 1;
p5 <<= 1;
p6 <<= 1;
p7 <<= 1;
}
}
}
inline void planar4_to_chunky8( uint8 *in, uint8 *out, int16 width)
{
uint8 *l;
uint16 x, c, p0, p1, p2, p3;
for( x = 0, l = in; x < width; l += 8)
{
p0 = ( l[0] << 8) | l[1];
p1 = ( l[2] << 8) | l[3];
p2 = ( l[4] << 8) | l[5];
p3 = ( l[6] << 8) | l[7];
for ( c = 0; c < 16; c++)
{
out[x++] = ((p0 >> 15) & 1) | ((p1 >> 14) & 2) | ((p2 >> 13) & 4) | ((p3 >> 12) & 8);
p0 <<= 1;
p1 <<= 1;
p2 <<= 1;
p3 <<= 1;
}
}
}
inline void planar2_to_chunky8( uint8 *in, uint8 *out, int16 width)
{
uint8 *l;
uint16 x, c, p0, p1;
for ( x = 0, l = in; x < width; l += 4)
{
p0 = (l[0] << 8) | l[1];
p1 = (l[2] << 8) | l[3];
for (c = 0; c < 16; c++)
{
out[x++] = ((p0 >> 15) & 1) | ((p1 >> 14) & 2);
p0 <<= 1;
p1 <<= 1;
}
}
}

View File

@@ -0,0 +1,5 @@
extern void ( *planar_to_chunky)( uint8 *in, uint8 *out, int16 width);
extern void planar8_to_chunky8( uint8 *in, uint8 *out, int16 width);
extern void planar4_to_chunky8( uint8 *in, uint8 *out, int16 width);
extern void planar2_to_chunky8( uint8 *in, uint8 *out, int16 width);

View File

@@ -0,0 +1,152 @@
#ifdef __PUREC__
#include "..\general.h"
#include "..\load_img.h"
#else
#include "../general.h"
#include "../load_img.h"
#endif
#include "dither.h"
#include "raster.h"
inline void resize_mono ( DECDATA info, void * _dst)
{
uint8 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 4;
uint16 pixel = 0x80, chunk = 0;
do
{
chunk |= ( info->RowBuf[x >> 16] & 1);
chunk <<= 1;
if ( !--width || !(pixel >>= 1))
{
*(dst++) = chunk;
chunk = 0;
pixel = 0x80;
}
x += ( info->IncXfx >> 3);
} while ( width);
}
inline void resize_I4 ( DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx +1) >> 1;
uint8 buf[16];
int16 n = 16;
uint8 *tmp = buf;
do
{
*(tmp++) = *( uint8*)&info->DstBuf[x >> 16];
if (!--width || !--n)
{
raster_chunk4( buf, dst, tmp - buf);
dst += 4;
n = 16;
tmp = buf;
}
x += info->IncXfx;
} while ( width);
}
inline void resize_I8 ( DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx +1) >> 1;
uint8 buf[16];
int16 n = 16;
uint8 *tmp = buf;
do
{
*(tmp++) = *( uint8*)&info->DstBuf[x >> 16];
if (!--width || !--n)
{
raster_chunk8 (buf, dst, tmp - buf);
dst += 8;
n = 16;
tmp = buf;
}
x += info->IncXfx;
} while (width);
}
inline void resize_P8(DECDATA info, void * _dst)
{
uint8 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
do
{
uint8 *rgb = &info->RowBuf[x >> 16];
*(dst++) = *(rgb);
x += info->IncXfx;
} while (--width);
}
inline void resize_16(DECDATA info, void * _dst)
{
uint8 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
do
{
uint8 *rgb = &info->RowBuf[(x >> 16) << 1];
*(dst++) = *(rgb++);
*(dst++) = *(rgb);
x += info->IncXfx;
} while (--width);
}
inline void resize_24(DECDATA info, void * _dst)
{
uint8 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
do
{
uint8 * rgb = &info->RowBuf[(x >>16) * 3];
*(dst++) = *(rgb++);
*(dst++) = *(rgb++);
*(dst++) = *(rgb);
x += info->IncXfx;
} while (--width);
}
inline void resize_32( DECDATA info, void * _dst)
{
uint8 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
do
{
uint8 * rgb = &info->RowBuf[(x >> 16) << 2];
*(dst++) = *(rgb++);
*(dst++) = *(rgb++);
*(dst++) = *(rgb++);
*(dst++) = *(rgb);
x += info->IncXfx;
} while (--width);
}

View File

@@ -0,0 +1,8 @@
extern void resize_mono( DECDATA info, void * _dst);
extern void resize_I4( DECDATA info, void * _dst);
extern void resize_I8( DECDATA info, void * _dst);
extern void resize_P8( DECDATA info, void * _dst);
extern void resize_16( DECDATA info, void * _dst);
extern void resize_24( DECDATA info, void * _dst);
extern void resize_32( DECDATA info, void * _dst);

View File

@@ -0,0 +1,877 @@
#ifdef __PUREC__
#include "..\general.h"
#include "..\load_img.h"
#else
#include "../general.h"
#include "../load_img.h"
#endif
#include "dither.h"
#include "raster.h"
inline void raster_mono ( DECDATA info, void * _dst)
{
uint16 *dst = _dst;
uint32 *map = info->Pixel;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
uint16 pixel = 0x8000;
uint16 chunk = 0;
do
{
if ( map[(int16)info->RowBuf[x >>16] & 1])
chunk |= pixel;
if ( !--width || !(pixel >>= 1))
{
*(dst++) = chunk;
chunk = 0;
pixel = 0x8000;
}
x += info->IncXfx;
} while ( width);
}
inline void raster_D1 ( DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
uint32 *map = info->Pixel;
uint16 mask = info->PixMask;
int16 *buf = info->DthBuf;
int16 ins = 0;
uint16 pixel = 0x8000;
uint16 chunk = 0;
do
{
ins += *buf + map[(int16)info->RowBuf[x >>16] & mask];
if ( ins < 2040)
chunk |= pixel;
else
ins -= 4080;
*(buf++) = (ins >>= 2);
if ( !--width || !(pixel >>= 1))
{
*(dst++) = chunk;
chunk = 0;
pixel = 0x8000;
}
x += info->IncXfx;
} while ( width);
}
inline void gscale_D1( DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = ( info->IncXfx + 1) >> 1;
int16 *buf = info->DthBuf;
int16 ins = 0;
uint16 pixel = 0x8000;
uint16 chunk = 0;
do
{
ins += *buf + ( int16)info->RowBuf[x >>16];
if ( ins < 0x80)
chunk |= pixel;
else
ins -= 0xFF;
*(buf++) = (ins >>= 2);
if ( !--width || !(pixel >>= 1))
{
*(dst++) = chunk;
chunk = 0;
pixel = 0x8000;
}
x += info->IncXfx;
} while (width);
}
inline void dither_D1 ( DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = ( info->IncXfx + 1) >> 1;
int16 *buf = info->DthBuf;
int16 ins = 0;
uint16 pixel = 0x8000;
uint16 chunk = 0;
do
{
uint8 *rgb = &info->RowBuf[(x >>16) *3];
ins += *buf + ( int16)rgb[0] * 5 + ( int16)rgb[1] * 9 + ( int16)rgb[2] * 2;
if (ins < 2040)
chunk |= pixel;
else
ins -= 4080;
*(buf++) = (ins >>= 2);
if (!--width || !(pixel >>= 1))
{
*(dst++) = chunk;
chunk = 0;
pixel = 0x8000;
}
x += info->IncXfx;
} while( width);
}
inline void raster_D2 ( DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = ( info->IncXfx + 1) >> 1;
uint32 *map = info->Pixel;
uint16 mask = info->PixMask;
int16 *buf = info->DthBuf;
int16 ins = 0;
uint16 pixel = 0x8000;
uint16 chunk = 0;
do
{
ins += *buf + map[( int16)info->RowBuf[x >>16] & mask];
if ( ins < 2040)
chunk |= pixel;
else
ins -= 4080;
*(buf++) = (ins >>= 2);
if (!--width || !(pixel >>= 1))
{
*(dst++) = chunk;
*(dst++) = chunk;
chunk = 0;
pixel = 0x8000;
}
x += info->IncXfx;
} while ( width);
}
inline void gscale_D2( DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = ( info->IncXfx + 1) >> 1;
int16 *buf = info->DthBuf;
int16 ins = 0;
uint16 pixel = 0x8000;
uint16 chunk = 0;
do
{
ins += *buf + (short)info->RowBuf[x >>16];
if (ins < 0x80)
chunk |= pixel;
else
ins -= 0xFF;
*(buf++) = (ins >>= 2);
if (!--width || !(pixel >>= 1))
{
*(dst++) = chunk;
*(dst++) = chunk;
chunk = 0;
pixel = 0x8000;
}
x += info->IncXfx;
} while (width);
}
inline void dither_D2 ( DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = ( info->IncXfx + 1) >> 1;
int16 *buf = info->DthBuf;
int16 ins = 0;
uint16 pixel = 0x8000;
uint16 chunk = 0;
do
{
uint8 *rgb = &info->RowBuf[( x >>16) * 3];
ins += *buf + (int16)rgb[0] * 5 + (int16)rgb[1] * 9 + (int16)rgb[2] * 2;
if (ins < 2040)
chunk |= pixel;
else
ins -= 4080;
*(buf++) = (ins >>= 2);
if (!--width || !(pixel >>= 1))
{
*(dst++) = chunk;
*(dst++) = chunk;
chunk = 0;
pixel = 0x8000;
}
x += info->IncXfx;
} while ( width);
}
inline void raster_chunks ( uint8 *src, uint16 *dst, uint16 num, uint16 depth)
{
uint16 mask = 0x8000;
uint16 *chunk = dst;
uint8 pixel = *src;
int16 i = depth;
do
{
*( chunk++) = ( pixel & 1 ? mask : 0);
pixel >>= 1;
} while (--i);
while (--num)
{
mask >>= 1;
chunk = dst;
pixel = *( ++src);
i = depth;
do
{
if ( pixel & 1) *chunk |= mask;
else *chunk &= ~mask;
chunk++;
pixel >>= 1;
} while (--i);
}
}
inline void raster_I4 ( DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx +1) >> 1;
uint8 buf[16];
int16 n = 16;
uint8 *tmp = buf;
do
{
uint16 idx = info->RowBuf[x >>16];
*(tmp++) = *( uint8*)&info->Pixel[idx];
if (!--width || !--n)
{
raster_chunk4( buf, dst, tmp - buf);
dst += 4;
n = 16;
tmp = buf;
}
x += info->IncXfx;
} while ( width);
}
inline void gscale_I4( DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx +1) >> 1;
int8 *dth = info->DthBuf;
int16 err = 0;
uint8 buf[16];
int16 n = 16;
uint8 *tmp = buf;
do
{
*(tmp++) = dither_gray (&info->RowBuf[x >>16], &err, &dth);
if (!--width || !--n)
{
raster_chunk4 (buf, dst, tmp - buf);
dst += 4;
n = 16;
tmp = buf;
}
x += info->IncXfx;
} while (width);
}
inline void dither_I4 ( DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx +1) >> 1;
int8 *dth = info->DthBuf;
int16 err[3] = { 0, 0, 0 };
uint8 buf[16];
int16 n = 16;
uint8 *tmp = buf;
do
{
*(tmp++) = dither_true (&info->RowBuf[(x >>16) *3], err, &dth);
if (!--width || !--n)
{
raster_chunk4 (buf, dst, tmp - buf);
dst += 4;
n = 16;
tmp = buf;
}
x += info->IncXfx;
} while (width);
}
inline void raster_I8 ( DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx +1) >> 1;
uint8 buf[16];
int16 n = 16;
uint8 *tmp = buf;
do
{
uint16 idx = info->RowBuf[x >>16];
*(tmp++) = *(uint8*)&info->Pixel[idx];
if (!--width || !--n)
{
raster_chunk8 (buf, dst, tmp - buf);
dst += 8;
n = 16;
tmp = buf;
}
x += info->IncXfx;
} while (width);
}
inline void gscale_I8( DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
int8 *dth = info->DthBuf;
int16 err = 0;
uint8 buf[16];
int16 n = 16;
uint8 *tmp = buf;
do
{
*(tmp++) = dither_gray (&info->RowBuf[x >>16], &err, &dth);
if (!--width || !--n) {
raster_chunk8 (buf, dst, tmp - buf);
dst += 8;
n = 16;
tmp = buf;
}
x += info->IncXfx;
} while (width);
}
inline void dither_I8 (DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
int8 *dth = info->DthBuf;
int16 err[3] = { 0, 0, 0 };
uint8 buf[16];
int16 n = 16;
uint8 *tmp = buf;
do
{
*(tmp++) = dither_true (&info->RowBuf[(x >>16) *3], err, &dth);
if (!--width || !--n)
{
raster_chunk8 (buf, dst, tmp - buf);
dst += 8;
n = 16;
tmp = buf;
}
x += info->IncXfx;
} while ( width);
}
inline void raster_P8 (DECDATA info, void * _dst)
{
uint8 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
uint32 *map = info->Pixel;
uint16 mask = info->PixMask;
do
{
*(dst++) = *( uint8*)&map[( int16)info->RowBuf[x >>16] & mask];
x += info->IncXfx;
} while (--width);
}
inline void gscale_P8( DECDATA info, void * _dst)
{
uint8 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
int8 *dth = info->DthBuf;
int16 err = 0;
do
{
*(dst++) = dither_gray (&info->RowBuf[x >>16], &err, &dth);
x += info->IncXfx;
} while (--width);
}
inline void dither_P8 (DECDATA info, void * _dst)
{
uint8 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
int8 *dth = info->DthBuf;
int16 err[3] = { 0, 0, 0 };
do
{
*(dst++) = dither_true (&info->RowBuf[(x >>16) *3], err, &dth);
x += info->IncXfx;
} while (--width);
}
inline void raster_15 (DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
uint32 *map = info->Pixel;
uint16 mask = info->PixMask;
do
{
*(dst++) = map[(short)info->RowBuf[x >>16] & mask];
x += info->IncXfx;
} while (--width);
}
inline void gscale_15( DECDATA info, void * _dst)
{
uint16 * dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
do
{
uint16 rgb = info->RowBuf[(x >>16)];
rgb = ((rgb & 0xF8) <<7) | ((rgb & 0xF8) <<2) | (rgb >>3);
*(dst++) = (rgb >> 8) | (rgb << 8);
x += info->IncXfx;
} while (--width);
}
inline void dither_15 (DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
do {
uint8 * rgb = &info->RowBuf[(x >>16) * 3];
*(dst++) = (((uint16)rgb[0] & 0xF8) << 7) | (((uint16)rgb[1] & 0xF8) << 2) | ( rgb[2] >> 3);
x += info->IncXfx;
} while (--width);
}
inline void raster_15r (DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
uint32 *map = info->Pixel;
uint16 mask = info->PixMask;
do
{
uint16 rgb = map[(short)info->RowBuf[x >>16] & mask];
*(dst++) = (rgb >> 8) | (rgb << 8);
x += info->IncXfx;
} while (--width);
}
inline void gscale_15r( DECDATA info, void * _dst)
{
uint16 * dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
do
{
uint16 rgb = info->RowBuf[(x >>16)];
rgb = ((rgb & 0xF8) <<7) | ((rgb & 0xF8) <<2) | (rgb >>3);
*(dst++) = (rgb >> 8) | (rgb << 8);
x += info->IncXfx;
} while (--width);
}
inline void dither_15r (DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
do
{
uint8 * rgb = &info->RowBuf[(x >>16) * 3];
uint16 pix = (((uint16)rgb[0] & 0xF8) << 7) | (((uint16)rgb[1] & 0xF8) << 2) | (rgb[2] >> 3);
*(dst++) = (pix >> 8) | (pix << 8);
x += info->IncXfx;
} while (--width);
}
inline void raster_16 (DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
uint32 *map = info->Pixel;
uint16 mask = info->PixMask;
do
{
*(dst++) = map[(int16)info->RowBuf[x >>16] & mask];
x += info->IncXfx;
} while (--width);
}
inline void gscale_16( DECDATA info, void * _dst)
{
register uint16 *dst = _dst;
register int16 width = info->DthWidth;
register uint32 x = (info->IncXfx + 1) >> 1;
do
{
uint16 rgb = info->RowBuf[(x >>16)];
*(dst++) = ((rgb & 0xF8) <<8) | ((rgb & 0xFC) <<3) | (rgb >>3);
x += info->IncXfx;
} while (--width);
}
inline void dither_16 (DECDATA info, void * _dst)
{
register uint16 *dst = _dst;
register int16 width = info->DthWidth;
register uint32 x = (info->IncXfx + 1) >> 1;
do
{
register uint8 *rgb = &info->RowBuf[(x >> 16) * 3];
*(dst++) = (((uint16)rgb[0] & 0xF8) << 8) | (((uint16)rgb[1] & 0xFC) << 3) | ( rgb[2] >> 3);
x += info->IncXfx;
} while (--width);
}
inline void raster_16r (DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
uint32 *map = info->Pixel;
uint16 mask = info->PixMask;
do
{
uint16 rgb = map[(int16)info->RowBuf[x >>16] & mask];
*(dst++) = (rgb >> 8) | (rgb << 8);
x += info->IncXfx;
} while (--width);
}
inline void gscale_16r( DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
do
{
uint16 rgb = info->RowBuf[(x >>16)];
rgb = ((rgb & 0xF8) <<8) | ((rgb & 0xFC) <<3) | (rgb >>3);
*(dst++) = (rgb >> 8) | (rgb << 8);
x += info->IncXfx;
} while (--width);
}
inline void dither_16r (DECDATA info, void * _dst)
{
uint16 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
do
{
uint8 * rgb = &info->RowBuf[(x >>16) *3];
uint16 pix = ((( uint16)rgb[0] & 0xF8) << 8) | ((( uint16)rgb[1] & 0xFC) << 3) | ( rgb[2] >> 3);
*(dst++) = (pix >> 8) | (pix << 8);
x += info->IncXfx;
} while (--width);
}
inline void raster_24 (DECDATA info, void * _dst)
{
uint8 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
uint32 *map = info->Pixel;
uint16 mask = info->PixMask;
do
{
uint8 * rgb = (uint8*)&map[( int16)info->RowBuf[x >>16] & mask];
*(dst++) = *(++rgb);
*(dst++) = *(++rgb);
*(dst++) = *(++rgb);
x += info->IncXfx;
} while (--width);
}
inline void gscale_24( DECDATA info, void * _dst)
{
uint8 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
do
{
uint8 rgb = info->RowBuf[(x >>16)];
*(dst++) = rgb;
*(dst++) = rgb;
*(dst++) = rgb;
x += info->IncXfx;
} while (--width);
}
inline void dither_24 (DECDATA info, void * _dst)
{
uint8 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
do
{
uint8 * rgb = &info->RowBuf[(x >>16) *3];
*(dst++) = *(rgb++);
*(dst++) = *(rgb++);
*(dst++) = *(rgb);
x += info->IncXfx;
} while (--width);
}
inline void raster_24r (DECDATA info, void * _dst)
{
uint8 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
uint32 *map = info->Pixel;
uint16 mask = info->PixMask;
do
{
uint8 * rgb = (uint8*)&map[(int16)info->RowBuf[x >>16] & mask];
*(dst++) = rgb[3];
*(dst++) = rgb[2];
*(dst++) = rgb[1];
x += info->IncXfx;
} while (--width);
}
inline void gscale_24r( DECDATA info, void * _dst)
{
uint8 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
do
{
uint8 rgb = info->RowBuf[(x >> 16)];
*(dst++) = rgb;
*(dst++) = rgb;
*(dst++) = rgb;
x += info->IncXfx;
} while (--width);
}
inline void dither_24r( DECDATA info, void * _dst)
{
uint8 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
do
{
uint8 * rgb = &info->RowBuf[(x >> 16) *3];
*(dst++) = rgb[2];
*(dst++) = rgb[1];
*(dst++) = rgb[0];
x += info->IncXfx;
} while (--width);
}
inline void raster_32 (DECDATA info, void * _dst)
{
uint32 * dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
uint32 *map = info->Pixel;
uint16 mask = info->PixMask;
do
{
*(dst++) = map[(int16)info->RowBuf[x >> 16] & mask];
x += info->IncXfx;
} while (--width);
}
inline void gscale_32( DECDATA info, void * _dst)
{
uint32 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
do
{
uint32 rgb = info->RowBuf[(x >> 16)];
*(dst++) = ((( rgb << 8) | rgb) << 8) | rgb;
x += info->IncXfx;
} while (--width);
}
inline void dither_32 (DECDATA info, void * _dst)
{
uint32 * dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
do
{
uint8 * rgb = &info->RowBuf[(x >> 16) *3];
*(dst++) = ((((uint32)rgb[0] << 8) | rgb[1]) << 8) | rgb[2];
x += info->IncXfx;
} while (--width);
}
inline void raster_32r( DECDATA info, void * _dst)
{
uint32 * dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
uint32 *map = info->Pixel;
uint16 mask = info->PixMask;
do
{
uint8 * rgb = (uint8*)&map[(int16)info->RowBuf[x >>16] & mask];
*(dst++) = (((((int32)rgb[3] << 8) | rgb[2]) << 8) | rgb[1]) << 8;
x += info->IncXfx;
} while (--width);
}
inline void gscale_32r( DECDATA info, void * _dst)
{
uint32 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
do
{
uint32 rgb = info->RowBuf[(x >>16)];
*(dst++) = (((( rgb << 8) | rgb) << 8) | rgb) << 8;
x += info->IncXfx;
} while (--width);
}
inline void dither_32r (DECDATA info, void * _dst)
{
uint32 * dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx + 1) >> 1;
do
{
uint8 * rgb = &info->RowBuf[(x >>16) *3];
*(dst++) = (((((uint32)rgb[2] <<8) | rgb[1]) << 8) | rgb[0]) << 8;
x += info->IncXfx;
} while (--width);
}
inline void raster_32z ( DECDATA info, void * _dst)
{
uint32 * dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx +1) >> 1;
uint32 * map = info->Pixel;
uint16 mask = info->PixMask;
do {
*(dst++) = map[(int16)info->RowBuf[x >>16] & mask] << 8;
x += info->IncXfx;
} while (--width);
}
inline void gscale_32z (DECDATA info, void * _dst)
{
uint32 * dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx +1) >> 1;
do {
uint32 rgb = info->RowBuf[(x >>16)];
*(dst++) = ((((rgb <<8) | rgb) <<8) | rgb) << 8;
x += info->IncXfx;
} while (--width);
}
inline void dither_32z (DECDATA info, void * _dst)
{
uint32 *dst = _dst;
int16 width = info->DthWidth;
uint32 x = (info->IncXfx +1) >> 1;
do {
uint8 * rgb = &info->RowBuf[(x >>16) *3];
*(dst++) = (((((uint32)rgb[0] <<8) | rgb[1]) <<8) | rgb[2]) << 8;
x += info->IncXfx;
} while (--width);
}

View File

@@ -0,0 +1,63 @@
extern void raster_chunks ( uint8 *src, uint16 *dst, uint16 num, uint16 depth);
#define raster_chunk4(s,d,n) raster_chunks ( s, d, n, 4)
#define raster_chunk8(s,d,n) raster_chunks ( s, d, n, 8)
extern void raster_mono ( DECDATA info, void * _dst);
extern void raster_D1 ( DECDATA info, void * _dst);
extern void dither_D1 ( DECDATA info, void * _dst);
extern void gscale_D1 ( DECDATA info, void * _dst);
extern void raster_D2 ( DECDATA info, void * _dst);
extern void dither_D2 ( DECDATA info, void * _dst);
extern void gscale_D2 ( DECDATA info, void * _dst);
extern void raster_I4 ( DECDATA info, void * _dst);
extern void dither_I4 ( DECDATA info, void * _dst);
extern void gscale_I4 ( DECDATA info, void * _dst);
extern void raster_I8 ( DECDATA info, void * _dst);
extern void dither_I8 ( DECDATA info, void * _dst);
extern void gscale_I8 ( DECDATA info, void * _dst);
extern void raster_P8 ( DECDATA info, void * _dst);
extern void dither_P8 ( DECDATA info, void * _dst);
extern void gscale_P8 ( DECDATA info, void * _dst);
extern void raster_15 ( DECDATA info, void * _dst);
extern void dither_15 ( DECDATA info, void * _dst);
extern void gscale_15 ( DECDATA info, void * _dst);
extern void raster_15r ( DECDATA info, void * _dst);
extern void dither_15r ( DECDATA info, void * _dst);
extern void gscale_15r ( DECDATA info, void * _dst);
extern void raster_16 ( DECDATA info, void * _dst);
extern void dither_16 ( DECDATA info, void * _dst);
extern void gscale_16 ( DECDATA info, void * _dst);
extern void raster_16r ( DECDATA info, void * _dst);
extern void dither_16r ( DECDATA info, void * _dst);
extern void gscale_16r ( DECDATA info, void * _dst);
extern void raster_24 ( DECDATA info, void * _dst);
extern void dither_24 ( DECDATA info, void * _dst);
extern void gscale_24 ( DECDATA info, void * _dst);
extern void raster_24r ( DECDATA info, void * _dst);
extern void dither_24r ( DECDATA info, void * _dst);
extern void gscale_24r ( DECDATA info, void * _dst);
extern void raster_32 ( DECDATA info, void * _dst);
extern void dither_32 ( DECDATA info, void * _dst);
extern void gscale_32 ( DECDATA info, void * _dst);
extern void raster_32r ( DECDATA info, void * _dst);
extern void dither_32r ( DECDATA info, void * _dst);
extern void gscale_32r ( DECDATA info, void * _dst);
extern void raster_32z ( DECDATA info, void * _dst);
extern void dither_32z ( DECDATA info, void * _dst);
extern void gscale_32z ( DECDATA info, void * _dst);

View File

@@ -0,0 +1,221 @@
#ifdef __PUREC__
#include "..\general.h"
#include "..\resize.h"
#include "..\load_img.h"
#else
#include "../general.h"
#include "../load_img.h"
#include "../resize.h"
#endif
#include "raster.h"
#include "raresize.h"
#include "color.h"
#include "p2c.h"
int16 pixel_val[256];
uint32 cube216[216];
uint32 graymap[32];
int16 planar = 0;
int16 vdi_handle, nplanes, vdi_work_in[10], vdi_work_out[57];
/* prototype */
int16 vdi_init ( void);
int16 vdi_init( void)
{
int16 out[273] = { -1, };
int16 dum, depth, aes_handle;
boolean reverse, z_trail;
int32 cookie_dum;
if( !ldg_cookie( 0x45644449L, (int32*)&cookie_dum))
return( 0);
/* open a VDI workstation */
aes_handle = graf_handle( &dum, &dum, &dum, &dum);
vq_extnd( aes_handle, 1, vdi_work_out);
nplanes = vdi_work_out[ 4];
vdi_work_in[0] = Getrez() + 2;
vdi_handle = aes_handle;
v_opnvwk( vdi_work_in, &vdi_handle, vdi_work_out);
/* Get the screen's informations */
vq_scrninfo ( vdi_handle, out);
if ( nplanes <= 8)
{
save_colors();
memcpy ( pixel_val, out + 16, 512);
}
depth = (( uint16)out[4] == 0x8000u ? 15 : out[2]); /* bits per pixel used */
reverse = (out[16] < out[48]); /* intel crap... */
z_trail = (out[48] > 0); /* bits are shifted to the right side */
if ( depth == 1)
{ /* monochrome */
cnvpal_color = cnvpal_1_2;
raster_cmap = raster_D1;
raster_true = dither_D1;
raster_gray = gscale_D1;
resize = resize_mono;
}
else if ( out[0] == 0) /* Planar */
{
planar = 1;
switch ( depth)
{
case 2:
cnvpal_color = cnvpal_1_2;
raster_cmap = raster_D2;
raster_true = dither_D2;
raster_gray = gscale_D2;
planar_to_chunky = planar2_to_chunky8;
break;
case 4:
cnvpal_color = cnvpal_4_8;
raster_cmap = raster_I4;
raster_true = dither_I4;
raster_gray = gscale_I4;
resize = resize_I4;
planar_to_chunky = planar4_to_chunky8;
break;
case 8:
cnvpal_color = cnvpal_4_8;
raster_cmap = raster_I8;
raster_true = dither_I8;
raster_gray = gscale_I8;
resize = resize_I8;
planar_to_chunky = planar8_to_chunky8;
break;
}
}
else if ( out[0] == 2) /* chunky */
switch ( depth)
{
case 8:
cnvpal_color = cnvpal_4_8;
raster_cmap = raster_P8;
raster_true = dither_P8;
raster_gray = gscale_P8;
resize = resize_P8;
break;
case 15:
if (!(out[14] & 0x02))
{
cnvpal_color = cnvpal_15;
if (reverse)
{
raster_cmap = raster_15r;
raster_gray = gscale_15r;
raster_true = dither_15r;
}
else
{
raster_cmap = raster_15;
raster_gray = gscale_15;
raster_true = dither_15;
}
resize = resize_16;
break;
}
case 16:
cnvpal_color = cnvpal_high;
if (reverse)
{
raster_cmap = raster_16r;
raster_gray = gscale_16r;
raster_true = dither_16r;
}
else
{
raster_cmap = raster_16;
raster_gray = gscale_16;
raster_true = dither_16;
}
resize = resize_16;
break;
case 24:
cnvpal_color = cnvpal_true;
if (reverse)
{
raster_cmap = raster_24r;
raster_gray = gscale_24r;
raster_true = dither_24r;
}
else
{
raster_cmap = raster_24;
raster_gray = gscale_24;
raster_true = dither_24;
}
resize = resize_24;
break;
case 32:
cnvpal_color = cnvpal_true;
if (reverse)
{
raster_cmap = raster_32r;
raster_gray = gscale_32r;
raster_true = dither_32r;
}
else if( z_trail)
{
raster_cmap = raster_32z;
raster_gray = gscale_32z;
raster_true = dither_32z;
}
else
{
raster_cmap = raster_32;
raster_gray = gscale_32;
raster_true = dither_32;
}
resize = resize_32;
break;
}
if (depth == 4 || depth == 8)
{
uint32 * dst;
uint32 r, g, b;
dst = cube216;
for (r = 0x000000uL; r <= 0xFF0000uL; r += 0x330000uL)
{
for (g = 0x000000uL; g <= 0x00FF00uL; g += 0x003300uL)
{
for (b = 0x000000uL; b <= 0x0000FFuL; b += 0x000033uL)
{
*(dst++) = color_lookup ( r | g | b, pixel_val);
}
}
}
dst = graymap;
for ( g = 0x000000uL; g <= 0xF8F8F8uL; g += 0x080808uL)
*( dst++) = color_lookup ( g | (( g >> 5) & 0x030303uL), pixel_val);
}
return( 1);
}

View File

@@ -0,0 +1,7 @@
extern int16 pixel_val[256];
extern uint32 cube216[216];
extern uint32 graymap[32];
extern int16 vdi_init( void);
extern int16 planar, vdi_handle, nplanes, vdi_work_in[10], vdi_work_out[57];

View File

@@ -0,0 +1,355 @@
@database "zcodeclib Dev. Guide"
@subject "Documentation"
@author "Zorro"
@$VER: ZCODEC.HYP (@:"__DATE__")
@options +Z
@options -S
@default Index
@node Index "zcodeclib dev."
zcodeclib dev.
@line 1 70 0 0 1
1. Introduction
2. Functions
3. Global variables
4. The IMAGE structure.
5. Do you use MEM.LDG in your application?
@endnode
@node "Introduction"
1. Introduction
@line 1 70 0 0 1
Make a basic GEM application is a very easy task but problems
become when we have to draw something on the screen.
Indeed, on Atari and others TOS computers, there are many
different screens' formats and, of course, we can't deal with
it in the same manner.
The problem is worst when we have to load and to draw a picture
from, for example, a JPG file. We have to make ourselves loading
routines, etc... A real nightmare!
The goal of this library is to offer easy and fast functions for
load images from file and for, especially, deal with the screen.
It provide also useful functions like MFDB zooming and others.
This library load and use the zview's codecs, so it's fast and
stable.
@{B}For use this library, you need:@{0}
- A VDI with a valid EDDI (like NovaVDI, NVDI > 2.5, fVDI, etc..).
- The zview's codec correctly installed with mem.ldg (provided in
the zview archive).
- the LDG library ( http://ldg.org.free.fr)
- A recent GEMLIB.
(Index)
@endnode
@node "Functions"
2. Functions
@line 1 70 0 0 1
1. codecs_init()
2. codecs_quit()
3. load_img()
4. delete_img()
5. pic_resize()
6. delete_mfdb()
(Index)
@endnode
@node "codecs_init()"
codecs_init()
@line 1 70 0 0 1
@{B}NAME@{0}
codec_init - initialise and load the wanted codecs.
@{B}PROTOTYPAGE@{0}
int16 codecs_init( char *codec_name);
@{B}PARAMETERS@{0}
codec_name: the name of the codec to load.
return: 0 if an error occurs else 1.
@{B}DESCRIPTION@{0}
It's the first function to call.
The function's job is to initialize the VDI's informations,
load MEM.LDG ( for shareable allocation) and load the wanted
codecs.
For example:
codecs_init( "jpg.ldg");
If you need others codecs, you can to call this function any
numbers of times like:
codecs_init( "jpg.ldg");
codecs_init( "png.ldg");
....
Cool feature, you can load the complete codec's pack with:
codec_init( "all");
@{B}IMPORTANT@{0}
Be careful, you can't load two times the same codec so, don't
call again this function after a codec_init( "all").
(Index)
@endnode
@node "codecs_quit()"
codecs_quit()
@line 1 70 0 0 1
@{B}NAME@{0}
codecs_quit - unload the codecs and MEM.LDG.
@{B}PROTOTYPAGE@{0}
void codecs_quit( void);
@{B}DESCRIPTION@{0}
You must call this function at the end of your code or when we
don't use anymore the functions form this library.
It unloads MEM.LDG and the codecs previously loaded.
(Index)
@endnode
@node "load_img()"
load_img()
@line 1 70 0 0 1
@{B}NAME@{0}l
load_img() - load, convert and zoom a image.
@{B}PROTOTYPAGE@{0}
IMAGE *load_img( const char *file, int16 w, int16 h, int16 keep_ratio);
@{B}PARAMETERS@{0}
file: the file to load.
w: the wanted image's width.
-1 for to keep the image's width.
h: the wanted image's height.
-1 for to keep the image's height.
keep_ratio: in the case where you set the wanted image's size
with the w and h variables, if 'keep_ratio' if TRUE,
the image is resized to fit in w and h for maintain
the aspect ratio else the image will be exactly at
the wanted size.
return: NULL if an error occurs else a valid IMAGE structure.
@{B}DESCRIPTION@{0}
The most important function of this library; it loads, converts
to screen format and eventually, zooms a picture. All in one
function!
@{B}IMPORTANT@{0}
Don't allocate the IMG structure yourself, the function make it
for you (see example.c).
(Index)
@endnode
@endnode
@node "delete_img()"
delete_img()
@line 1 70 0 0 1
@{B}NAME@{0}
delete_img - free a IMAGE structure.
@{B}PROTOTYPAGE@{0}
void delete_img( IMAGE *img);
@{B}DESCRIPTION@{0}
This function frees all the memories previously allocated for
the "img" structure and also "img" itself.
(Index)
@endnode
@node "pic_resize()"
pic_resize()
@line 1 70 0 0 1
@{B}NAME@{0}l
pic_resize() - resize a MFDB.
@{B}PROTOTYPAGE@{0}
MFDB *pic_resize( MFDB *in, int16 w, int16 h, int16 keep_ratio);
@{B}PARAMETERS@{0}
in: the input MFDB address.
w: the wanted MFDB's width.
h: the wanted MFDB's height.
keep_ratio: if 'keep_ratio' if TRUE, the MFDB is resized for to
fit in 'w' and 'h' for maintain the aspect ratio
else the MFDB will be exactly at the 'w' and 'h' size.
return: NULL if an error occurs else a valid MFDB address.
@{B}DESCRIPTION@{0}
Return a MFDB resized with the data of 'in'.
@{B}IMPORTANT@{0}
1) Don't allocate the "out" MFDB yourself, the function make it
for you (see example.c).
2) You can't free the MFDB youself, use delete_mfdb() for do that.
(Index)
@endnode
@node "delete_mfdb()"
delete_mfdb()
@line 1 70 0 0 1
@{B}NAME@{0}l
delete_mfdb() - delete one or more MFDB structure(s).
@{B}PROTOTYPAGE@{0}
void delete_mfdb( MFDB *bm, int16 nbr);
@{B}PARAMETERS@{0}
bm: the MFDB to free.
nbr: the number of MFDB in 'bm'.
return: nothing.
@{B}DESCRIPTION@{0}
Free one or more MFDB created with pic_resize().
(Index)
@endnode
@node "Global variables"
Global variables
@line 1 70 0 0 1
All this global variable are in in16 format( short).
planar: The screen format, 1 if planar else 0.
nplanes: the screen planes' number.
vdi_work_in[10], vdi_work_out[57]: useful information about
the VDI.
vdi_handle: a "ready to use" VDI handle.
(Index)
@endnode
@node "IMAGE"
IMAGE
@line 1 70 0 0 1
typedef struct
{
int16 page;
uint16 *delay;
MFDB *image;
} IMAGE;
delay: exists only if the image is a animated one ( for example:
animated GIF, FLI, etc..).
page: is the number of image returned (For animated picture or
multi-pages documents like FAX).
image: is one of many MFDB structure(s) ready to be transferred to
the screen.
@endnode
@node "Do you use MEM.LDG in your application?"
Do you use MEM.LDG in your application?
@line 1 70 0 0 1
Libzcodec loads already the MEM.LDG so you can't do it again in your
code!
For this prupose, in the header's file, we can find
'shared_malloc( a)' and 'shared_free( a)'.
This functions are only ldg_malloc() and ldg_free() binded; you
can use it without any problem and if far better that Mintlib malloc's
function.
If you need ldg_realloc or ldg_calloc, you need to make a
ldg_find( "ldg_calloc", ldg_mem) youself. ( ldg_mem is a global
variable used for load MEM.LDG).
@endnode

View File

@@ -0,0 +1,49 @@
CROSS = no
ifeq ($(CROSS),yes)
CC = m68k-atari-mint-gcc
STRIP = m68k-atari-mint-strip
STACK = m68k-atari-mint-stack
LIBXML = /usr/m68k-atari-mint/include/libxml2
FLAGS = m68k-atari-mint-flags -r
else
CC = gcc
STRIP = strip
STACK = stack
LIBXML = /usr/include/libxml2
FLAGS = flags -r
endif
COMPRESS = upx -9
STACKSIZE = 64k
OPTIMISATION = -O2 -fomit-frame-pointer -finline-functions
CPU = -m68020-60
LIB = -lwindom1 -lzcodec -lldg -lgem -lxml2 -lm -lmem -lz
CFLAGS = $(CPU) $(OPTIMISATION) -Wall -Wshadow -I$(LIBXML)
ifeq ($(CROSS),no)
CFLAGS += -I/usr/local/include
LDFLAGS += -L/usr/local/lib/m68020-60
endif
OBJ = inet.o http_client.o parsers.o get_data.o \
debug.o zstring.o dialog.o prefs.o zaes.o icon.o main.o
PROGRAM = zweather.app
all: $(PROGRAM) stack strip compress
$(PROGRAM): $(OBJ)
$(CC) $(CPU) $(OPTIMISATION) -o $@ $(OBJ) $(LDFLAGS) $(LIB)
strip:
$(STRIP) -s $(PROGRAM)
stack:
$(STACK) -S $(STACKSIZE) $(PROGRAM)
compress:
$(COMPRESS) $(PROGRAM)
$(FLAGS) $(PROGRAM)
clean:
rm -f *.o *.app *~

View File

@@ -0,0 +1,28 @@
#include "general.h"
/*==================================================================================*
* void zdebug: *
* print debug information in 'wout' window. *
*----------------------------------------------------------------------------------*
* input: *
* ... -> text and parameter are the same that sandard "printf" function. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void zdebug( const char *format, ...)
{
#ifdef DEBUG
va_list args;
char fo_buff[255], *p;
va_start( args, format);
vsprintf( fo_buff, format, args);
p = fo_buff;
va_end( args);
wout_printf("%s\n", p);
#endif
}

View File

@@ -0,0 +1,194 @@
#include "general.h"
#include "icon.h"
#include "parsers.h"
extern struct xml_weather *zweatherdata;
extern int8 wind_direction[8];
extern void init_stik (void);
WINDOW *windialog = NULL;
int16 hcell = 0;
int8 icon_temp[8] = "";
/*==================================================================================*
* void WindIconify: *
* Function to handle iconfied windows drawing... If the icon doesn't exist, *
* It is created. *
*----------------------------------------------------------------------------------*
* input: *
* win -> the window to handle. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
static void WindIconify( WINDOW *win)
{
int16 posx, posy, x, y, w, h, xy[8];
MFDB screen = {0};
MFDB *iconified_icon = &main_icon->image[0];
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
xy[0] = x;
xy[1] = y;
xy[2] = xy[0] + w - 1;
xy[3] = xy[1] + h - 1;
vsf_color( win->graf.handle, LWHITE);
v_bar( win->graf.handle, xy);
posx = MAX( x + (( w - iconified_icon->fd_w) >> 1), x);
posy = MAX( y + (( h - iconified_icon->fd_h) >> 1), y);
if (posx == x)
xy[2] = w - 1;
else
xy[2] = iconified_icon->fd_w - 1;
if (posy == y)
xy[3] = h - 1;
else
xy[3] = iconified_icon->fd_h - 1;
xy[0] = 0;
xy[1] = 0;
xy[4] = posx;
xy[5] = posy;
xy[6] = posx + xy[2];
xy[7] = posy + xy[3];
/* draw the image */
if ( iconified_icon->fd_nplanes == 1)
{
int16 color[2] = { BLACK, WHITE};
vrt_cpyfm( win->graf.handle, MD_REPLACE, xy, iconified_icon, &screen, color);
}
else
vro_cpyfm( win->graf.handle, S_ONLY, xy, iconified_icon, &screen);
v_ftext( win->graf.handle, x + w - 2, y + h - hcell, icon_temp);
}
/*
void send_iconify( void)
{
WindSet( windialog, WF_ICONIFY, 0, 1, 0, 1);
ObjcChange( OC_FORM, windialog, WEATHER_ICONIFY, NORMAL, 0);
}
*/
static void sting_layer( WINDOW *win, int16 obj_index)
{
use_sting = ( use_sting == TRUE ? FALSE : TRUE);
/* a wait loop while the mouse button is pressed */
while(( evnt.mbut == 1) || ( evnt.mbut == 2))
graf_mkstate( &evnt.mx, &evnt.my, &evnt.mbut, &evnt.mkstate);
}
void force_update( void)
{
OBJECT *weather_form = get_tree( WEATHER);
int time_minute;
graf_mouse( BUSYBEE, NULL);
if( EvntFind( NULL, WM_XTIMER))
EvntDelete( NULL, WM_XTIMER);
if( zweatherdata)
xml_weather_free( zweatherdata);
if( use_sting)
init_stik();
strcpy( location_code, ObjcString( weather_form, WEATHER_CODE, NULL));
zweatherdata = update_weatherdata( location_code);
time_minute = atoi( ( const char*)ObjcString( weather_form, WEATHER_UPDATE_TIME, NULL));
update_time = ( clock_t)( ( int32)time_minute * 12000L);
ObjcChange( OC_FORM, windialog, WEATHER_UPDATE, NORMAL, 0);
snd_rdw( windialog);
EvntAttach( NULL, WM_XTIMER, timer_function);
graf_mouse( ARROW, NULL);
}
void weather_dialog( void)
{
OBJECT *weather_form = get_tree( WEATHER);
int frms[] = { WEATHER_PANEL1, WEATHER_PANEL2, WEATHER_PANEL3};
int buts[] = { WEATHER_MAIN, WEATHER_FORECAST, WEATHER_PREF};
int time_minute = ( int)( update_time / 12000L);
int16 dum;
strcpy( ObjcString( weather_form, WEATHER_CODE, NULL), location_code);
sprintf( ObjcString( weather_form, WEATHER_UPDATE_TIME, NULL), "%d", time_minute);
if( use_sting == 1)
ObjcChange( OC_OBJC, weather_form, WEATHER_STING, SELECTED, 0);
else
ObjcChange( OC_OBJC, weather_form, WEATHER_STING, NORMAL, 0);
windialog = FormCreate( weather_form, NAME|MOVER|SMALLER, NULL, " zWeather ", NULL, TRUE, FALSE);
RsrcUserDraw( OC_FORM, windialog, WEATHER_ICON, draw_weather_icon, NULL);
RsrcUserDraw( OC_FORM, windialog, WEATHER_ICON1, draw_forecast1_icon, NULL);
RsrcUserDraw( OC_FORM, windialog, WEATHER_ICON2, draw_forecast2_icon, NULL);
RsrcUserDraw( OC_FORM, windialog, WEATHER_ICON3, draw_forecast3_icon, NULL);
RsrcUserDraw( OC_FORM, windialog, WEATHER_ICON4, draw_forecast4_icon, NULL);
RsrcUserDraw( OC_FORM, windialog, WEATHER_ICON5, draw_forecast5_icon, NULL);
RsrcUserDraw( OC_FORM, windialog, WEATHER_ICON6, draw_forecast6_icon, NULL);
RsrcUserDraw( OC_FORM, windialog, WEATHER_WICON, draw_boussole_icon, NULL);
FormThumb( windialog, frms, buts, 3);
if( main_icon == NULL)
main_icon = icons[25];
if( forecast_icon[0] == NULL)
forecast_icon[0] = icons[25];
if( forecast_icon[1] == NULL)
forecast_icon[1] = icons[25];
if( forecast_icon[2] == NULL)
forecast_icon[2] = icons[25];
if( forecast_icon[3] == NULL)
forecast_icon[3] = icons[25];
if( forecast_icon[4] == NULL)
forecast_icon[4] = icons[25];
if( forecast_icon[5] == NULL)
forecast_icon[5] = icons[25];
ObjcAttach( OC_FORM, windialog, WEATHER_METRIC, BIND_VAR, &unit);
ObjcAttach( OC_FORM, windialog, WEATHER_IMPERIAL, BIND_VAR, &unit);
ObjcAttach( OC_FORM, windialog, WEATHER_UPDATE, BIND_FUNC, force_update);
ObjcAttach( OC_FORM, windialog, WEATHER_STING, BIND_FUNC, sting_layer);
ObjcAttach( OC_FORM, windialog, WEATHER_QUIT, BIND_FUNC, applexit);
vswr_mode( windialog->graf.handle, MD_TRANS);
vst_point( windialog->graf.handle, 8, &dum, &dum, &dum, &hcell);
vst_alignment( windialog->graf.handle, 2, 5, &dum, &dum);
vst_color( windialog->graf.handle, LBLUE);
vsl_color( windialog->graf.handle, RED);
hcell++;
WindSetStr( windialog, WF_ICONDRAW, WindIconify);
// EvntAttach( wininfo, WM_CLOSED, close_modal);
}

View File

@@ -0,0 +1,72 @@
/*
* zView.
* Copyright (c) 2004 Zorro ( zorro270@yahoo.fr)
*
* This application is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This application 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <osbind.h>
#include <mintbind.h>
#include <dirent.h>
#include <errno.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
#include <windom1.h>
#include <scancode.h>
#include <ldg.h>
#include <ldg/mem.h>
#ifdef DEBUG
#include <wout.h>
#endif
#include <libxml/parser.h>
#include <types2b.h>
#include <zcodec.h>
#include "zstring.h"
#include "zaes.h"
#include "prefs.h"
#include "zweather.rsh"
/* Custom message code */
#define E_RSC 10002
#define E_OK 0
/* Option */
// #define DEBUG
#ifndef MAXNAMLEN
#define MAXNAMLEN 255
#endif
#ifndef MAX_PATH
#define MAX_PATH 1024
#endif
extern WINDOW *windialog;
extern void timer_function( WINDOW *win);
extern void applexit( void);
extern void snd_rdw( WINDOW *win);
extern struct xml_weather *update_weatherdata( int8 *location);
extern void snd_msg( WINDOW *win, int msg, int par1, int par2, int par3, int par4);
extern void zdebug( const char *format, ...);

View File

@@ -0,0 +1,206 @@
#include "general.h"
#include "get_data.h"
int8 dummy[2] = "0";
int8 *get_data_uv(struct xml_uv *data, enum datas_uv type)
{
int8 *str = dummy;
if ( !data)
return str;
switch(type)
{
case _UV_INDEX: str = data->i; break;
case _UV_TRANS: str = data->t; break;
default: break;
}
return str;
}
int8 *get_data_bar(struct xml_bar *data, enum datas_bar type)
{
int8 *str = dummy;
if ( !data)
return str;
switch(type)
{
case _BAR_R: str = data->r; break;
case _BAR_D: str = data->d; break;
default: break;
}
return str;
}
int8 *get_data_wind(struct xml_wind *data, enum datas_wind type)
{
int8 *str = dummy;
if ( !data)
return str;
switch(type)
{
case _WIND_SPEED: str = data->s; break;
case _WIND_GUST: str = data->gust; break;
case _WIND_DIRECTION: str = data->t; break;
case _WIND_TRANS: str = data->d; break;
default: break;
}
return str;
}
int8 *get_data_cc( struct xml_cc *data, enum datas type)
{
int8 *str = dummy;
if ( !data)
return str;
switch(type)
{
case LSUP: str = data->lsup; break;
case OBST: str = data->obst; break;
case FLIK: str = data->flik; break;
case TRANS: str = data->t; break;
case TEMP: str = data->tmp; break;
case HMID: str = data->hmid; break;
case VIS: str = data->vis; break;
case UV_INDEX: return get_data_uv(data->uv, _UV_INDEX);
case UV_TRANS: return get_data_uv(data->uv, _UV_TRANS);
case WIND_SPEED: return get_data_wind(data->wind, _WIND_SPEED);
case WIND_GUST: return get_data_wind(data->wind, _WIND_GUST);
case WIND_DIRECTION: return get_data_wind(data->wind, _WIND_DIRECTION);
case WIND_TRANS: return get_data_wind(data->wind, _WIND_TRANS);
case BAR_R: return get_data_bar(data->bar, _BAR_R);
case BAR_D: return get_data_bar(data->bar, _BAR_D);
case DEWP: str = data->dewp; break;
case WICON: str = data->icon; break;
default: break;
}
return str;
}
int8 *get_data_loc(struct xml_loc *data, enum datas_loc type)
{
int8 *str = dummy;
if ( !data)
return str;
switch(type)
{
case DNAM: str = data->dnam; break;
case SUNR: str = data->sunr; break;
case SUNS: str = data->suns; break;
default: break;
}
return str;
}
const int8 *get_data(struct xml_weather *data, enum datas type)
{
int8 *str = dummy;
if( data)
{
switch (type & 0xFF00)
{
case DATAS_CC: str = get_data_cc(data->cc, type); break;
case DATAS_LOC: str = get_data_loc(data->loc, type); break;
default: break;
}
}
return str;
}
int8 *get_data_part(struct xml_part *data, enum forecast type)
{
int8 *str = dummy;
if ( !data)
return str;
switch (type & 0x000F)
{
case F_ICON: str = data->icon; break;
case F_TRANS: str = data->t; break;
case F_PPCP: str = data->ppcp; break;
case F_W_SPEED: str = get_data_wind(data->wind, _WIND_SPEED); break;
case F_W_DIRECTION: str = get_data_wind(data->wind, _WIND_DIRECTION); break;
default: break;
}
return str;
}
const int8 *get_data_f(struct xml_dayf *data, enum forecast type)
{
int8 *str = dummy;
if (data)
{
switch (type & 0x0F00)
{
case ITEMS:
switch(type)
{
case WDAY: str = data->day; break;
case TEMP_MIN: str = data->low; break;
case TEMP_MAX: str = data->hi; break;
default: break;
}
break;
case NPART: str = get_data_part(data->part[1], type); break;
case DPART: str = get_data_part(data->part[0], type); break;
}
}
return str;
}
const int8 *get_unit( int myunit, enum datas type)
{
int8 *str = dummy;
switch (type & 0x00F0)
{
case 0x0020: str = (myunit == WEATHER_METRIC ? "<EFBFBD> C" : "<EFBFBD> F"); break;
case 0x0030: str = "%"; break;
case 0x0040: str = (myunit == WEATHER_METRIC ? "km/h" : "mph"); break;
case 0x0050: str = (myunit == WEATHER_METRIC ? "mb" : "in"); break;
default: break;
}
return str;
}
const int8 *get_lnks(struct xml_lnks *lnks, enum link type, int num)
{
int8* str = "";
if( !lnks || num >= XML_WEATHER_LINK_N)
return str;
switch (type)
{
case LINK:
str = lnks->l[num];
case TEXT:
str = lnks->t[num];
default:
break;
}
return str;
}

View File

@@ -0,0 +1,98 @@
#ifndef GET_DATA_H
#define GET_DATA_H
#include "parsers.h"
#define DATAS_CC 0x0100
#define DATAS_LOC 0x0200
#define DATAS_DAYF 0x0300
enum datas_wind {
_WIND_SPEED,
_WIND_GUST,
_WIND_DIRECTION,
_WIND_TRANS
};
enum datas_bar {
_BAR_R,
_BAR_D
};
enum datas_uv {
_UV_INDEX,
_UV_TRANS
};
enum datas {
/* cc */
LSUP = 0x0101,
OBST = 0x0102,
TRANS = 0x0103,
VIS = 0x0104,
UV_INDEX = 0x0105,
UV_TRANS = 0x0106,
WIND_DIRECTION = 0x0107,
BAR_D = 0x0108,
WIND_TRANS = 0x0109,
WICON = 0x0110,
FLIK = 0x0120,
TEMP = 0x0121,
DEWP = 0x0122,
HMID = 0x0130,
WIND_SPEED = 0x0140,
WIND_GUST = 0x0141,
BAR_R = 0x0150
};
enum datas_loc {
DNAM = 0x0201,
SUNR = 0x0202,
SUNS = 0x0203
};
enum forecast {
ITEMS = 0x0100,
WDAY = 0x0101,
TEMP_MIN = 0x0102,
TEMP_MAX = 0x0103,
F_ICON = 0x0001,
F_PPCP = 0x0002,
F_W_DIRECTION = 0x0003,
F_W_SPEED = 0x0004,
F_TRANS = 0x0005,
NPART = 0x0200,
ICON_N = 0x0201,
PPCP_N = 0x0202,
W_DIRECTION_N = 0x0203,
W_SPEED_N = 0x0204,
TRANS_N = 0x0205,
DPART = 0x0300,
ICON_D = 0x0301,
PPCP_D = 0x0302,
W_DIRECTION_D = 0x0303,
W_SPEED_D = 0x0304,
TRANS_D = 0x0305
};
enum link {
LINK,
TEXT
};
const int8 *get_data(struct xml_weather *data, enum datas type);
const int8 *get_data_f(struct xml_dayf * , enum forecast type);
const int8 *get_unit( int myunit, enum datas type);
const int8 *get_lnks(struct xml_lnks *lnks, enum link type, int num);
#endif

View File

@@ -0,0 +1,31 @@
27 January 2010: 1.02
=====================
- Fixed issues with memory protection
- Updated for correct cooperation with zweather.com
8 August 2005: 1.01
===================
- Updated to use the news zview codecs.
14 march 2005: FINAL 1.0
========================
- STing compatibility layer added.
- Now, zweather works on old 8+3 partitions.
- A very bad bug was present in "icon" code.. it caused a memory leak.
- Minor bugs fixes about text alignment.
- Some code clean up.
- 'O.png' had an incorrect size.
3 march 2005: BETA1
===================
- First public release.

View File

@@ -0,0 +1,155 @@
#include "general.h"
#include "inet.h"
long http_recv( int32 fd, int8 **buffer)
{
long n = 0L; /* 1 = good, 0 = conn terminated, -1 = error */
int8 thisbuffer[1024];
clock_t time_out = 0;
for(;;)
{
n = inet_recv ( fd, thisbuffer, 1023L);
if( n < 0L)
{
*buffer = NULL;
break;
}
else if( n == 0)
{
clock_t clk = clock();
if ( !time_out)
{
time_out = clk;
continue;
}
else if (( clk -= time_out) < 3000)
{
continue;
}
else break;
}
else
{
thisbuffer[n] = '\0';
*buffer = strdup(( const int8 *)thisbuffer);
break;
}
}
return n;
}
boolean http_get_header( int32 fd, int8 **buffer)
{
int8 lastchar = 0, *thisbuffer;
int32 l;
while((l = http_recv( fd, &thisbuffer)) > 0)
{
boolean found = FALSE;
int8 *where = NULL, *p;
if (lastchar == '\r' && ( p = strstr_len( thisbuffer, 3, "\n\r\n")))
{
where = p + 3;
found = TRUE;
}
else if (( p = strstr(thisbuffer, "\r\n\r\n")))
{
where = p + 4;
found = TRUE;
}
if( found)
{
/*TODO check if at end*/
*buffer = strdup(where);
}
else
lastchar = thisbuffer[l];
free(thisbuffer);
if( found)
return TRUE;
}
return FALSE;
}
int16 http_get_file( int8 *url, int8 *hostname, int8 *filename)
{
int32 addr, fd = -1, error;
FILE *file = NULL;
int8 *buffer= NULL, *request = NULL;
if( inet_host_addr ( hostname, &addr) != E_OK)
{
return FALSE;
}
if( !( fd = inet_connect( addr, 80, 10)))
{
return FALSE;
}
request = strdup_printf( "GET %s HTTP/1.0\r\n""HOST: %s\r\n\r\n", url, hostname);
if( request == NULL)
{
inet_close(fd);
return FALSE;
}
error = inet_send( fd, request, strlen(request));
free( request);
if ( error <= 0)
{
inet_close(fd);
return FALSE;
}
file = fopen( filename, "w");
if ( !file)
{
inet_close(fd);
return FALSE;
}
if( http_get_header( fd, &buffer) == FALSE)
{
inet_close(fd);
fclose(file);
return FALSE;
}
if( buffer)
{
int l = strlen(buffer);
fwrite(buffer, sizeof(char), l, file);
free(buffer);
}
while(( error = http_recv(fd, &buffer)) > 0)
{
int l = strlen( buffer);
fwrite( buffer, sizeof(char), l, file);
free(buffer);
}
fclose(file);
inet_close(fd);
if( error != -316)
return FALSE;
return TRUE;
}

View File

@@ -0,0 +1 @@
extern int16 http_get_file( int8 *url, int8 *hostname, int8 *filename);

View File

@@ -0,0 +1,56 @@
#include "general.h"
IMAGE *main_icon = NULL;
IMAGE *boussole = NULL;
IMAGE *logo = NULL;
IMAGE *forecast_icon[5] = { NULL };
IMAGE *icons[48] = { NULL };
int16 codec_load = 0;
int16 register_icons( void)
{
int16 i, end = 0;
int8 icon_name[16];
if( !( codec_load = codecs_init( "png.ldg")))
goto error;
for( i = 0; i <= 47; i++)
{
sprintf( icon_name, "icons\\%d.png", i);
if( ! ( icons[i] = load_img( icon_name, -1, -1, 1)))
goto error;
}
if( !( boussole = load_img( "icons\\boussole.png", -1, -1, 1)))
goto error;
if( !( logo = load_img( "icons\\logo.png", -1, -1, 1)))
goto error;
end = 1;
error:
return end;
}
void unregister_icons( void)
{
int16 i;
if( codec_load == 0)
return;
codecs_quit();
delete_img( logo);
delete_img( boussole);
for( i = 0; i <= 47; i++)
{
delete_img( icons[i]);
}
}

View File

@@ -0,0 +1,7 @@
extern IMAGE *main_icon;
extern IMAGE *forecast_icon[5];
extern IMAGE *icons[47];
extern IMAGE *boussole;
extern IMAGE *logo;
extern int16 register_icons( void);
extern void unregister_icons( void);

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Some files were not shown because too many files have changed in this diff Show More