merging from IMGLIB2_20010126_BRANCH

This commit is contained in:
pavlov%netscape.com 2001-02-20 22:41:47 +00:00
Родитель 2f41c5d5c4
Коммит eea8eb56d8
20 изменённых файлов: 1377 добавлений и 0 удалений

82
gfx/idl/gfx2types.idl Normal file
Просмотреть файл

@ -0,0 +1,82 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2000 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
/**
* gfx idl declarations to be used by all gfx interfaces.
* @file gfxtypes.idl
*/
#include "nsrootidl.idl"
/*! @verbatim */
%{C++
#include "gfxcompat.h"
%}
/*! @endverbatim */
/**
* gfx_dimension should be used for widths and heights
* @var typedef float gfx_dimension
*/
typedef float gfx_dimension;
/**
* gfx_coord should be used for x and y coordinates
* @var typedef float gfx_coord
*/
typedef float gfx_coord;
/**
* typedef that should be used for angles
* @var typedef float gfx_angle
*/
typedef float gfx_angle;
/**
* A color is a 32 bit unsigned integer with
* four components: R, G, B and A.
*
* @var typedef PRUint32 gfx_color
*/
typedef PRUint32 gfx_color;
/**
* typedef that should be used for bit depths
* @var typedef unsigned short gfx_depth
*/
typedef unsigned short gfx_depth; // is short ok?
/**
* typedef that should be used for image formats
* @var typedef long gfx_format
* @see gfxIGFXFormat
*/
typedef long gfx_format;
/**
* typedef that should be used for gamma levels
* @var typedef float gfx_gamma
*/
typedef float gfx_gamma;

84
gfx/idl/gfxIFormats.idl Normal file
Просмотреть файл

@ -0,0 +1,84 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
/**
* gfx image formats.
* @file gfxIFormats.idl
*/
#include "gfxtypes.idl"
/**
* gfxIFormats interface
*
* @author Tim Rowley <tor@cs.brown.edu>
* @author Stuart Parmenter <pavlov@netscape.com>
* @version 0.0
* @see gfx_format
*/
[scriptable]
interface gfxIFormats
{
/**
* RGB - duh...
*/
const gfx_format RGB = 0;
/**
* BGR - same as RGB except byteswaped
*/
const gfx_format BGR = 1;
/**
* RGB_A1 - RGB image and 1-bit alpha mask
*/
const gfx_format RGB_A1 = 2;
/**
* BGR_A1 - same as RGB_A1 except byteswaped
*/
const gfx_format BGR_A1 = 3;
/**
* RGB_A8 - RGB image and 8-bit alpha image
*/
const gfx_format RGB_A8 = 4;
/**
* BGR_A8 - same as RGB_A8 except byteswaped
*/
const gfx_format BGR_A8 = 5;
/**
* RGBA - packed RGBA image
*/
const gfx_format RGBA = 6;
/**
* BGRA - packed RGBA image
*/
const gfx_format BGRA = 7;
};

147
gfx/idl/gfxIImageFrame.idl Normal file
Просмотреть файл

