зеркало из https://github.com/mozilla/gecko-dev.git
new. decoder. pnunn
This commit is contained in:
Родитель
50bcc210f8
Коммит
e927d42c5b
|
@ -0,0 +1,42 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The purpose of this file is to help phase out XP_ library
|
||||
* from the image library. In general, XP_ data structures and
|
||||
* functions will be replaced with the PR_ or PL_ equivalents.
|
||||
* In cases where the PR_ or PL_ equivalents don't yet exist,
|
||||
* this file (and its source equivalent) will play the role
|
||||
* of the XP_ library.
|
||||
*/
|
||||
|
||||
#ifndef dllcompat_h___
|
||||
#define dllcompat_h___
|
||||
|
||||
#include "platform.h"
|
||||
#include "prtypes.h"
|
||||
#include "nsCom.h"
|
||||
|
||||
#include "xp_mcom.h"
|
||||
#include "xp_str.h"
|
||||
|
||||
|
||||
typedef void
|
||||
(*TimeoutCallbackFunction) (void * closure);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,78 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/* -*- Mode: C; tab-width: 4 -*-
|
||||
* il_utilp.h Colormap and colorspace utilities - types and definitions
|
||||
* private to Image Library.
|
||||
*
|
||||
* $Id: il_utilp.h,v 1.2 1999/04/19 22:42:56 pnunn%netscape.com Exp $
|
||||
*/
|
||||
|
||||
|
||||
/************************* Colormap utilities ********************************/
|
||||
|
||||
/* Parameters for building a color cube and its associated lookup table. */
|
||||
#define LOOKUP_TABLE_SIZE 32768
|
||||
#define LOOKUP_TABLE_RED 32
|
||||
#define LOOKUP_TABLE_GREEN 32
|
||||
#define LOOKUP_TABLE_BLUE 32
|
||||
#define CUBE_MAX_SIZE 256
|
||||
|
||||
/* Macro to convert 8-bit/channel RGB data into an 8-bit colormap index. */
|
||||
#define COLORMAP_INDEX(lookup_table, red, green, blue) \
|
||||
lookup_table[LOOKUP_TABLE_INDEX(red, green, blue)]
|
||||
|
||||
/* Macro to convert 8-bit/channel RGB data into a 16-bit lookup table index.
|
||||
The lookup table value is the index to the colormap. */
|
||||
#define LOOKUP_TABLE_INDEX(red, green, blue) \
|
||||
((USE_5_BITS(red) << 10) | \
|
||||
(USE_5_BITS(green) << 5) | \
|
||||
USE_5_BITS(blue))
|
||||
|
||||
/* Take the 5 most significant bits of an 8-bit value. */
|
||||
#define USE_5_BITS(x) ((x) >> 3)
|
||||
|
||||
/* Scaling macro for creating color cubes. */
|
||||
#define CUBE_SCALE(val, double_new_size_minus1, old_size_minus1, \
|
||||
double_old_size_minus1) \
|
||||
((val) * (double_new_size_minus1) + (old_size_minus1)) / \
|
||||
(double_old_size_minus1)
|
||||
|
||||
|
||||
/************************** Colorspace utilities *****************************/
|
||||
|
||||
/* Image Library private part of an IL_ColorSpace structure. */
|
||||
typedef struct il_ColorSpaceData {
|
||||
/* RGB24 to RGBN depth conversion maps. Each of these maps take an
|
||||
8-bit input for a color channel and converts it into that channel's
|
||||
contribution to a depth N pixmap e.g. for a 24 to 16-bit color
|
||||
conversion, the output pixel is given by
|
||||
|
||||
uint8 red, green, blue;
|
||||
uint16 output_pixel;
|
||||
output_pixel = r8torgbn[red] + g8torgbn[green] + b8torgbn[blue];
|
||||
|
||||
Depth conversion maps are created for the following destination image
|
||||
pixmap depths: N = 8, 16 and 32. The type of the array elements is a
|
||||
uintN. */
|
||||
void *r8torgbn;
|
||||
void *g8torgbn;
|
||||
void *b8torgbn;
|
||||
} il_ColorSpaceData;
|
||||
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef _nsIImgDecoder_h
|
||||
#define _nsIImgDecoder_h
|
||||
|
||||
#include "if_struct.h"
|
||||
#include "ni_pixmp.h"
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsImgDecCID.h"
|
||||
|
||||
|
||||
class nsIImgDecoder : public nsISupports
|
||||
{
|
||||
public:
|
||||
|
||||
NS_IMETHOD ImgDInit()=0;
|
||||
|
||||
NS_IMETHOD ImgDWriteReady()=0;
|
||||
NS_IMETHOD ImgDWrite(const unsigned char *buf, int32 len)=0;
|
||||
NS_IMETHOD ImgDComplete()=0;
|
||||
NS_IMETHOD ImgDAbort()=0;
|
||||
|
||||
private:
|
||||
void *mContainer;
|
||||
|
||||
};
|
||||
|
||||
NS_DEFINE_IID(kImgDCallbkIID, NS_IMGDCALLBK_IID);
|
||||
NS_DEFINE_CID(kImgDCallbkCID, NS_IMGDCALLBK_CID);
|
||||
|
||||
class nsIImgDCallbk : public nsISupports
|
||||
{
|
||||
public:
|
||||
|
||||
NS_IMETHOD ImgDCBFlushImage()=0;
|
||||
NS_IMETHOD ImgDCBImageSize()=0;
|
||||
NS_IMETHOD ImgDCBResetPalette()=0;
|
||||
NS_IMETHOD ImgDCBInitTransparentPixel()=0;
|
||||
NS_IMETHOD ImgDCBDestroyTransparentPixel()=0;
|
||||
NS_IMETHOD ImgDCBSetupColorspaceConverter()=0;
|
||||
NS_IMETHOD_(NI_ColorSpace *) ImgDCBCreateGreyScaleColorSpace()=0;
|
||||
|
||||
NS_IMETHOD_(void*) ImgDCBSetTimeout(TimeoutCallbackFunction func, void* closure, uint32 msecs)=0;
|
||||
NS_IMETHOD ImgDCBClearTimeout(void *timer_id)=0;
|
||||
|
||||
NS_IMETHOD ImgDCBHaveHdr(int destwidth, int destheight )=0;
|
||||
|
||||
NS_IMETHOD ImgDCBHaveRow(uint8 *rowbuf, uint8* rgbrow, int x_offset, int len,
|
||||
int row, int dup_rowcnt, uint8 draw_mode,
|
||||
int pass )=0;
|
||||
|
||||
|
||||
NS_IMETHOD ImgDCBHaveImageFrame()=0;
|
||||
NS_IMETHOD ImgDCBHaveImageAll()=0;
|
||||
NS_IMETHOD ImgDCBError()=0;
|
||||
|
||||
private:
|
||||
void *mContainer;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,72 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/* -*- Mode: C; tab-width: 4 -*-
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "nsIImgDecoder.h"
|
||||
|
||||
/*---------------------------------------------*/
|
||||
/*-----------------class-----------------------*/
|
||||
|
||||
class ImgDCallbk : public nsIImgDCallbk
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
ImgDCallbk(il_container *aContainer){mContainer=aContainer;};
|
||||
~ImgDCallbk(){};
|
||||
|
||||
|
||||
NS_IMETHOD ImgDCBFlushImage();
|
||||
NS_IMETHOD ImgDCBImageSize();
|
||||
NS_IMETHOD ImgDCBResetPalette();
|
||||
NS_IMETHOD ImgDCBInitTransparentPixel();
|
||||
NS_IMETHOD ImgDCBDestroyTransparentPixel();
|
||||
NS_IMETHOD ImgDCBSetupColorspaceConverter();
|
||||
NS_IMETHOD_(NI_ColorSpace *) ImgDCBCreateGreyScaleColorSpace();
|
||||
|
||||
NS_IMETHOD_(void*) ImgDCBSetTimeout(TimeoutCallbackFunction func,
|
||||
void* closure, uint32 msecs);
|
||||
NS_IMETHOD ImgDCBClearTimeout(void *timer_id);
|
||||
|
||||
|
||||
/* callbacks from the decoder */
|
||||
NS_IMETHOD ImgDCBHaveHdr(int destwidth, int destheight);
|
||||
NS_IMETHOD ImgDCBHaveRow(uint8*, uint8*,
|
||||
int, int, int, int,
|
||||
uint8 , int);
|
||||
|
||||
NS_IMETHOD ImgDCBHaveImageFrame();
|
||||
NS_IMETHOD ImgDCBHaveImageAll();
|
||||
NS_IMETHOD ImgDCBError();
|
||||
|
||||
NS_IMETHODIMP CreateInstance(const nsCID &aClass,
|
||||
il_container* ic,
|
||||
const nsIID &aIID,
|
||||
void **ppv) ;
|
||||
|
||||
il_container *GetContainer() {return mContainer; };
|
||||
il_container *SetContainer(il_container *ic) {mContainer=ic; return ic; };
|
||||
|
||||
private:
|
||||
il_container* mContainer;
|
||||
};
|
||||
|
||||
/*-------------------------------*/
|
|
@ -0,0 +1,64 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsImgDecCIID_h__
|
||||
#define nsImgDecCIID_h__
|
||||
|
||||
#include "nsRepository.h"
|
||||
|
||||
|
||||
/* f00c22b0-bbd2-11d2-802c-0060088f91a3 */
|
||||
#define NS_IIMGDECODER_IID \
|
||||
{ 0xf00c22b0, 0xbbd2, 0x11d2, \
|
||||
{ 0x80, 0x2c, 0x00, 0x60, 0x08, 0x8f, 0x91, 0xa3 } }
|
||||
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
#define NS_IMGDECODER_CID \
|
||||
{ 0xc9089cc0, 0xbaf4, 0x11d2, \
|
||||
{ 0x80, 0x2c, 0x00, 0x60, 0x08, 0x8f, 0x91, 0xa3 } }
|
||||
|
||||
/* bc60b730-bbcf-11d2-802c-0060088f91a3 */
|
||||
#define NS_IMGDECODER_IID \
|
||||
{ 0xbc60730, 0xbbcf, 0x11d2, \
|
||||
{ 0x80, 0x2c, 0x00, 0x60, 0x08, 0x8f, 0x91, 0xa3 } }
|
||||
|
||||
NS_DEFINE_IID(kImgDecoderIID, NS_IMGDECODER_IID);
|
||||
NS_DEFINE_IID(kImgDecoderCID, NS_IMGDECODER_CID);
|
||||
|
||||
////////////////////////////////////////////////
|
||||
|
||||
NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
/////////////////////////////////////////////////
|
||||
/* e41ac650-cd9f-11d2-802c-0060088f91a3 */
|
||||
#define NS_IMGDCALLBK_CID \
|
||||
{ 0xe41ac650, 0xcd9f, 0x11d2, \
|
||||
{ 0x80, 0x2c, 0x00, 0x60, 0x08, 0x8f, 0x91, 0xa3 } }
|
||||
|
||||
/* d34a2f20-cd9f-11d2-802c-0060088f91a3 */
|
||||
#define NS_IMGDCALLBK_IID \
|
||||
{ 0xd34a2f20, 0xcd9f, 0x11d2, \
|
||||
{ 0x80, 0x2c, 0x00, 0x60, 0x08, 0x8f, 0x91, 0xa3 } }
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsImgDec_h___
|
||||
#define nsImgDec_h___
|
||||
|
||||
|
||||
|
||||
#include "nsIFactory.h"
|
||||
|
||||
#endif
|
Загрузка…
Ссылка в новой задаче