home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 1
/
FFMCD01.bin
/
bbs
/
develop
/
magic.lha
/
MAGIC
/
doc
/
magic.autodoc
Wrap
Text File
|
1993-06-24
|
34KB
|
1,086 lines
TABLE OF CONTENTS
magic.library/--background--
magic.library/--messages--
magic.library/AddMagicImage
magic.library/AllocMagicImageA
magic.library/AttemptLockMagicImage
magic.library/CloseMagicImage
magic.library/CycleMagicImage
magic.library/FreeMagicImage
magic.library/GetMagicImageDataA
magic.library/IsMagicMessage
magic.library/LockMagicImage
magic.library/OpenMagicImageA
magic.library/PickMagicImageA
magic.library/PutMagicImageDataA
magic.library/RedrawMagicImage
magic.library/RemMagicImage
magic.library/RestoreMagicImage
magic.library/SaveMagicImage
magic.library/SetDefaultMagicImage
magic.library/UnlockMagicImage
magic.library/UpdateMagicImage
magic.library/zzzzz
magic.library/--background-- magic.library/--background--
- What is MAGIC?
MAGIC is a purely marketing-inspired name for a system of sharing 24-bit
image data between MAGIC-aware applications.
- Why is this needed?
The primary reason is to make things easier on the user. It is very
awkward to have to save an image out of one program, then run a different
program and then re-load the image to work on it again. MAGIC allows the
image data to be "shared" between the two applications _while they are
running_.
- What's wrong with the clipboard or HotLinks?
MAGIC is specifically oriented towards 24-bit image data (although it is
certainly extensible to other types of data, but that is beyond the scope
of this document). MAGIC is also an "in-memory" system, where the image
data is kept in memory instead of on disk. MAGIC is also very transparent
to the user; there is no need to "publish" or "subscribe".
- How's it work?
The first step is to run a server program that can be run in the
background to manage MAGIC images and provide a convenient function
library. This server program can be placed in a user's WBStartup
drawer (if they're running 1.3, user's deserve the associated hassles).
When an application wishes to make an image "public" (available to other
MAGIC-aware applications), he opens the server-created library (called
"magic.library") and goes through the steps of creating a MAGIC image.
The image is then added to the public image list and may from then on be
"opened" by any other application.
The application that creates a MAGIC image and makes it public is known
throughout this document as the "owner" of an image. Those applications
that open a MAGIC image for use are known as "openers" (creative, huh? :).
- How about all those different image data organizations?
This was a major obstacle in the MAGIC system; everyone seems to have a
different way of storing image data (there's nothing wrong with this, it
just makes sharing data a little tough). MAGIC overcomes this like this:
The owner of an image determines the image data organization (the "native"
organization). Since the openers may be expecting a different
organization, translation functions are provided which allow the opener to
translate the image data into a known format. This incurs a bit of a
speed penalty when processing the image, but this seemed the most logical
way of approaching the problem.
If the owner of an image is using seperate contiguous blocks for the RGB
data, it may optionally provide this information so that other
applications that can handle this organization may use the pointers
directly. This seems to be the most popular image data organization, and
is currently in use by several Amiga products.
- Is it easy to support?
One of the goals was to make the task of integrating MAGIC into existing
applications fairly painless. True, some work will be required, but we
think the benefits are well worth it.
- Does MAGIC cost anything?
No. The server program and documentation for creating MAGIC-aware
applications will be freely distributable.
- Are there any gotchas?
Your application must be able to support multi-tasking access to
your image data, because more than one application may be updating
their displays based on your image data. In most cases where the
image data is stored in memory, this will not be a problem.
- Well, you convinced me. I'll start supporting it right away!
Cool beans. :)
- Is there anything else I should know?
Yeah, too many questions can get on a person's nerves.
- Sorry.
No problem.
magic.library/--messages-- magic.library/--messages--
The following types of messages may be sent to your application
from MAGIC:
MMSG_CLOSE
This is a request for you to close your handle on a
particular MAGIC image, as someone else is trying to
release the image.
MMSG_TOFRONT
This is a request to bring your application's interface
to the front and activate it.
MMSG_REDRAW
This is a request to redraw some or all of a MAGIC
image's display.
MMSG_UPDATE
This is sent when the physical dimensions of a MAGIC
image are being changed. (NOTE: This version of MAGIC
does not yet handle physically changing the size of images
very well.)
MMSG_SAVEUNDO
Request the owner of a MAGIC image to save a copy of some
or all of the image in an "undo" buffer, presumably before
some action is done to the image.
MMSG_RESTOREUNDO
Request the owner of a MAGIC image to undo the last changes
to a MAGIC image.
magic.library/AddMagicImage magic.library/AddMagicImage
NAME
AddMagicImage -- Make a MAGIC image available to other tasks.
SYNOPSIS
success = AddMagicImage ( image );
D0.L A0
BOOL AddMagicImage ( struct MagicImage * );
FUNCTION
Make a previously allocated and initialized MagicImage structure
available for other applications to open and access. Only the
owner of an image should make it public.
INPUTS
image -- a pointer to an initialized MagicImage structure,
which should only be allocated with the AllocMagicImageA()
function.
RESULTS
success -- TRUE if the image was successfully added, or FALSE on
failure.
EXAMPLE
NOTES
BUGS
SEE ALSO
magic.library/AllocMagicImageA magic.library/AllocMagicImageA
NAME
AllocMagicImageA -- Allocate and initialize a MagicImage structure.
AllocMagicImage -- varargs stub for AllocMagicImageA().
SYNOPSIS
image = AllocMagicImageA ( taglist );
D0.L A0
struct MagicImage *AllocMagicImageA ( struct TagItem * );
image = AllocMagicImage ( firstTag, ... );
struct MagicImage *AllocMagicImage ( Tag, ... );
FUNCTION
Allocate and initialize a new MagicImage structure. You *must*
use this function to create the structure to be upwardly compatible.
INPUTS
taglist -- tags used to initialize the PublicImage structure.
AMI_Width:
(LONG) Width of image data in pixels.
AMI_Height:
(LONG) Height of image data in pixels.
AMI_Depth:
(LONG) Depth of image data in 8-bit planes (eg. 1 for an
8-bit greyscale image or 3 for a 24-bit RGB color
image).
AMI_Name:
(char *) Name of the public image buffer. Defaults to a
unique name.
AMI_ImageData:
(APTR) Information need by the owner of this image to
decipher it's contents. Could be nothing more than a
pointer to an array of RGB plane pointers.
AMI_GetDataCode:
(int (*)()) Hook function to convert the native format