@ -0,0 +1,147 @@
/** -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "nsISupports.idl"
#include "gfxtypes.idl"
#include "gfxIFormats.idl"
%{C++
#include "nsRect.h"
%}
/**
* gfxIImageFrame interface
*
* @author Tim Rowley <tor@cs.brown.edu>
* @author Stuart Parmenter <pavlov@netscape.com>
* @version 0.1
* @see "gfx2"
*/
[scriptable, uuid(51cc27a8-1dd2-11b2-a1aa-dad33ab193b4)]
interface gfxIImageFrame : nsISupports
{
/**
* Create a new \a aWidth x \a aHeight sized image.
*
* @param aX The x-offset from the origin of the gfxIImageContainer parent.
* @param aY The y-offset from the origin of the gfxIImageContainer parent.
* @param aWidth The width of the image to create.
* @param aHeight The height of the image to create.
* @param aFormat the width of the image to create.
*
* @note The data of a new image is unspecified (Whats the word i'm looking for here?).
*/
void init(in nscoord aX,
in nscoord aY,
in nscoord aWidth,
in nscoord aHeight,
in gfx_format aFormat);
/**
* The x-offset of the image.
*/
readonly attribute nscoord x;
/**
* The y-offset of the image.
*/
readonly attribute nscoord y;
/**
* The width of the image.
*/
readonly attribute nscoord width;
/**
* The height of the image.
*/
readonly attribute nscoord height;
/**
* The rectangle this frame ocupies.
*/
[noscript] readonly attribute nsRect rect;
/**
* The image data format the image was created with.
* @see gfxIFormats
*/
readonly attribute gfx_format format;
/**
* Represents the number of milliseconds until the next frame should be displayed.
* @note -1 means that this frame should be displayed forever.
*/
attribute long timeout;
/* data accessors */
readonly attribute unsigned long imageBytesPerRow;
/**
* returns the number of bytes allocated for the image
*/
readonly attribute unsigned long imageDataLength;
// XXX do we copy here? lets not...
void getImageData([array, size_is(length)] out PRUint8 bits, out unsigned long length);
/**
* Sets \a length bytes of \a data in this object.
* @param offset The offset from the first pixel in bytes. To set
* data beginning with the first (top left) pixel in the image, \a offset
* should be 0; to set data beginning with, for example, the sixth pixel in
* the first row of a RGBA32 image, the offset should be 20.
* @attension should we use PRUint32 instead?
*/
void setImageData([array, size_is(length), const] in PRUint8 data,
in unsigned long length,
in long offset);
/* alpha stuff.. used for _A1 and _A8 formated images */
readonly attribute unsigned long alphaBytesPerRow;
/**
* returns the number of bytes allocated for the alpha mask
*/
readonly attribute unsigned long alphaDataLength;
// XXX do we copy here? lets not...
void getAlphaData([array, size_is(length)] out PRUint8 bits, out unsigned long length);
/**
* Sets \a length bytes of \a data in this object.
*/
void setAlphaData([array, size_is(length), const] in PRUint8 data,
in unsigned long length,
in long offset);
};

37
gfx/idl/gfxtypes.idl Normal file
Просмотреть файл

@ -0,0 +1,37 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2000 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
/**
* gfx idl declarations to be used by all gfx interfaces.
* @file gfxtypes.idl
*/
#include "nsrootidl.idl"
#include "gfx2types.idl"
typedef PRInt32 nscoord;
[ptr] native nsRect(nsRect);
[ref] native nsRectRef(nsRect);

82
gfx/public/gfx2types.idl Normal file
Просмотреть файл

@ -0,0 +1,82 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2000 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
/**
* gfx idl declarations to be used by all gfx interfaces.
* @file gfxtypes.idl
*/
#include "nsrootidl.idl"
/*! @verbatim */
%{C++
#include "gfxcompat.h"
%}
/*! @endverbatim */
/**
* gfx_dimension should be used for widths and heights
* @var typedef float gfx_dimension
*/
typedef float gfx_dimension;
/**
* gfx_coord should be used for x and y coordinates
* @var typedef float gfx_coord
*/
typedef float gfx_coord;
/**
* typedef that should be used for angles
* @var typedef float gfx_angle
*/
typedef float gfx_angle;
/**
* A color is a 32 bit unsigned integer with
* four components: R, G, B and A.
*
* @var typedef PRUint32 gfx_color
*/
typedef PRUint32 gfx_color;
/**
* typedef that should be used for bit depths
* @var typedef unsigned short gfx_depth
*/
typedef unsigned short gfx_depth; // is short ok?
/**
* typedef that should be used for image formats
* @var typedef long gfx_format
* @see gfxIGFXFormat
*/
typedef long gfx_format;
/**
* typedef that should be used for gamma levels
* @var typedef float gfx_gamma
*/
typedef float gfx_gamma;

Просмотреть файл

@ -0,0 +1,84 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
/**
* gfx image formats.
* @file gfxIFormats.idl
*/
#include "gfxtypes.idl"
/**
* gfxIFormats interface
*
* @author Tim Rowley <tor@cs.brown.edu>
* @author Stuart Parmenter <pavlov@netscape.com>
* @version 0.0
* @see gfx_format
*/
[scriptable]
interface gfxIFormats
{
/**
* RGB - duh...
*/
const gfx_format RGB = 0;
/**
* BGR - same as RGB except byteswaped
*/
const gfx_format BGR = 1;
/**
* RGB_A1 - RGB image and 1-bit alpha mask
*/
const gfx_format RGB_A1 = 2;
/**
* BGR_A1 - same as RGB_A1 except byteswaped
*/
const gfx_format BGR_A1 = 3;
/**
* RGB_A8 - RGB image and 8-bit alpha image
*/
const gfx_format RGB_A8 = 4;
/**
* BGR_A8 - same as RGB_A8 except byteswaped
*/
const gfx_format BGR_A8 = 5;
/**
* RGBA - packed RGBA image
*/
const gfx_format RGBA = 6;
/**
* BGRA - packed RGBA image
*/
const gfx_format BGRA = 7;
};

Просмотреть файл

@ -0,0 +1,147 @@
/** -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "nsISupports.idl"
#include "gfxtypes.idl"
#include "gfxIFormats.idl"
%{C++
#include "nsRect.h"
%}
/**
* gfxIImageFrame interface
*
* @author Tim Rowley <tor@cs.brown.edu>
* @author Stuart Parmenter <pavlov@netscape.com>
* @version 0.1
* @see "gfx2"
*/
[scriptable, uuid(51cc27a8-1dd2-11b2-a1aa-dad33ab193b4)]
interface gfxIImageFrame : nsISupports
{
/**
* Create a new \a aWidth x \a aHeight sized image.
*
* @param aX The x-offset from the origin of the gfxIImageContainer parent.
* @param aY The y-offset from the origin of the gfxIImageContainer parent.
* @param aWidth The width of the image to create.
* @param aHeight The height of the image to create.
* @param aFormat the width of the image to create.
*
* @note The data of a new image is unspecified (Whats the word i'm looking for here?).
*/
void init(in nscoord aX,
in nscoord aY,
in nscoord aWidth,
in nscoord aHeight,
in gfx_format aFormat);
/**
* The x-offset of the image.
*/
readonly attribute nscoord x;
/**
* The y-offset of the image.
*/
readonly attribute nscoord y;
/**
* The width of the image.
*/
readonly attribute nscoord width;
/**
* The height of the image.
*/
readonly attribute nscoord height;
/**
* The rectangle this frame ocupies.
*/
[noscript] readonly attribute nsRect rect;
/**
* The image data format the image was created with.
* @see gfxIFormats
*/
readonly attribute gfx_format format;
/**
* Represents the number of milliseconds until the next frame should be displayed.
* @note -1 means that this frame should be displayed forever.
*/
attribute long timeout;
/* data accessors */
readonly attribute unsigned long imageBytesPerRow;
/**
* returns the number of bytes allocated for the image
*/
readonly attribute unsigned long imageDataLength;
// XXX do we copy here? lets not...
void getImageData([array, size_is(length)] out PRUint8 bits, out unsigned long length);
/**
* Sets \a length bytes of \a data in this object.
* @param offset The offset from the first pixel in bytes. To set
* data beginning with the first (top left) pixel in the image, \a offset
* should be 0; to set data beginning with, for example, the sixth pixel in
* the first row of a RGBA32 image, the offset should be 20.
* @attension should we use PRUint32 instead?
*/
void setImageData([array, size_is(length), const] in PRUint8 data,
in unsigned long length,
in long offset);
/* alpha stuff.. used for _A1 and _A8 formated images */
readonly attribute unsigned long alphaBytesPerRow;
/**
* returns the number of bytes allocated for the alpha mask
*/
readonly attribute unsigned long alphaDataLength;
// XXX do we copy here? lets not...
void getAlphaData([array, size_is(length)] out PRUint8 bits, out unsigned long length);
/**
* Sets \a length bytes of \a data in this object.
*/
void setAlphaData([array, size_is(length), const] in PRUint8 data,
in unsigned long length,
in long offset);
};

38
gfx/public/gfxcompat.h Normal file
Просмотреть файл

@ -0,0 +1,38 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
/**
* gfx ifdef file to make gfx2 and gfx live together
* @file gfxcompat.h
*/
#ifdef GFX2_ONLY
typedef gfx_coord nscoord;
typedef gfx_color nscolor;
// add these later, work out the include deps, etc.
//typedef nsRect2 nsRect;
//typedef nsSize2 nsSize2;
#else
#include "nsCoord.h"
#endif

37
gfx/public/gfxtypes.idl Normal file
Просмотреть файл

@ -0,0 +1,37 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2000 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
/**
* gfx idl declarations to be used by all gfx interfaces.
* @file gfxtypes.idl
*/
#include "nsrootidl.idl"
#include "gfx2types.idl"
typedef PRInt32 nscoord;
[ptr] native nsRect(nsRect);
[ref] native nsRectRef(nsRect);

1
gfx2/public/MANIFEST Normal file
Просмотреть файл

@ -0,0 +1 @@
gfxcompat.h

6
gfx2/public/MANIFEST_IDL Normal file
Просмотреть файл

@ -0,0 +1,6 @@
gfxtypes.idl
gfx2types.idl
gfxIFormats.idl
gfxIImageContainer.idl
gfxIImageContainerObserver.idl
gfxIImageFrame.idl

48
gfx2/public/Makefile.in Normal file
Просмотреть файл

@ -0,0 +1,48 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2000 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Stuart Parmenter <pavlov@netscape.com>
#
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = gfx2
XPIDL_MODULE = gfx2
XPIDLSRCS = \
gfxtypes.idl \
gfx2types.idl \
gfxIFormats.idl \
gfxIImageContainer.idl \
gfxIImageContainerObserver.idl \
gfxIImageFrame.idl \
$(NULL)
EXPORTS = \
gfxcompat.h \
$(NULL)
include $(topsrcdir)/config/rules.mk

82
gfx2/public/gfx2types.idl Normal file
Просмотреть файл

@ -0,0 +1,82 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2000 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
/**
* gfx idl declarations to be used by all gfx interfaces.
* @file gfxtypes.idl
*/
#include "nsrootidl.idl"
/*! @verbatim */
%{C++
#include "gfxcompat.h"
%}
/*! @endverbatim */
/**
* gfx_dimension should be used for widths and heights
* @var typedef float gfx_dimension
*/
typedef float gfx_dimension;
/**
* gfx_coord should be used for x and y coordinates
* @var typedef float gfx_coord
*/
typedef float gfx_coord;
/**
* typedef that should be used for angles
* @var typedef float gfx_angle
*/
typedef float gfx_angle;
/**
* A color is a 32 bit unsigned integer with
* four components: R, G, B and A.
*
* @var typedef PRUint32 gfx_color
*/
typedef PRUint32 gfx_color;
/**
* typedef that should be used for bit depths
* @var typedef unsigned short gfx_depth
*/
typedef unsigned short gfx_depth; // is short ok?
/**
* typedef that should be used for image formats
* @var typedef long gfx_format
* @see gfxIGFXFormat
*/
typedef long gfx_format;
/**
* typedef that should be used for gamma levels
* @var typedef float gfx_gamma
*/
typedef float gfx_gamma;

Просмотреть файл

@ -0,0 +1,84 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
/**
* gfx image formats.
* @file gfxIFormats.idl
*/
#include "gfxtypes.idl"
/**
* gfxIFormats interface
*
* @author Tim Rowley <tor@cs.brown.edu>
* @author Stuart Parmenter <pavlov@netscape.com>
* @version 0.0
* @see gfx_format
*/
[scriptable]
interface gfxIFormats
{
/**
* RGB - duh...
*/
const gfx_format RGB = 0;
/**
* BGR - same as RGB except byteswaped
*/
const gfx_format BGR = 1;
/**
* RGB_A1 - RGB image and 1-bit alpha mask
*/
const gfx_format RGB_A1 = 2;
/**
* BGR_A1 - same as RGB_A1 except byteswaped
*/
const gfx_format BGR_A1 = 3;
/**
* RGB_A8 - RGB image and 8-bit alpha image
*/
const gfx_format RGB_A8 = 4;
/**
* BGR_A8 - same as RGB_A8 except byteswaped
*/
const gfx_format BGR_A8 = 5;
/**
* RGBA - packed RGBA image
*/
const gfx_format RGBA = 6;
/**
* BGRA - packed RGBA image
*/
const gfx_format BGRA = 7;
};

Просмотреть файл

@ -0,0 +1,106 @@
/** -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "nsISupports.idl"
#include "gfxtypes.idl"
#include "gfxIFormats.idl"
interface gfxIImageFrame;
interface nsIEnumerator;
interface gfxIImageContainerObserver;
/**
* gfxIImageContainer interface
*
* @author Stuart Parmenter <pavlov@netscape.com>
* @version 0.1
* @see "gfx2"
*/
[scriptable, uuid(5e8405a4-1dd2-11b2-8385-bc8e3446cad3)]
interface gfxIImageContainer : nsISupports
{
/**
* Create a new \a aWidth x \a aHeight sized image container.
*
* @param aWidth The width of the container in which all the
* gfxIImageFrame children will fit.
* @param aHeight The height of the container in which all the
* gfxIImageFrame children will fit.
* @param aObserver Observer to send animation notifications to.
*/
void init(in nscoord aWidth,
in nscoord aHeight,
in gfxIImageContainerObserver aObserver);
/* this should probably be on the device context (or equiv) */
readonly attribute gfx_format preferredAlphaChannelFormat;
/**
* The width of the container rectangle.
*/
readonly attribute nscoord width;
/**
* The height of the container rectangle.
*/
readonly attribute nscoord height;
/**
* Get the current frame that would be drawn if the image was to be drawn now
*/
readonly attribute gfxIImageFrame currentFrame;
readonly attribute unsigned long numFrames;
gfxIImageFrame getFrameAt(in unsigned long index);
/**
* Adds \a item to the end of the list of frames.
* @param item frame to add.
*/
void appendFrame(in gfxIImageFrame item);
void removeFrame(in gfxIImageFrame item);
/* notification when the current frame is done decoding */
void endFrameDecode(in unsigned long framenumber, in unsigned long timeout);
/* notification that the entire image has been decoded */
void decodingComplete();
nsIEnumerator enumerate();
void clear();
/* animation stuff */
/**
* number of times to loop the image.
* @note -1 means forever.
*/
attribute long loopCount;
};

Просмотреть файл

@ -0,0 +1,45 @@
/** -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "nsISupports.idl"
#include "gfxtypes.idl"
%{C++
#include "nsRect.h"
%}
interface gfxIImageContainer;
interface gfxIImageFrame;
/**
* gfxIImageContainerObserver interface
*
* @author Stuart Parmenter <pavlov@netscape.com>
* @version 0.1
* @see "gfx2"
*/
[uuid(153f1518-1dd2-11b2-b9cd-b16eb63e0471)]
interface gfxIImageContainerObserver : nsISupports
{
[noscript] void frameChanged(in gfxIImageContainer container, in nsISupports cx, in gfxIImageFrame newframe, in nsRect dirtyRect);
};

Просмотреть файл

@ -0,0 +1,147 @@
/** -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "nsISupports.idl"
#include "gfxtypes.idl"
#include "gfxIFormats.idl"
%{C++
#include "nsRect.h"
%}
/**
* gfxIImageFrame interface
*
* @author Tim Rowley <tor@cs.brown.edu>
* @author Stuart Parmenter <pavlov@netscape.com>
* @version 0.1
* @see "gfx2"
*/
[scriptable, uuid(51cc27a8-1dd2-11b2-a1aa-dad33ab193b4)]
interface gfxIImageFrame : nsISupports
{
/**
* Create a new \a aWidth x \a aHeight sized image.
*
* @param aX The x-offset from the origin of the gfxIImageContainer parent.
* @param aY The y-offset from the origin of the gfxIImageContainer parent.
* @param aWidth The width of the image to create.
* @param aHeight The height of the image to create.
* @param aFormat the width of the image to create.
*
* @note The data of a new image is unspecified (Whats the word i'm looking for here?).
*/
void init(in nscoord aX,
in nscoord aY,
in nscoord aWidth,
in nscoord aHeight,
in gfx_format aFormat);
/**
* The x-offset of the image.
*/
readonly attribute nscoord x;
/**
* The y-offset of the image.
*/
readonly attribute nscoord y;
/**
* The width of the image.
*/
readonly attribute nscoord width;
/**
* The height of the image.
*/
readonly attribute nscoord height;
/**
* The rectangle this frame ocupies.
*/
[noscript] readonly attribute nsRect rect;
/**
* The image data format the image was created with.
* @see gfxIFormats
*/
readonly attribute gfx_format format;
/**
* Represents the number of milliseconds until the next frame should be displayed.
* @note -1 means that this frame should be displayed forever.
*/
attribute long timeout;
/* data accessors */
readonly attribute unsigned long imageBytesPerRow;
/**
* returns the number of bytes allocated for the image
*/
readonly attribute unsigned long imageDataLength;
// XXX do we copy here? lets not...
void getImageData([array, size_is(length)] out PRUint8 bits, out unsigned long length);
/**
* Sets \a length bytes of \a data in this object.
* @param offset The offset from the first pixel in bytes. To set
* data beginning with the first (top left) pixel in the image, \a offset
* should be 0; to set data beginning with, for example, the sixth pixel in
* the first row of a RGBA32 image, the offset should be 20.
* @attension should we use PRUint32 instead?
*/
void setImageData([array, size_is(length), const] in PRUint8 data,
in unsigned long length,
in long offset);
/* alpha stuff.. used for _A1 and _A8 formated images */
readonly attribute unsigned long alphaBytesPerRow;
/**
* returns the number of bytes allocated for the alpha mask
*/
readonly attribute unsigned long alphaDataLength;
// XXX do we copy here? lets not...
void getAlphaData([array, size_is(length)] out PRUint8 bits, out unsigned long length);
/**
* Sets \a length bytes of \a data in this object.
*/
void setAlphaData([array, size_is(length), const] in PRUint8 data,
in unsigned long length,
in long offset);
};

38
gfx2/public/gfxcompat.h Normal file
Просмотреть файл

@ -0,0 +1,38 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
/**
* gfx ifdef file to make gfx2 and gfx live together
* @file gfxcompat.h
*/
#ifdef GFX2_ONLY
typedef gfx_coord nscoord;
typedef gfx_color nscolor;
// add these later, work out the include deps, etc.
//typedef nsRect2 nsRect;
//typedef nsSize2 nsSize2;
#else
#include "nsCoord.h"
#endif

37
gfx2/public/gfxtypes.idl Normal file
Просмотреть файл

@ -0,0 +1,37 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2000 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
/**
* gfx idl declarations to be used by all gfx interfaces.
* @file gfxtypes.idl
*/
#include "nsrootidl.idl"
#include "gfx2types.idl"
typedef PRInt32 nscoord;
[ptr] native nsRect(nsRect);
[ref] native nsRectRef(nsRect);

45
gfx2/public/makefile.win Normal file
Просмотреть файл

@ -0,0 +1,45 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2000 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Stuart Parmenter <pavlov@netscape.com>
#
DEPTH = ..\..
include <$(DEPTH)/config/config.mak>
MODULE = gfx2
XPIDL_MODULE = gfx2
XPIDLSRCS = \
.\gfxtypes.idl \
.\gfx2types.idl \
.\gfxIFormats.idl \
.\gfxIImageContainer.idl \
.\gfxIImageContainerObserver.idl \
.\gfxIImageFrame.idl \
$(NULL)
EXPORTS = \
.\gfxcompat.h \
$(NULL)
include <$(DEPTH)\config\rules.mak>