diff options
author | daryll <daryll> | 1999-12-05 00:59:08 +0000 |
---|---|---|
committer | daryll <daryll> | 1999-12-05 00:59:08 +0000 |
commit | 504880db5611bf0f57206abe44835959c2729147 (patch) | |
tree | f22ff902680775b5a6fb49364d305b846606716a /xc/lib/XIE |
Initial revision
Diffstat (limited to 'xc/lib/XIE')
31 files changed, 9395 insertions, 0 deletions
diff --git a/xc/lib/XIE/Imakefile b/xc/lib/XIE/Imakefile new file mode 100644 index 000000000..09c9e9edc --- /dev/null +++ b/xc/lib/XIE/Imakefile @@ -0,0 +1,74 @@ +XCOMM $XConsortium: Imakefile /main/7 1996/09/28 16:43:07 rws $ +XCOMM $XFree86: xc/lib/XIE/Imakefile,v 1.2 1998/12/20 11:56:58 dawes Exp $ + +#define DoNormalLib NormalLibXie +#define DoSharedLib SharedLibXie +#define DoExtraLib SharedLibXie +#define DoDebugLib DebugLibXie +#define DoProfileLib ProfileLibXie +#define LibName XIE +#define SoRev SOXIEREV +#define IncSubdir X11 +#define IncSubSubdir extensions + +#include <Threads.tmpl> + +#ifdef SharedXieReqs +REQUIREDLIBS = SharedXieReqs +#endif + +#if Malloc0ReturnsNull +ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL +#endif + +DEFINES = $(ALLOC_DEFINES) + +HEADERS = XIElib.h + +SRCS = abort.c \ + await.c \ + clientdata.c \ + colorlist.c \ + conven.c \ + elements.c \ + free.c \ + errors.c \ + events.c \ + ieee.c \ + init.c \ + lut.c \ + photoflo.c \ + photomap.c \ + photospace.c \ + roi.c \ + technique.c \ + utils.c + +OBJS = abort.o \ + await.o \ + clientdata.o \ + colorlist.o \ + conven.o \ + elements.o \ + errors.o \ + events.o \ + free.o \ + ieee.o \ + init.o \ + lut.o \ + photoflo.o \ + photomap.o \ + photospace.o \ + roi.o \ + technique.o \ + utils.o + +#include <Library.tmpl> + +#ifdef NativeFPFormat +NATIVE_FP_FORMAT = NativeFPFormat +FP_DEFINES = -DNATIVE_FP_FORMAT=$(NATIVE_FP_FORMAT) +SpecialCLibObjectRule(ieee,$(ICONFIGFILES),$(FP_DEFINES)) +#endif + +DependTarget() diff --git a/xc/lib/XIE/XIE-def.cpp b/xc/lib/XIE/XIE-def.cpp new file mode 100644 index 000000000..cbaa648db --- /dev/null +++ b/xc/lib/XIE/XIE-def.cpp @@ -0,0 +1,113 @@ +LIBRARY XIE +VERSION LIBRARY_VERSION +EXPORTS + XieAbort + XieAllocatePhotofloGraph + XieAwait + XieCreateColorList + XieCreateLUT + XieCreatePhotoflo + XieCreatePhotomap + XieCreatePhotospace + XieCreateROI + XieDestroyColorList + XieDestroyLUT + XieDestroyPhotoflo + XieDestroyPhotomap + XieDestroyPhotospace + XieDestroyROI + XieExecuteImmediate + XieExecutePhotoflo + XieFloArithmetic + XieFloBandCombine + XieFloBandExtract + XieFloBandSelect + XieFloBlend + XieFloCompare + XieFloConstrain + XieFloConvertFromIndex + XieFloConvertFromRGB + XieFloConvertToIndex + XieFloConvertToRGB + XieFloConvolve + XieFloDither + XieFloExportClientHistogram + XieFloExportClientLUT + XieFloExportClientPhoto + XieFloExportClientROI + XieFloExportDrawable + XieFloExportDrawablePlane + XieFloExportLUT + XieFloExportPhotomap + XieFloExportROI + XieFloGeometry + XieFloImportClientLUT + XieFloImportClientPhoto + XieFloImportClientROI + XieFloImportDrawable + XieFloImportDrawablePlane + XieFloImportLUT + XieFloImportPhotomap + XieFloImportROI + XieFloLogical + XieFloMatchHistogram + XieFloMath + XieFloPasteUp + XieFloPoint + XieFloUnconstrain + XieFreeEncodeJPEGBaseline + XieFreeEncodeJPEGLossless + XieFreePasteUpTiles + XieFreePhotofloGraph + XieFreeTechniques + XieGetClientData + XieInitialize + XieModifyPhotoflo + XiePurgeColorList + XiePutClientData + XieQueryColorList + XieQueryPhotoflo + XieQueryPhotomap + XieQueryTechniques + XieRedefinePhotoflo + XieTecCIELabToRGB + XieTecCIEXYZToRGB + XieTecClipScale + XieTecColorAllocAll + XieTecColorAllocMatch + XieTecColorAllocRequantize + XieTecConvolveConstant + XieTecDecodeG31D + XieTecDecodeG32D + XieTecDecodeG42D + XieTecDecodeJPEGBaseline + XieTecDecodeJPEGLossless + XieTecDecodeTIFF2 + XieTecDecodeTIFFPackBits + XieTecDecodeUncompressedSingle + XieTecDecodeUncompressedTriple + XieTecDitherOrderedParam + XieTecEncodeG31D + XieTecEncodeG32D + XieTecEncodeG42D + XieTecEncodeJPEGBaseline + XieTecEncodeJPEGLossless + XieTecEncodeServerChoice + XieTecEncodeTIFF2 + XieTecEncodeTIFFPackBits + XieTecEncodeUncompressedSingle + XieTecEncodeUncompressedTriple + XieTecGeomAntialiasByArea + XieTecGeomAntialiasByLowpass + XieTecGeomGaussian + XieTecGeomNearestNeighbor + XieTecHistogramGaussian + XieTecHistogramHyperbolic + XieTecRGBToCIELab + XieTecRGBToCIEXYZ + XieTecRGBToYCC + XieTecRGBToYCbCr + XieTecWhiteAdjustCIELabShift + XieTecYCCToRGB + XieTecYCbCrToRGB +/* $XConsortium: XIE-def.cpp /main/3 1996/05/07 13:15:28 kaleb $ */ diff --git a/xc/lib/XIE/XIElib.h b/xc/lib/XIE/XIElib.h new file mode 100644 index 000000000..fcbe74c64 --- /dev/null +++ b/xc/lib/XIE/XIElib.h @@ -0,0 +1,1910 @@ +/* $TOG: XIElib.h /main/13 1998/02/06 15:13:26 kaleb $ */ + +/* + +Copyright 1993, 1994, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifndef _XIELIB_H_ +#define _XIELIB_H_ + +#include <X11/Xlib.h> +#include <X11/extensions/XIE.h> + +/*--------------------------------------------------------------------------* + * XIE types * + *--------------------------------------------------------------------------*/ + +typedef float XieFloat; + +typedef float XieConstant[3]; + +typedef float XieMatrix[9]; + +typedef unsigned XieAlignment; + +typedef unsigned XieArithmeticOp; + +typedef unsigned XieColorAllocTechnique; + +typedef XID XieColorList; + +typedef unsigned XieColorspace; + +typedef unsigned XieCompareOp; + +typedef unsigned XieConstrainTechnique; + +typedef unsigned XieConvolveTechnique; + +typedef unsigned XieDataClass; + +typedef unsigned XieDataType; + +typedef unsigned XieDecodeTechnique; + +typedef unsigned XieDitherTechnique; + +typedef unsigned XieEncodeTechnique; + +typedef XID XiePhotospace; + +typedef XID XiePhotoflo; + +typedef unsigned XieExportNotify; + +typedef unsigned XieExportState; + +typedef unsigned XieGamutTechnique; + +typedef unsigned XieGeometryTechnique; + +typedef struct { + unsigned long value; + unsigned long count; +} XieHistogramData; + +typedef unsigned XieHistogramShape; + +typedef unsigned XieInterleave; + +typedef unsigned long XieLevels[3]; + +typedef XID XieLut; + +typedef unsigned XieMathOp; + +typedef unsigned XieOrientation; + +typedef unsigned XiePhotofloOutcome; + +typedef unsigned XiePhotofloState; + +typedef XID XiePhotomap; + +typedef unsigned XiePhototag; + +typedef struct { + int offset_x; + int offset_y; + XiePhototag phototag; +} XieProcessDomain; + +typedef struct { /* this is bcopyable on 32 bit machines */ + long x; /* when using PutClientData */ + long y; + unsigned long width; + unsigned long height; +} XieRectangle; + +typedef XID XieRoi; + +typedef unsigned XieServiceClass; + +typedef unsigned XieTechniqueGroup; + +typedef struct { + Bool needs_param; + XieTechniqueGroup group; + unsigned int number; + unsigned int speed; + char *name; +} XieTechnique; + +typedef struct { + XiePhototag src; + int dst_x; + int dst_y; +} XieTile; + +typedef unsigned long XieLTriplet[3]; + +typedef unsigned XieWhiteAdjustTechnique; + +#if NeedFunctionPrototypes +typedef void *XiePointer; +#else +typedef char *XiePointer; +#endif + + +/*--------------------------------------------------------------------------* + * Extension information * + *--------------------------------------------------------------------------*/ + +typedef struct { + unsigned server_major_rev; + unsigned server_minor_rev; + XieServiceClass service_class; + XieAlignment alignment; + int uncnst_mantissa; + int uncnst_min_exp; + int uncnst_max_exp; + int n_cnst_levels; /* number of constrained levels */ + unsigned long *cnst_levels; /* recommended constrained levels */ + int major_opcode; + int first_event; + int first_error; +} XieExtensionInfo; + + +/*--------------------------------------------------------------------------* + * Photoflo element union * + *--------------------------------------------------------------------------*/ + +typedef struct { + + int elemType; + + union { + + /* + * Import Elements + */ + + struct { + XieDataClass data_class; + XieOrientation band_order; + XieLTriplet length; + XieLevels levels; + } ImportClientLUT; + + struct { + XieDataClass data_class; + XieLTriplet width; + XieLTriplet height; + XieLevels levels; + Bool notify; + XieDecodeTechnique decode_tech; + XiePointer decode_param; + } ImportClientPhoto; + + struct { + unsigned int rectangles; + } ImportClientROI; + + struct { + Drawable drawable; + int src_x; + int src_y; + unsigned int width; + unsigned int height; + unsigned long fill; + Bool notify; + } ImportDrawable; + + struct { + Drawable drawable; + int src_x; + int src_y; + unsigned int width; + unsigned int height; + unsigned long fill; + unsigned long bit_plane; + Bool notify; + } ImportDrawablePlane; + + struct { + XieLut lut; + } ImportLUT; + + struct { + XiePhotomap photomap; + Bool notify; + } ImportPhotomap; + + struct { + XieRoi roi; + } ImportROI; + + + /* + * Process Elements + */ + + struct { + XiePhototag src1; + XiePhototag src2; + XieProcessDomain domain; + XieConstant constant; + XieArithmeticOp operator; + unsigned int band_mask; + } Arithmetic; + + struct { + XiePhototag src1; + XiePhototag src2; + XiePhototag src3; + } BandCombine; + + struct { + XiePhototag src; + unsigned int levels; + float bias; + XieConstant coefficients; + } BandExtract; + + struct { + XiePhototag src; + unsigned int band_number; + } BandSelect; + + struct { + XiePhototag src1; + XiePhototag src2; + XieConstant src_constant; + XiePhototag alpha; + float alpha_constant; + XieProcessDomain domain; + unsigned int band_mask; + } Blend; + + struct { + XiePhototag src1; + XiePhototag src2; + XieProcessDomain domain; + XieConstant constant; + XieCompareOp operator; + Bool combine; + unsigned int band_mask; + } Compare; + + struct { + XiePhototag src; + XieLevels levels; + XieConstrainTechnique constrain_tech; + XiePointer constrain_param; + } Constrain; + + struct { + XiePhototag src; + Colormap colormap; + XieDataClass data_class; + unsigned int precision; + } ConvertFromIndex; + + struct { + XiePhototag src; + XieColorspace color_space; + XiePointer color_param; + } ConvertFromRGB; + + struct { + XiePhototag src; + Colormap colormap; + XieColorList color_list; + Bool notify; + XieColorAllocTechnique color_alloc_tech; + XiePointer color_alloc_param; + } ConvertToIndex; + + struct { + XiePhototag src; + XieColorspace color_space; + XiePointer color_param; + } ConvertToRGB; + + struct { + XiePhototag src; + XieProcessDomain domain; + float *kernel; + int kernel_size; + unsigned int band_mask; + XieConvolveTechnique convolve_tech; + XiePointer convolve_param; + } Convolve; + + struct { + XiePhototag src; + XieLevels levels; + unsigned int band_mask; + XieDitherTechnique dither_tech; + XiePointer dither_param; + } Dither; + + struct { + XiePhototag src; + unsigned int width; + unsigned int height; + float coefficients[6]; + XieConstant constant; + unsigned int band_mask; + XieGeometryTechnique sample_tech; + XiePointer sample_param; + } Geometry; + + struct { + XiePhototag src1; + XiePhototag src2; + XieProcessDomain domain; + XieConstant constant; + int operator; + unsigned int band_mask; + } Logical; + + struct { + XiePhototag src; + XieProcessDomain domain; + XieHistogramShape shape; + XiePointer shape_param; + } MatchHistogram; + + struct { + XiePhototag src; + XieProcessDomain domain; + XieMathOp operator; + unsigned int band_mask; + } Math; + + struct { + unsigned int width; + unsigned int height; + XieConstant constant; + XieTile *tiles; + unsigned int tile_count; + } PasteUp; + + struct { + XiePhototag src; + XieProcessDomain domain; + XiePhototag lut; + unsigned int band_mask; + } Point; + + struct { + XiePhototag src; + } Unconstrain; + + /* + * Export Elements + */ + + struct { + XiePhototag src; + XieProcessDomain domain; + XieExportNotify notify; + } ExportClientHistogram; + + struct { + XiePhototag src; + XieOrientation band_order; + XieExportNotify notify; + XieLTriplet start; + XieLTriplet length; + } ExportClientLUT; + + struct { + XiePhototag src; + XieExportNotify notify; + XieEncodeTechnique encode_tech; + XiePointer encode_param; + } ExportClientPhoto; + + struct { + XiePhototag src; + XieExportNotify notify; + } ExportClientROI; + + struct { + XiePhototag src; + Drawable drawable; + GC gc; + int dst_x; + int dst_y; + } ExportDrawable; + + struct { + XiePhototag src; + Drawable drawable; + GC gc; + int dst_x; + int dst_y; + } ExportDrawablePlane; + + struct { + XiePhototag src; + XieLut lut; + Bool merge; + XieLTriplet start; + } ExportLUT; + + struct { + XiePhototag src; + XiePhotomap photomap; + XieEncodeTechnique encode_tech; + XiePointer encode_param; + } ExportPhotomap; + + struct { + XiePhototag src; + XieRoi roi; + } ExportROI; + + } data; +} XiePhotoElement; + +typedef XiePhotoElement *XiePhotofloGraph; + + +/*--------------------------------------------------------------------------* + * Technique Parameters * + *--------------------------------------------------------------------------*/ + +/* Color Alloc */ + +typedef struct { + unsigned long fill; +} XieColorAllocAllParam; + +typedef struct { + float match_limit; + float gray_limit; +} XieColorAllocMatchParam; + +typedef struct { + unsigned long max_cells; +} XieColorAllocRequantizeParam; + + +/* Colorspace - conversion from RGB */ + +typedef struct { + XieMatrix matrix; + XieWhiteAdjustTechnique white_adjust_tech; + XiePointer white_adjust_param; +} XieRGBToCIELabParam, XieRGBToCIEXYZParam; + +typedef struct { + XieLevels levels; + float luma_red; + float luma_green; + float luma_blue; + XieConstant bias; +} XieRGBToYCbCrParam; + +typedef struct { + XieLevels levels; + float luma_red; + float luma_green; + float luma_blue; + float scale; +} XieRGBToYCCParam; + + +/* Colorspace - conversion to RGB */ + +typedef struct { + XieMatrix matrix; + XieWhiteAdjustTechnique white_adjust_tech; + XiePointer white_adjust_param; + XieGamutTechnique gamut_tech; + XiePointer gamut_param; +} XieCIELabToRGBParam, XieCIEXYZToRGBParam; + +typedef struct { + XieLevels levels; + float luma_red; + float luma_green; + float luma_blue; + XieConstant bias; + XieGamutTechnique gamut_tech; + XiePointer gamut_param; +} XieYCbCrToRGBParam; + +typedef struct { + XieLevels levels; + float luma_red; + float luma_green; + float luma_blue; + float scale; + XieGamutTechnique gamut_tech; + XiePointer gamut_param; +} XieYCCToRGBParam; + +/* Constrain */ + +typedef struct { + XieConstant input_low,input_high; + XieLTriplet output_low,output_high; +} XieClipScaleParam; + + +/* Convolve */ + +typedef struct { + XieConstant constant; +} XieConvolveConstantParam; + + +/* Decode */ + +typedef struct { + XieOrientation fill_order; + XieOrientation pixel_order; + unsigned int pixel_stride; + unsigned int left_pad; + unsigned int scanline_pad; +} XieDecodeUncompressedSingleParam; + +typedef struct { + unsigned char left_pad[3]; + XieOrientation fill_order; + unsigned char pixel_stride[3]; + XieOrientation pixel_order; + unsigned char scanline_pad[3]; + XieOrientation band_order; + XieInterleave interleave; +} XieDecodeUncompressedTripleParam; + +typedef struct { + XieOrientation encoded_order; + Bool normal; + Bool radiometric; +} XieDecodeG31DParam, XieDecodeG32DParam, XieDecodeG42DParam, + XieDecodeTIFF2Param; + +typedef struct { + XieOrientation encoded_order; + Bool normal; +} XieDecodeTIFFPackBitsParam; + +typedef struct { + XieInterleave interleave; + XieOrientation band_order; + Bool up_sample; +} XieDecodeJPEGBaselineParam; + +typedef struct { + XieInterleave interleave; + XieOrientation band_order; +} XieDecodeJPEGLosslessParam; + + +/* Dither */ + +typedef struct { + unsigned int threshold_order; +} XieDitherOrderedParam; + + +/* Encode */ + +typedef struct { + XieOrientation fill_order; + XieOrientation pixel_order; + unsigned int pixel_stride; + unsigned int scanline_pad; +} XieEncodeUncompressedSingleParam; + +typedef struct { + unsigned char pixel_stride[3]; + XieOrientation pixel_order; + unsigned char scanline_pad[3]; + XieOrientation fill_order; + XieOrientation band_order; + XieInterleave interleave; +} XieEncodeUncompressedTripleParam; + +typedef struct { + Bool align_eol; + Bool radiometric; + XieOrientation encoded_order; +} XieEncodeG31DParam; + +typedef struct { + Bool uncompressed; + Bool align_eol; + Bool radiometric; + XieOrientation encoded_order; + unsigned long k_factor; +} XieEncodeG32DParam; + +typedef struct { + Bool uncompressed; + Bool radiometric; + XieOrientation encoded_order; +} XieEncodeG42DParam; + +typedef struct { + unsigned int preference; +} XieEncodeServerChoiceParam; + +typedef struct { + XieInterleave interleave; + XieOrientation band_order; + unsigned char horizontal_samples[3]; + unsigned char vertical_samples[3]; + char *q_table; + unsigned int q_size; + char *ac_table; + unsigned int ac_size; + char *dc_table; + unsigned int dc_size; +} XieEncodeJPEGBaselineParam; + +typedef struct { + XieInterleave interleave; + XieOrientation band_order; + unsigned char predictor[3]; + char *table; + unsigned int table_size; +} XieEncodeJPEGLosslessParam; + +typedef struct { + XieOrientation encoded_order; + Bool radiometric; +} XieEncodeTIFF2Param; + +typedef struct { + XieOrientation encoded_order; +} XieEncodeTIFFPackBitsParam; + + +/* Geometry */ + +typedef struct { + int simple; +} XieGeomAntialiasByAreaParam; + +typedef struct { + int kernel_size; +} XieGeomAntialiasByLowpassParam; + +typedef struct { + float sigma; + float normalize; + unsigned int radius; + Bool simple; +} XieGeomGaussianParam; + +typedef struct { + unsigned int modify; +} XieGeomNearestNeighborParam; + + +/* Histogram */ + +typedef struct { + float mean; + float sigma; +} XieHistogramGaussianParam; + +typedef struct { + float constant; + Bool shape_factor; +} XieHistogramHyperbolicParam; + + +/* White Adjust */ + +typedef struct { + XieConstant white_point; +} XieWhiteAdjustCIELabShiftParam; + + +/*--------------------------------------------------------------------------* + * Events * + *--------------------------------------------------------------------------*/ + +typedef struct { + int type; + unsigned long serial; + Bool send_event; + Display *display; + unsigned long name_space; + Time time; + unsigned long flo_id; + XiePhototag src; + unsigned int elem_type; + XieColorList color_list; + XieColorAllocTechnique color_alloc_technique; + unsigned long color_alloc_data; +} XieColorAllocEvent; + +typedef struct { + int type; + unsigned long serial; + Bool send_event; + Display *display; + unsigned long name_space; + Time time; + unsigned long flo_id; + XiePhototag src; + unsigned int elem_type; + XieDecodeTechnique decode_technique; + Bool aborted; + unsigned int band_number; + unsigned long width; + unsigned long height; +} XieDecodeNotifyEvent; + +typedef struct { + int type; + unsigned long serial; + Bool send_event; + Display *display; + unsigned long name_space; + Time time; + unsigned long flo_id; + XiePhototag src; + unsigned int elem_type; + unsigned int band_number; + unsigned long data[3]; +} XieExportAvailableEvent; + +typedef struct { + int type; + unsigned long serial; + Bool send_event; + Display *display; + unsigned long name_space; + Time time; + unsigned long flo_id; + XiePhototag src; + unsigned int elem_type; + Window window; + int x; + int y; + unsigned int width; + unsigned int height; +} XieImportObscuredEvent; + +typedef struct { + int type; + unsigned long serial; + Bool send_event; + Display *display; + unsigned long name_space; + Time time; + unsigned long flo_id; + XiePhotofloOutcome outcome; +} XiePhotofloDoneEvent; + + +/*--------------------------------------------------------------------------* + * Photoflo Errors * + *--------------------------------------------------------------------------*/ + +typedef struct { + int type; + Display *display; + unsigned long flo_id; + unsigned long serial; + unsigned char error_code; + unsigned char request_code; + unsigned char minor_code; + unsigned int flo_error_code; + unsigned long name_space; + XiePhototag phototag; + unsigned int elem_type; +} XieFloAccessError, XieFloAllocError, XieFloElementError, XieFloIDError, + XieFloLengthError, XieFloMatchError, XieFloSourceError; + +typedef struct { + int type; + Display *display; + unsigned long flo_id; + unsigned long serial; + unsigned char error_code; + unsigned char request_code; + unsigned char minor_code; + unsigned int flo_error_code; + unsigned long name_space; + XiePhototag phototag; + unsigned int elem_type; + XID resource_id; +} XieFloResourceError; + +typedef struct { + int type; + Display *display; + unsigned long flo_id; + unsigned long serial; + unsigned char error_code; + unsigned char request_code; + unsigned char minor_code; + unsigned int flo_error_code; + unsigned long name_space; + XiePhototag phototag; + unsigned int elem_type; + XiePhototag domain_src; +} XieFloDomainError; + +typedef struct { + int type; + Display *display; + unsigned long flo_id; + unsigned long serial; + unsigned char error_code; + unsigned char request_code; + unsigned char minor_code; + unsigned int flo_error_code; + unsigned long name_space; + XiePhototag phototag; + unsigned int elem_type; + unsigned int operator; +} XieFloOperatorError; + +typedef struct { + int type; + Display *display; + unsigned long flo_id; + unsigned long serial; + unsigned char error_code; + unsigned char request_code; + unsigned char minor_code; + unsigned int flo_error_code; + unsigned long name_space; + XiePhototag phototag; + unsigned int elem_type; + unsigned int technique_number; + unsigned int num_tech_params; + XieTechniqueGroup tech_group; +} XieFloTechniqueError; + +typedef struct { + int type; + Display *display; + unsigned long flo_id; + unsigned long serial; + unsigned char error_code; + unsigned char request_code; + unsigned char minor_code; + unsigned int flo_error_code; + unsigned long name_space; + XiePhototag phototag; + unsigned int elem_type; + unsigned long bad_value; +} XieFloValueError; + + +/*--------------------------------------------------------------------------* + * Function prototypes * + *--------------------------------------------------------------------------*/ + +/* Startup functions -------------------------------------------------------*/ + +extern Status XieInitialize ( +#if NeedFunctionPrototypes + Display * /* display */, + XieExtensionInfo ** /* extinfo_ret */ +#endif +); + +extern Status XieQueryTechniques ( +#if NeedFunctionPrototypes + Display * /* display */, + XieTechniqueGroup /* technique_group */, + int * /* ntechniques_ret */, + XieTechnique ** /* techniques_ret */ +#endif +); + +extern void XieFreeTechniques ( +#if NeedFunctionPrototypes + XieTechnique * /* techs */, + unsigned int /* count */ +#endif +); + + +/* Color List functions ---------------------------------------------------*/ + +extern XieColorList XieCreateColorList ( +#if NeedFunctionPrototypes + Display * /* display */ +#endif +); + +extern void XieDestroyColorList ( +#if NeedFunctionPrototypes + Display * /* display */, + XieColorList /* color_list */ +#endif +); + +extern void XiePurgeColorList ( +#if NeedFunctionPrototypes + Display * /* display */, + XieColorList /* color_list */ +#endif +); + +extern Status XieQueryColorList ( +#if NeedFunctionPrototypes + Display * /* display */, + XieColorList /* color_list */, + Colormap * /* colormap_ret */, + unsigned * /* ncolors_ret */, + unsigned long ** /* colors_ret */ +#endif +); + + +/* LUT functions -----------------------------------------------------------*/ + +extern XieLut XieCreateLUT ( +#if NeedFunctionPrototypes + Display * /* display */ +#endif +); + +extern void XieDestroyLUT ( +#if NeedFunctionPrototypes + Display * /* display */, + XieLut /* lut */ +#endif +); + + +/* Photomap functions ------------------------------------------------------*/ + +extern XiePhotomap XieCreatePhotomap ( +#if NeedFunctionPrototypes + Display * /* display */ +#endif +); + +extern void XieDestroyPhotomap ( +#if NeedFunctionPrototypes + Display * /* display */, + XiePhotomap /* photomap */ +#endif +); + +extern Status XieQueryPhotomap ( +#if NeedFunctionPrototypes + Display * /* display */, + XiePhotomap /* photomap */, + Bool * /* populated_ret */, + XieDataType * /* datatype_ret */, + XieDataClass * /* class_ret */, + XieDecodeTechnique * /* decode_technique_ret */, + XieLTriplet /* width_ret */, + XieLTriplet /* height_ret */, + XieLTriplet /* levels_ret */ +#endif +); + + +/* ROI functions -----------------------------------------------------------*/ + +extern XieRoi XieCreateROI ( +#if NeedFunctionPrototypes + Display * /* display */ +#endif +); + +extern void XieDestroyROI ( +#if NeedFunctionPrototypes + Display * /* display */, + XieRoi /* roi */ +#endif +); + + +/* Photospace functions ----------------------------------------------------*/ + +extern XiePhotospace XieCreatePhotospace ( +#if NeedFunctionPrototypes + Display * /* display */ +#endif +); + +extern void XieDestroyPhotospace ( +#if NeedFunctionPrototypes + Display * /* display */, + XiePhotospace /* photospace */ +#endif +); + +extern void XieExecuteImmediate ( +#if NeedFunctionPrototypes + Display * /* display */, + XiePhotospace /* photospace */, + unsigned long /* flo_id */, + Bool /* notify */, + XiePhotoElement * /* elem_list */, + int /* elem_count */ +#endif +); + + +/* Photoflo functions ------------------------------------------------------*/ + +extern XiePhotoElement *XieAllocatePhotofloGraph ( +#if NeedFunctionPrototypes + unsigned int /* count */ +#endif +); + +extern void XieFreePhotofloGraph ( +#if NeedFunctionPrototypes + XiePhotoElement * /* elements */, + unsigned int /* count */ +#endif +); + +extern XiePhotoflo XieCreatePhotoflo ( +#if NeedFunctionPrototypes + Display * /* display */, + XiePhotoElement * /* elem_list */, + int /* elem_count */ +#endif +); + +extern void XieDestroyPhotoflo ( +#if NeedFunctionPrototypes + Display * /* display */, + XiePhotoflo /* photoflo */ +#endif +); + +extern void XieExecutePhotoflo ( +#if NeedFunctionPrototypes + Display * /* display */, + XiePhotoflo /* photoflo */, + Bool /* notify */ +#endif +); + +extern void XieModifyPhotoflo ( +#if NeedFunctionPrototypes + Display * /* display */, + XiePhotoflo /* photoflo */, + int /* start */, + XiePhotoElement * /* elem_list */, + int /* elem_count */ +#endif +); + +extern void XieRedefinePhotoflo ( +#if NeedFunctionPrototypes + Display * /* display */, + XiePhotoflo /* photoflo */, + XiePhotoElement * /* elem_list */, + int /* elem_count */ +#endif +); + +extern Status XieQueryPhotoflo ( +#if NeedFunctionPrototypes + Display * /* display */, + unsigned long /* name_space */, + unsigned long /* flo_id */, + XiePhotofloState * /* state_ret */, + XiePhototag ** /* data_expected_ret */, + unsigned int * /* nexpected_ret */, + XiePhototag ** /* data_available_ret */, + unsigned int * /* navailable_ret */ +#endif +); + + +/* Client Data functions ---------------------------------------------------*/ + +extern void XiePutClientData ( +#if NeedFunctionPrototypes + Display * /* display */, + unsigned long /* name_space */, + unsigned long /* flo_id */, + XiePhototag /* element */, + Bool /* final */, + unsigned /* band_number */, + unsigned char * /* data */, + unsigned /* nbytes */ +#endif +); + +extern Status XieGetClientData ( +#if NeedFunctionPrototypes + Display * /* display */, + unsigned long /* name_space */, + unsigned long /* flo_id */, + XiePhototag /* element */, + unsigned /* max_bytes */, + Bool /* terminate */, + unsigned /* band_number */, + XieExportState * /* new_state_ret */, + unsigned char ** /* data_ret */, + unsigned * /* nbytes_ret */ +#endif +); + + +/* Abort and Await functions -----------------------------------------------*/ + +extern void XieAbort ( +#if NeedFunctionPrototypes + Display * /* display */, + unsigned long /* name_space */, + unsigned long /* flo_id */ +#endif +); + +extern void XieAwait ( +#if NeedFunctionPrototypes + Display * /* display */, + unsigned long /* name_space */, + unsigned long /* flo_id */ +#endif +); + + +/* Photoflo element functions ----------------------------------------------*/ + +extern void XieFloImportClientLUT ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XieDataClass /* data_class */, + XieOrientation /* band_order */, + XieLTriplet /* length */, + XieLevels /* levels */ +#endif +); + +extern void XieFloImportClientPhoto ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XieDataClass /* data_class */, + XieLTriplet /* width */, + XieLTriplet /* height */, + XieLevels /* levels */, + Bool /* notify */, + XieDecodeTechnique /* decode_tech */, + XiePointer /* decode_param */ +#endif +); + +extern void XieFloImportClientROI ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + unsigned int /* rectangles */ +#endif +); + +extern void XieFloImportDrawable ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + Drawable /* drawable */, + int /* src_x */, + int /* src_y */, + unsigned int /* width */, + unsigned int /* height */, + unsigned long /* fill */, + Bool /* notify */ +#endif +); + +extern void XieFloImportDrawablePlane ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + Drawable /* drawable */, + int /* src_x */, + int /* src_y */, + unsigned int /* width */, + unsigned int /* height */, + unsigned long /* fill */, + unsigned long /* bit_plane */, + Bool /* notify */ +#endif +); + +extern void XieFloImportLUT ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XieLut /* lut */ +#endif +); + +extern void XieFloImportPhotomap ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhotomap /* photomap */, + Bool /* notify */ +#endif +); + +extern void XieFloImportROI ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XieRoi /* roi */ +#endif +); + +extern void XieFloArithmetic ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src1 */, + XiePhototag /* src2 */, + XieProcessDomain * /* domain */, + XieConstant /* constant */, + XieArithmeticOp /* operator */, + unsigned int /* band_mask */ +#endif +); + +extern void XieFloBandCombine ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src1 */, + XiePhototag /* src2 */, + XiePhototag /* src3 */ +#endif +); + +extern void XieFloBandExtract ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + unsigned int /* levels */, + double /* bias */, + XieConstant /* coefficients */ +#endif +); + +extern void XieFloBandSelect ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + unsigned int /* band_number */ +#endif +); + +extern void XieFloBlend ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src1 */, + XiePhototag /* src2 */, + XieConstant /* src_constant */, + XiePhototag /* alpha */, + double /* alpha_const */, + XieProcessDomain * /* domain */, + unsigned int /* band_mask */ +#endif +); + +extern void XieFloCompare ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src1 */, + XiePhototag /* src2 */, + XieProcessDomain * /* domain */, + XieConstant /* constant */, + XieCompareOp /* operator */, + Bool /* combine */, + unsigned int /* band_mask */ +#endif +); + +extern void XieFloConstrain ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + XieLevels /* levels */, + XieConstrainTechnique /* constrain_tech */, + XiePointer /* constrain_param */ +#endif +); + +extern void XieFloConvertFromIndex ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + Colormap /* colormap */, + XieDataClass /* data_class */, + unsigned int /* precision */ +#endif +); + +extern void XieFloConvertFromRGB ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + XieColorspace /* color_space */, + XiePointer /* color_param */ +#endif +); + +extern void XieFloConvertToIndex ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + Colormap /* colormap */, + XieColorList /* color_list */, + Bool /* notify */, + XieColorAllocTechnique /* color_alloc_tech */, + XiePointer /* color_alloc_param */ +#endif +); + +extern void XieFloConvertToRGB ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + XieColorspace /* color_space */, + XiePointer /* color_param */ +#endif +); + +extern void XieFloConvolve ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + XieProcessDomain * /* domain */, + float * /* kernel */, + int /* kernel_size */, + unsigned int /* band_mask */, + XieConvolveTechnique /* convolve_tech */, + XiePointer /* convolve_param */ +#endif +); + +extern void XieFloDither ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + unsigned int /* band_mask */, + XieLevels /* levels */, + XieDitherTechnique /* dither_tech */, + XiePointer /* dither_param */ +#endif +); + +extern void XieFloGeometry ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + unsigned int /* width */, + unsigned int /* height */, + float[6] /* coefficients[6] */, + XieConstant /* constant */, + unsigned int /* band_mask */, + XieGeometryTechnique /* sample_tech */, + XiePointer /* sample_param */ +#endif +); + +extern void XieFloLogical ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src1 */, + XiePhototag /* src2 */, + XieProcessDomain * /* domain */, + XieConstant /* constant */, + unsigned long /* operator */, + unsigned int /* band_mask */ +#endif +); + +extern void XieFloMatchHistogram ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + XieProcessDomain * /* domain */, + XieHistogramShape /* shape */, + XiePointer /* shape_param */ +#endif +); + +extern void XieFloMath ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + XieProcessDomain * /* domain */, + XieMathOp /* operator */, + unsigned int /* band_mask */ +#endif +); + +extern void XieFloPasteUp ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + unsigned int /* width */, + unsigned int /* height */, + XieConstant /* constant */, + XieTile * /* tiles */, + unsigned int /* tile_count */ +#endif +); + +extern void XieFloPoint ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + XieProcessDomain * /* domain */, + XiePhototag /* lut */, + unsigned int /* band_mask */ +#endif +); + +extern void XieFloUnconstrain ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */ +#endif +); + +extern void XieFloExportClientHistogram ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + XieProcessDomain * /* domain */, + XieExportNotify /* notify */ +#endif +); + +extern void XieFloExportClientLUT ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + XieOrientation /* band_order */, + XieExportNotify /* notify */, + XieLTriplet /* start */, + XieLTriplet /* length */ +#endif +); + +extern void XieFloExportClientPhoto ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + XieExportNotify /* notify */, + XieEncodeTechnique /* encode_tech */, + XiePointer /* encode_param */ +#endif +); + +extern void XieFloExportClientROI ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + XieExportNotify /* notify */ +#endif +); + +extern void XieFloExportDrawable ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + Drawable /* drawable */, + GC /* gc */, + int /* dst_x */, + int /* dst_y */ +#endif +); + +extern void XieFloExportDrawablePlane ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + Drawable /* drawable */, + GC /* gc */, + int /* dst_x */, + int /* dst_y */ +#endif +); + +extern void XieFloExportLUT ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + XieLut /* lut */, + Bool /* merge */, + XieLTriplet /* start */ +#endif +); + +extern void XieFloExportPhotomap ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + XiePhotomap /* photomap */, + XieEncodeTechnique /* encode_tech */, + XiePointer /* encode_param */ +#endif +); + +extern void XieFloExportROI ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */, + XiePhototag /* src */, + XieRoi /* roi */ +#endif +); + + +/* Technique functions -----------------------------------------------------*/ + +extern XieColorAllocAllParam *XieTecColorAllocAll ( +#if NeedFunctionPrototypes + unsigned long /* fill */ +#endif +); + +extern XieColorAllocMatchParam *XieTecColorAllocMatch ( +#if NeedFunctionPrototypes + double /* match_limit */, + double /* gray_limit */ +#endif +); + +extern XieColorAllocRequantizeParam *XieTecColorAllocRequantize ( +#if NeedFunctionPrototypes + unsigned long /* max_cells */ +#endif +); + +extern XieRGBToCIELabParam *XieTecRGBToCIELab ( +#if NeedFunctionPrototypes + XieMatrix /* matrix */, + XieWhiteAdjustTechnique /* white_adjust_tech */, + XiePointer /* white_adjust_param */ +#endif +); + +extern XieRGBToCIEXYZParam *XieTecRGBToCIEXYZ ( +#if NeedFunctionPrototypes + XieMatrix /* matrix */, + XieWhiteAdjustTechnique /* white_adjust_tech */, + XiePointer /* white_adjust_param */ +#endif +); + +extern XieRGBToYCbCrParam *XieTecRGBToYCbCr ( +#if NeedFunctionPrototypes + XieLevels /* levels */, + double /* luma_red */, + double /* luma_green */, + double /* luma_blue */, + XieConstant /* bias */ +#endif +); + +extern XieRGBToYCCParam *XieTecRGBToYCC ( +#if NeedFunctionPrototypes + XieLevels /* levels */, + double /* luma_red */, + double /* luma_green */, + double /* luma_blue */, + double /* scale */ +#endif +); + +extern XieCIELabToRGBParam *XieTecCIELabToRGB ( +#if NeedFunctionPrototypes + XieMatrix /* matrix */, + XieWhiteAdjustTechnique /* white_adjust_tech */, + XiePointer /* white_adjust_param */, + XieGamutTechnique /* gamut_tech */, + XiePointer /* gamut_param */ +#endif +); + +extern XieCIEXYZToRGBParam *XieTecCIEXYZToRGB ( +#if NeedFunctionPrototypes + XieMatrix /* matrix */, + XieWhiteAdjustTechnique /* white_adjust_tech */, + XiePointer /* white_adjust_param */, + XieGamutTechnique /* gamut_tech */, + XiePointer /* gamut_param */ +#endif +); + +extern XieYCbCrToRGBParam *XieTecYCbCrToRGB ( +#if NeedFunctionPrototypes + XieLevels /* levels */, + double /* luma_red */, + double /* luma_green */, + double /* luma_blue */, + XieConstant /* bias */, + XieGamutTechnique /* gamut_tech */, + XiePointer /* gamut_param */ +#endif +); + +extern XieYCCToRGBParam *XieTecYCCToRGB ( +#if NeedFunctionPrototypes + XieLevels /* levels */, + double /* luma_red */, + double /* luma_green */, + double /* luma_blue */, + double /* scale */, + XieGamutTechnique /* gamut_tech */, + XiePointer /* gamut_param */ +#endif +); + +extern XieClipScaleParam *XieTecClipScale ( +#if NeedFunctionPrototypes + XieConstant /* in_low */, + XieConstant /* in_high */, + XieLTriplet /* out_low */, + XieLTriplet /* out_high */ +#endif +); + +extern XieConvolveConstantParam *XieTecConvolveConstant ( +#if NeedFunctionPrototypes + XieConstant /* constant */ +#endif +); + +extern XieDecodeUncompressedSingleParam *XieTecDecodeUncompressedSingle ( +#if NeedFunctionPrototypes + XieOrientation /* fill_order */, + XieOrientation /* pixel_order */, + unsigned int /* pixel_stride */, + unsigned int /* left_pad */, + unsigned int /* scanline_pad */ +#endif +); + +extern XieDecodeUncompressedTripleParam *XieTecDecodeUncompressedTriple ( +#if NeedFunctionPrototypes + XieOrientation /* fill_order */, + XieOrientation /* pixel_order */, + XieOrientation /* band_order */, + XieInterleave /* interleave */, + unsigned char[3] /* pixel_stride[3] */, + unsigned char[3] /* left_pad[3] */, + unsigned char[3] /* scanline_pad[3] */ +#endif +); + +extern XieDecodeG31DParam *XieTecDecodeG31D ( +#if NeedFunctionPrototypes + XieOrientation /* encoded_order */, + Bool /* normal */, + Bool /* radiometric */ +#endif +); + +extern XieDecodeG32DParam *XieTecDecodeG32D ( +#if NeedFunctionPrototypes + XieOrientation /* encoded_order */, + Bool /* normal */, + Bool /* radiometric */ +#endif +); + +extern XieDecodeG42DParam *XieTecDecodeG42D ( +#if NeedFunctionPrototypes + XieOrientation /* encoded_order */, + Bool /* normal */, + Bool /* radiometric */ +#endif +); + +extern XieDecodeTIFF2Param *XieTecDecodeTIFF2 ( +#if NeedFunctionPrototypes + XieOrientation /* encoded_order */, + Bool /* normal */, + Bool /* radiometric */ +#endif +); + +extern XieDecodeTIFFPackBitsParam *XieTecDecodeTIFFPackBits ( +#if NeedFunctionPrototypes + XieOrientation /* encoded_order */, + Bool /* normal */ +#endif +); + +extern XieDecodeJPEGBaselineParam *XieTecDecodeJPEGBaseline ( +#if NeedFunctionPrototypes + XieInterleave /* interleave */, + XieOrientation /* band_order */, + Bool /* up_sample */ +#endif +); + +extern XieDecodeJPEGLosslessParam *XieTecDecodeJPEGLossless ( +#if NeedFunctionPrototypes + XieInterleave /* interleave */, + XieOrientation /* band_order */ +#endif +); + +extern XieDitherOrderedParam *XieTecDitherOrderedParam ( +#if NeedFunctionPrototypes + unsigned int /* threshold_order */ +#endif +); + +extern XieEncodeUncompressedSingleParam *XieTecEncodeUncompressedSingle ( +#if NeedFunctionPrototypes + XieOrientation /* fill_order */, + XieOrientation /* pixel_order */, + unsigned int /* pixel_stride */, + unsigned int /* scanline_pad */ +#endif +); + +extern XieEncodeUncompressedTripleParam *XieTecEncodeUncompressedTriple ( +#if NeedFunctionPrototypes + XieOrientation /* fill_order */, + XieOrientation /* pixel_order */, + XieOrientation /* band_order */, + XieInterleave /* interleave */, + unsigned char[3] /* pixel_stride[3] */, + unsigned char[3] /* scanline_pad[3] */ +#endif +); + +extern XieEncodeG31DParam *XieTecEncodeG31D ( +#if NeedFunctionPrototypes + Bool /* align_eol */, + Bool /* radiometric */, + XieOrientation /* encoded_order */ +#endif +); + +extern XieEncodeG32DParam *XieTecEncodeG32D ( +#if NeedFunctionPrototypes + Bool /* uncompressed */, + Bool /* align_eol */, + Bool /* radiometric */, + XieOrientation /* encoded_order */, + unsigned long /* k_factor */ +#endif +); + +extern XieEncodeG42DParam *XieTecEncodeG42D ( +#if NeedFunctionPrototypes + Bool /* uncompressed */, + Bool /* radiometric */, + XieOrientation /* encoded_order */ +#endif +); + +extern XieEncodeServerChoiceParam *XieTecEncodeServerChoice ( +#if NeedFunctionPrototypes + unsigned int /* preference */ +#endif +); + +extern XieEncodeJPEGBaselineParam *XieTecEncodeJPEGBaseline ( +#if NeedFunctionPrototypes + XieInterleave /* interleave */, + XieOrientation /* band_order */, + unsigned char[3] /* horizontal_samples[3] */, + unsigned char[3] /* vertical_samples[3] */, + char * /* q_table */, + unsigned int /* q_size */, + char * /* ac_table */, + unsigned int /* ac_size */, + char * /* dc_table */, + unsigned int /* dc_size */ +#endif +); + +extern void XieFreeEncodeJPEGBaseline ( +#if NeedFunctionPrototypes + XieEncodeJPEGBaselineParam * /* param */ +#endif +); + +extern XieEncodeJPEGLosslessParam *XieTecEncodeJPEGLossless ( +#if NeedFunctionPrototypes + XieInterleave /* interleave */, + XieOrientation /* band_order */, + unsigned char[3] /* predictor[3] */, + char * /* table */, + unsigned int /* table_size */ +#endif +); + +extern void XieFreeEncodeJPEGLossless ( +#if NeedFunctionPrototypes + XieEncodeJPEGLosslessParam * /* param */ +#endif +); + +extern void XieFreePasteUpTiles ( +#if NeedFunctionPrototypes + XiePhotoElement * /* element */ +#endif +); + +extern XieEncodeTIFF2Param *XieTecEncodeTIFF2 ( +#if NeedFunctionPrototypes + XieOrientation /* encoded_order */, + Bool /* radiometric */ +#endif +); + +extern XieEncodeTIFFPackBitsParam *XieTecEncodeTIFFPackBits ( +#if NeedFunctionPrototypes + XieOrientation /* encoded_order */ +#endif +); + +extern XieGeomAntialiasByAreaParam *XieTecGeomAntialiasByArea ( +#if NeedFunctionPrototypes + int /* simple */ +#endif +); + +extern XieGeomAntialiasByLowpassParam *XieTecGeomAntialiasByLowpass ( +#if NeedFunctionPrototypes + int /* kernel_size */ +#endif +); + +extern XieGeomGaussianParam *XieTecGeomGaussian ( +#if NeedFunctionPrototypes + double /* sigma */, + double /* normalize */, + unsigned int /* radius */, + Bool /* simple */ +#endif +); + +extern XieGeomNearestNeighborParam *XieTecGeomNearestNeighbor ( +#if NeedFunctionPrototypes + unsigned int /* modify */ +#endif +); + +extern XieHistogramGaussianParam *XieTecHistogramGaussian ( +#if NeedFunctionPrototypes + double /* mean */, + double /* sigma */ +#endif +); + +extern XieHistogramHyperbolicParam *XieTecHistogramHyperbolic ( +#if NeedFunctionPrototypes + double /* constant */, + Bool /* shape_factor */ +#endif +); + +extern XieWhiteAdjustCIELabShiftParam *XieTecWhiteAdjustCIELabShift ( +#if NeedFunctionPrototypes + XieConstant /* white_point */ +#endif +); + + +#endif /* _XIELIB_H_ */ diff --git a/xc/lib/XIE/XIElibint.h b/xc/lib/XIE/XIElibint.h new file mode 100644 index 000000000..0e23c69f6 --- /dev/null +++ b/xc/lib/XIE/XIElibint.h @@ -0,0 +1,313 @@ +/* $TOG: XIElibint.h /main/9 1998/02/06 15:13:20 kaleb $ */ +/* + +Copyright 1993, 1994, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/lib/XIE/XIElibint.h,v 3.3 1999/06/13 16:18:06 dawes Exp $ */ + +#ifndef _XIELIBINT_H_ +#define _XIELIBINT_H_ + +#define NEED_REPLIES +#include <X11/Xlibint.h> +#include <X11/Xfuncs.h> +#include <X11/extensions/XIElib.h> +#include <X11/extensions/XIEproto.h> + + + +/* ------------------------------------------------------------------------- + * Display extension data structures and macros. + * ------------------------------------------------------------------------- */ + +/* + * For each display initialized by XieInitialize(), a record is allocated + * which holds various information about that display. These records are + * maintained in a linked list. The record for the most recently referenced + * display is always kept at the beginning of the list (for quick access). + */ + +typedef struct _XieExtInfo +{ + Display *display; /* pointer to X display structure */ + XExtCodes *extCodes; /* extension codes */ + XieExtensionInfo *extInfo; /* extension information */ + struct _XieExtInfo *next; /* next in list */ +} XieExtInfo; + + +/* + * Insert a new record in the beginning of the linked list. + */ + +#define ADD_EXTENSION_INFO(_display, _info) \ +\ +{ \ + _info->display = _display; \ +\ + _info->next = _XieExtInfoHeader; \ + _XieExtInfoHeader = _info; \ +} + + +/* + * Remove the record assosicated with '_display' from the linked list + * and return a pointer to it in '_info'. + */ + +#define REMOVE_EXTENSION_INFO(_display, _info) \ +\ +{ \ + XieExtInfo *prev = NULL; \ +\ + _info = _XieExtInfoHeader; \ +\ + while (_info && _info->display != _display) \ + { \ + prev = _info; \ + _info = _info->next; \ + } \ +\ + if (_info) \ + if (!prev) \ + _XieExtInfoHeader = _info->next; \ + else \ + prev->next = _info->next; \ +} + + +/* + * Return the info assosicated with '_display' in '_info'. + * If the info is not the first in the list, move it to the front. + */ + +#define GET_EXTENSION_INFO(_display, _info) \ +\ +{ \ + if ((_info = _XieExtInfoHeader) != 0) \ + { \ + if (_XieExtInfoHeader->display != _display) \ + { \ + XieExtInfo *prev = _XieExtInfoHeader; \ +\ + _info = _info->next; \ + while (_info && _info->display != _display) \ + { \ + prev = _info; \ + _info = _info->next; \ + } \ +\ + if (_info) \ + { \ + prev->next = _info->next; \ + _info->next = _XieExtInfoHeader; \ + _XieExtInfoHeader = _info; \ + } \ + } \ + } \ +} + + + + + + +#define PAD(_size) (3 - (((_size) + 3) & 0x3)) + +#define PADDED_BYTES(_bytes) (_bytes + PAD (_bytes)) + +#define NUMWORDS(_size) (((unsigned int) ((_size) + 3)) >> 2) + +#define NUMBYTES(_len) (((unsigned int) (_len)) << 2) + +#define LENOF(_ctype) (SIZEOF (_ctype) >> 2) + + + + + +/* ------------------------------------------------------------------------- + * Macros for setting up requests. + * ------------------------------------------------------------------------- */ + +/* + * Request names and opcodes. + */ + +#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#define REQNAME(_name_) xie##_name_##Req +#define REQOPCODE(_name_) X_ie##_name_ +#define REQSIZE(_name_) sz_xie##_name_##Req +#else +#define REQNAME(_name_) xie/**/_name_/**/Req +#define REQOPCODE(_name_) X_ie/**/_name_ +#define REQSIZE(_name_) sz_xie/**/_name_/**/Req +#endif + + +/* + * GET_REQUEST sets up a request to be sent to the X server. If there isn't + * enough room left in the X buffer, it is flushed before the new request + * is started. + */ + +#define GET_REQUEST(_name, _req) \ + if ((display->bufptr + REQSIZE(_name)) > display->bufmax) \ + _XFlush (display); \ + _req = (char *) (display->last_req = display->bufptr); \ + display->bufptr += REQSIZE(_name); \ + display->request++ + + +/* + * GET_REQUEST_EXTRA is the same as GET_REQUEST and except that an additional + * "extraBytes" are allocated after the request. "extraBytes" will be + * padded to a word boundary. + */ + +#define GET_REQUEST_EXTRA(_name, _extraBytes, _req) \ + if ((display->bufptr + REQSIZE(_name) + \ + PADDED_BYTES (_extraBytes)) > display->bufmax) _XFlush (display); \ + _req = (char *) (display->last_req = display->bufptr); \ + display->bufptr += (REQSIZE(_name) + PADDED_BYTES (_extraBytes)); \ + display->request++ + + +/* + * BEGIN_REQUEST_HEADER and END_REQUEST_HEADER are used to hide + * the extra work that has to be done on 64 bit clients. On such + * machines, all structure pointers must point to an 8 byte boundary. + * As a result, we must first store the request header info in + * a static data stucture, then bcopy it into the transport buffer. + */ + +#ifndef WORD64 + +#define BEGIN_REQUEST_HEADER(_name, _pBuf, _pReq) \ +{ \ + XieExtInfo *_xieExtInfo; \ + GET_EXTENSION_INFO (display, _xieExtInfo); \ + _pReq = (REQNAME(_name) *) _pBuf; + +#define END_REQUEST_HEADER(_name, _pBuf, _pReq) \ + _pBuf += REQSIZE(_name); \ +} + +#else /* WORD64 */ + +#define BEGIN_REQUEST_HEADER(_name, _pBuf, _pReq) \ +{ \ + XieExtInfo *_xieExtInfo; \ + REQNAME(_name) tReq; \ + GET_EXTENSION_INFO (display, _xieExtInfo); \ + _pReq = &tReq; + +#define END_REQUEST_HEADER(_name, _pBuf, _pReq) \ + memcpy (_pBuf, _pReq, REQSIZE(_name)); \ + _pBuf += REQSIZE(_name); \ +} + +#endif /* WORD64 */ + + +/* + * Macros used to store the request header info. + */ + +#define STORE_REQUEST_HEADER(_name, _req) \ + _req->reqType = _xieExtInfo->extCodes->major_opcode; \ + _req->opcode = REQOPCODE(_name); \ + _req->length = (REQSIZE(_name)) >> 2; + + +#define STORE_REQUEST_EXTRA_HEADER(_name, _extraBytes, _req) \ + _req->reqType = _xieExtInfo->extCodes->major_opcode; \ + _req->opcode = REQOPCODE(_name); \ + _req->length = (REQSIZE(_name) + PADDED_BYTES (_extraBytes)) >> 2; + + + + +typedef int (*XieTechFuncPtr) (char **, XiePointer, int); + +typedef struct _XieTechFuncRec { + int technique; + XieTechFuncPtr techfunc; + struct _XieTechFuncRec *next; +} XieTechFuncRec; + + + + +/* + * See if XSynchronize has been called. If so, send request right away. + */ + +#define SYNC_HANDLE(_display)\ + if ((_display)->synchandler) (*(_display)->synchandler) (_display) + + +/* + * Read a reply into a scratch buffer. + */ + +#define XREAD_INTO_SCRATCH(_display, _pBuf, _numBytes) \ + _pBuf = (char *) _XAllocTemp (_display, _numBytes); \ + _XRead (_display, _pBuf, _numBytes); + +#define FINISH_WITH_SCRATCH(_display, _pBuf, _numBytes) \ + _XFreeTemp (_display, _pBuf, _numBytes); + + +/* + * Externally defined globals + */ + +extern XieExtInfo *_XieExtInfoHeader; +extern void (*(_XieElemFuncs[]))(char **, XiePhotoElement *); +extern XieTechFuncRec *_XieTechFuncs[]; +extern Bool _XieTechFuncsInitialized; + +extern Bool _XieFloError (Display *, XErrorEvent *, xError *); +extern Status _XieColorAllocEvent (Display *, XEvent *, xEvent *); +extern Status _XieDecodeNotifyEvent (Display *, XEvent *, xEvent *); +extern Status _XieExportAvailableEvent (Display *, XEvent *, xEvent *); +extern Status _XieImportObscuredEvent (Display *, XEvent *, xEvent *); +extern Status _XiePhotofloDoneEvent (Display *, XEvent *, xEvent *); +extern Status _XieRegisterTechFunc (int, int, XieTechFuncPtr); +extern XieTechFuncPtr _XieLookupTechFunc (int, int); +extern int _XieCloseDisplay (Display *, XExtCodes *); +extern int _XiePhotofloSize (XiePhotoElement *, int); +extern int _XieTechniqueLength (int, int, XiePointer); +extern void _XieEncodeTechnique (char **, int, int, XiePointer); +extern void _XieInitTechFuncTable (void); +extern void _XiePrintError (Display *display, XErrorEvent *error, void *fp); +extern xieTypFloat _XieConvertToIEEE(double); + +/* for X-Window system protocol elements */ +#define sz_CARD32 4 +#define sz_CARD16 2 +#define sz_CARD8 1 +#define sz_INT32 4 +#define sz_INT16 2 + +#endif /* _XIELIBINT_H_ */ diff --git a/xc/lib/XIE/XIEos2.def b/xc/lib/XIE/XIEos2.def new file mode 100644 index 000000000..8d09e930e --- /dev/null +++ b/xc/lib/XIE/XIEos2.def @@ -0,0 +1,207 @@ +LIBRARY XIE +DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/XIE/XIEos2.def,v 3.6 1999/04/29 09:13:29 dawes Exp $" +CODE + PRELOAD +DATA + MULTIPLE NONSHARED +STACKSIZE 32768 +EXPORTS + XieAbort @ 1 + XieAllocatePhotofloGraph @ 2 + XieAwait @ 3 + XieCreateColorList @ 4 + XieCreateLUT @ 5 + XieCreatePhotoflo @ 6 + XieCreatePhotomap @ 7 + XieCreatePhotospace @ 8 + XieCreateROI @ 9 + XieDestroyColorList @ 10 + XieDestroyLUT @ 11 + XieDestroyPhotoflo @ 12 + XieDestroyPhotomap @ 13 + XieDestroyPhotospace @ 14 + XieDestroyROI @ 15 + XieExecuteImmediate @ 16 + XieExecutePhotoflo @ 17 + XieFloArithmetic @ 18 + XieFloBandCombine @ 19 + XieFloBandExtract @ 20 + XieFloBandSelect @ 21 + XieFloBlend @ 22 + XieFloCompare @ 23 + XieFloConstrain @ 24 + XieFloConvertFromIndex @ 25 + XieFloConvertFromRGB @ 26 + XieFloConvertToIndex @ 27 + XieFloConvertToRGB @ 28 + XieFloConvolve @ 29 + XieFloDither @ 30 + XieFloExportClientHistogram @ 31 + XieFloExportClientLUT @ 32 + XieFloExportClientPhoto @ 33 + XieFloExportClientROI @ 34 + XieFloExportDrawable @ 35 + XieFloExportDrawablePlane @ 36 + XieFloExportLUT @ 37 + XieFloExportPhotomap @ 38 + XieFloExportROI @ 39 + XieFloGeometry @ 40 + XieFloImportClientLUT @ 41 + XieFloImportClientPhoto @ 42 + XieFloImportClientROI @ 43 + XieFloImportDrawable @ 44 + XieFloImportDrawablePlane @ 45 + XieFloImportLUT @ 46 + XieFloImportPhotomap @ 47 + XieFloImportROI @ 48 + XieFloLogical @ 49 + XieFloMatchHistogram @ 50 + XieFloMath @ 51 + XieFloPasteUp @ 52 + XieFloPoint @ 53 + XieFloUnconstrain @ 54 + XieFreeEncodeJPEGBaseline @ 55 + XieFreeEncodeJPEGLossless @ 56 + XieFreePasteUpTiles @ 57 + XieFreePhotofloGraph @ 58 + XieFreeTechniques @ 59 + XieGetClientData @ 60 + XieInitialize @ 61 + XieModifyPhotoflo @ 62 + XiePurgeColorList @ 63 + XiePutClientData @ 64 + XieQueryColorList @ 65 + XieQueryPhotoflo @ 66 + XieQueryPhotomap @ 67 + XieQueryTechniques @ 68 + XieRedefinePhotoflo @ 69 + XieTecCIELabToRGB @ 70 + XieTecCIEXYZToRGB @ 71 + XieTecClipScale @ 72 + XieTecColorAllocAll @ 73 + XieTecColorAllocMatch @ 74 + XieTecColorAllocRequantize @ 75 + XieTecConvolveConstant @ 76 + XieTecDecodeG31D @ 77 + XieTecDecodeG32D @ 78 + XieTecDecodeG42D @ 79 + XieTecDecodeJPEGBaseline @ 80 + XieTecDecodeJPEGLossless @ 81 + XieTecDecodeTIFF2 @ 82 + XieTecDecodeTIFFPackBits @ 83 + XieTecDecodeUncompressedSingle @ 84 + XieTecDecodeUncompressedTriple @ 85 + XieTecDitherOrderedParam @ 86 + XieTecEncodeG31D @ 87 + XieTecEncodeG32D @ 88 + XieTecEncodeG42D @ 89 + XieTecEncodeJPEGBaseline @ 90 + XieTecEncodeJPEGLossless @ 91 + XieTecEncodeServerChoice @ 92 + XieTecEncodeTIFF2 @ 93 + XieTecEncodeTIFFPackBits @ 94 + XieTecEncodeUncompressedSingle @ 95 + XieTecEncodeUncompressedTriple @ 96 + XieTecGeomAntialiasByArea @ 97 + XieTecGeomAntialiasByLowpass @ 98 + XieTecGeomGaussian @ 99 + XieTecGeomNearestNeighbor @ 100 + XieTecHistogramGaussian @ 101 + XieTecHistogramHyperbolic @ 102 + XieTecRGBToCIELab @ 103 + XieTecRGBToCIEXYZ @ 104 + XieTecRGBToYCC @ 105 + XieTecRGBToYCbCr @ 106 + XieTecWhiteAdjustCIELabShift @ 107 + XieTecYCCToRGB @ 108 + XieTecYCbCrToRGB @ 109 + _XiePhotofloSize @ 110 + _XieElemImportClientLUT @ 111 + _XieElemImportClientPhoto @ 112 + _XieElemImportClientROI @ 113 + _XieElemImportDrawable @ 114 + _XieElemImportDrawablePlane @ 115 + _XieElemImportLUT @ 116 + _XieElemImportPhotomap @ 117 + _XieElemImportROI @ 118 + _XieElemArithmetic @ 119 + _XieElemBandCombine @ 120 + _XieElemBandExtract @ 121 + _XieElemBandSelect @ 122 + _XieElemBlend @ 123 + _XieElemCompare @ 124 + _XieElemConstrain @ 125 + _XieElemConvertFromIndex @ 126 + _XieElemConvertFromRGB @ 127 + _XieElemConvertToIndex @ 128 + _XieElemConvertToRGB @ 129 + _XieElemConvolve @ 130 + _XieElemDither @ 131 + _XieElemGeometry @ 132 + _XieElemLogical @ 133 + _XieElemMatchHistogram @ 134 + _XieElemMath @ 135 + _XieElemPasteUp @ 136 + _XieElemPoint @ 137 + _XieElemUnconstrain @ 138 + _XieElemExportClientHistogram @ 139 + _XieElemExportClientLUT @ 140 + _XieElemExportClientPhoto @ 141 + _XieElemExportClientROI @ 142 + _XieElemExportDrawable @ 143 + _XieElemExportDrawablePlane @ 144 + _XieElemExportLUT @ 145 + _XieElemExportPhotomap @ 146 + _XieElemExportROI @ 147 + _XieFloError @ 148 + _XieColorAllocEvent @ 149 + _XieDecodeNotifyEvent @ 150 + _XieExportAvailableEvent @ 151 + _XieImportObscuredEvent @ 152 + _XiePhotofloDoneEvent @ 153 + _XieConvertToIEEE @ 154 + _XieCloseDisplay @ 155 + _XiePrintError @ 156 + _XieTechniqueLength @ 157 + _XieEncodeTechnique @ 158 + _XieColorAllocAllParam @ 159 + _XieColorAllocMatchParam @ 160 + _XieColorAllocRequantizeParam @ 161 + _XieRGBToCIELabParam @ 162 + _XieRGBToYCbCrParam @ 163 + _XieRGBToYCCParam @ 164 + _XieYCbCrToRGBParam @ 165 + _XieYCCToRGBParam @ 166 + _XieCIELabToRGBParam @ 167 + _XieConvolveConstantParam @ 168 + _XieClipScaleParam @ 169 + _XieDecodeUncompressedSingleParam @ 170 + _XieDecodeUncompressedTripleParam @ 171 + _XieDecodeG31DParam @ 172 + _XieDecodeTIFFPackBitsParam @ 173 + _XieDecodeJPEGBaselineParam @ 174 + _XieDitherOrderedParam @ 175 + _XieEncodeUncompressedSingleParam @ 176 + _XieEncodeUncompressedTripleParam @ 177 + _XieEncodeG31DParam @ 178 + _XieEncodeTIFFPackBitsParam @ 179 + _XieEncodeServerChoiceParam @ 180 + _XieEncodeG32DParam @ 181 + _XieEncodeG42DParam @ 182 + _XieEncodeJPEGBaselineParam @ 183 + _XieEncodeJPEGLosslessParam @ 184 + _XieEncodeTIFF2Param @ 185 + _XieGeomAntialiasByAreaParam @ 186 + _XieGeomAntialiasByLowpassParam @ 187 + _XieGeomGaussianParam @ 188 + _XieGeomNearestNeighborParam @ 189 + _XieHistogramGaussianParam @ 190 + _XieHistogramHyperbolicParam @ 191 + _XieWhiteAdjustCIELabShiftParam @ 192 + _XieInitTechFuncTable @ 193 + _XieRegisterTechFunc @ 194 + _XieLookupTechFunc @ 195 + _XieExtInfoHeader @ 196 + _XieElemFuncs @ 197 + _XieTechFuncsInitialized @ 198 + _XieTechFuncs @ 199 diff --git a/xc/lib/XIE/XIEos2.rsp b/xc/lib/XIE/XIEos2.rsp new file mode 100644 index 000000000..bb86a8bb5 --- /dev/null +++ b/xc/lib/XIE/XIEos2.rsp @@ -0,0 +1,5 @@ +abort.obj await.obj clientdata.obj colorlist.obj conven.obj elements.obj+ +errors.obj events.obj free.obj ieee.obj init.obj lut.obj photoflo.obj+ +photomap.obj photospace.obj roi.obj technique.obj utils.obj /NOI /NOL /NOD /BAT +XIE.dll +XIE.map diff --git a/xc/lib/XIE/abort.c b/xc/lib/XIE/abort.c new file mode 100644 index 000000000..e1e30d0a4 --- /dev/null +++ b/xc/lib/XIE/abort.c @@ -0,0 +1,54 @@ +/* $TOG: abort.c /main/3 1998/02/06 15:11:19 kaleb $ */ + +/* + +Copyright 1993, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/lib/XIE/abort.c,v 1.3 1999/06/13 16:18:07 dawes Exp $ */ + +#include "XIElibint.h" + + +void +XieAbort ( + Display *display, + unsigned long name_space, + unsigned long flo_id) +{ + xieAbortReq *req; + char *pBuf; + + LockDisplay (display); + + GET_REQUEST (Abort, pBuf); + + BEGIN_REQUEST_HEADER (Abort, pBuf, req); + + STORE_REQUEST_HEADER (Abort, req); + req->nameSpace = name_space; + req->floID = flo_id; + + END_REQUEST_HEADER (Abort, pBuf, req); + + UnlockDisplay (display); + SYNC_HANDLE (display); +} diff --git a/xc/lib/XIE/await.c b/xc/lib/XIE/await.c new file mode 100644 index 000000000..c451fe475 --- /dev/null +++ b/xc/lib/XIE/await.c @@ -0,0 +1,54 @@ +/* $TOG: await.c /main/3 1998/02/06 15:11:25 kaleb $ */ + +/* + +Copyright 1993, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/lib/XIE/await.c,v 1.3 1999/06/13 16:18:07 dawes Exp $ */ + +#include "XIElibint.h" + + +void +XieAwait ( + Display *display, + unsigned long name_space, + unsigned long flo_id) +{ + xieAwaitReq *req; + char *pBuf; + + LockDisplay (display); + + GET_REQUEST (Await, pBuf); + + BEGIN_REQUEST_HEADER (Await, pBuf, req); + + STORE_REQUEST_HEADER (Await, req); + req->nameSpace = name_space; + req->floID = flo_id; + + END_REQUEST_HEADER (Await, pBuf, req); + + UnlockDisplay (display); + SYNC_HANDLE (display); +} diff --git a/xc/lib/XIE/clientdata.c b/xc/lib/XIE/clientdata.c new file mode 100644 index 000000000..2505c45f5 --- /dev/null +++ b/xc/lib/XIE/clientdata.c @@ -0,0 +1,128 @@ +/* $TOG: clientdata.c /main/5 1998/02/06 15:11:30 kaleb $ */ + +/* + +Copyright 1993, 1994, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/lib/XIE/clientdata.c,v 1.3 1999/06/13 16:18:07 dawes Exp $ */ + +#include "XIElibint.h" + +#include <stdio.h> + + +void +XiePutClientData ( + Display *display, + unsigned long name_space, + unsigned long flo_id, + XiePhototag element, + Bool final, + unsigned band_number, + unsigned char *data, + unsigned nbytes) +{ + xiePutClientDataReq *req; + char *pBuf; + + LockDisplay (display); + + GET_REQUEST (PutClientData, pBuf); + + BEGIN_REQUEST_HEADER (PutClientData, pBuf, req); + + STORE_REQUEST_EXTRA_HEADER (PutClientData, nbytes, req); + req->nameSpace = name_space; + req->floID = flo_id; + req->element = element; + req->final = final; + req->bandNumber = band_number; + req->byteCount = nbytes; + + END_REQUEST_HEADER (PutClientData, pBuf, req); + + Data (display, (char *) data, nbytes); + + UnlockDisplay (display); + SYNC_HANDLE (display); +} + + +Status +XieGetClientData ( + Display *display, + unsigned long name_space, + unsigned long flo_id, + XiePhototag element, + unsigned max_bytes, + Bool terminate, + unsigned band_number, + XieExportState *new_state_ret, + unsigned char **data_ret, + unsigned *nbytes_ret) +{ + xieGetClientDataReq *req; + xieGetClientDataReply rep; + char *pBuf; + + LockDisplay (display); + + GET_REQUEST (GetClientData, pBuf); + + BEGIN_REQUEST_HEADER (GetClientData, pBuf, req); + + STORE_REQUEST_HEADER (GetClientData, req); + req->nameSpace = name_space; + req->floID = flo_id; + req->maxBytes = max_bytes; + req->element = element; + req->terminate = terminate; + req->bandNumber = band_number; + + END_REQUEST_HEADER (GetClientData, pBuf, req); + + if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0) + /* V4.13 moved the data length word into the reply */ + { + UnlockDisplay (display); + SYNC_HANDLE (display); + + *nbytes_ret = 0; + *data_ret = NULL; + + return (0); + } + + + *new_state_ret = rep.newState; + *nbytes_ret = rep.byteCount; + + *data_ret = (unsigned char *) Xmalloc (PADDED_BYTES (rep.byteCount)); + + _XReadPad (display, (char *) *data_ret, rep.byteCount); + + + UnlockDisplay (display); + SYNC_HANDLE (display); + + return (1); +} diff --git a/xc/lib/XIE/colorlist.c b/xc/lib/XIE/colorlist.c new file mode 100644 index 000000000..4381f6869 --- /dev/null +++ b/xc/lib/XIE/colorlist.c @@ -0,0 +1,154 @@ +/* $TOG: colorlist.c /main/7 1998/02/06 15:11:36 kaleb $ */ + +/* + +Copyright 1993, 1994, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/lib/XIE/colorlist.c,v 1.3 1999/06/13 16:18:08 dawes Exp $ */ + +#include "XIElibint.h" + + +XieColorList +XieCreateColorList (Display *display) +{ + xieCreateColorListReq *req; + char *pBuf; + XieColorList id; + + LockDisplay (display); + + id = XAllocID (display); + + GET_REQUEST (CreateColorList, pBuf); + + BEGIN_REQUEST_HEADER (CreateColorList, pBuf, req); + + STORE_REQUEST_HEADER (CreateColorList, req); + req->colorList = id; + + END_REQUEST_HEADER (CreateColorList, pBuf, req); + + UnlockDisplay (display); + SYNC_HANDLE (display); + + return (id); +} + + +void +XieDestroyColorList (Display *display, XieColorList color_list) +{ + xieDestroyColorListReq *req; + char *pBuf; + + LockDisplay (display); + + GET_REQUEST (DestroyColorList, pBuf); + + BEGIN_REQUEST_HEADER (DestroyColorList, pBuf, req); + + STORE_REQUEST_HEADER (DestroyColorList, req); + req->colorList = color_list; + + END_REQUEST_HEADER (DestroyColorList, pBuf, req); + + UnlockDisplay (display); + SYNC_HANDLE (display); +} + + +void +XiePurgeColorList (Display *display, XieColorList color_list) +{ + xiePurgeColorListReq *req; + char *pBuf; + + LockDisplay (display); + + GET_REQUEST (PurgeColorList, pBuf); + + BEGIN_REQUEST_HEADER (PurgeColorList, pBuf, req); + + STORE_REQUEST_HEADER (PurgeColorList, req); + req->colorList = color_list; + + END_REQUEST_HEADER (PurgeColorList, pBuf, req); + + UnlockDisplay (display); + SYNC_HANDLE (display); +} + + +Status +XieQueryColorList ( + Display *display, + XieColorList color_list, + Colormap *colormap_ret, + unsigned *ncolors_ret, + unsigned long **colors_ret) +{ + xieQueryColorListReq *req; + xieQueryColorListReply rep; + char *pBuf; + + LockDisplay (display); + + GET_REQUEST (QueryColorList, pBuf); + + BEGIN_REQUEST_HEADER (QueryColorList, pBuf, req); + + STORE_REQUEST_HEADER (QueryColorList, req); + req->colorList = color_list; + + END_REQUEST_HEADER (QueryColorList, pBuf, req); + + if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0) + { + UnlockDisplay (display); + SYNC_HANDLE (display); + + *colormap_ret = 0; + *ncolors_ret = 0; + *colors_ret = NULL; + + return (0); + } + + *colormap_ret = rep.colormap; + *ncolors_ret = rep.length; + + if (*ncolors_ret) + { + *colors_ret = (unsigned long *) Xmalloc ( + rep.length * sizeof (unsigned long)); + + _XRead32 (display, *colors_ret, rep.length << 2); + } + else + *colors_ret = NULL; + + UnlockDisplay (display); + SYNC_HANDLE (display); + + return (1); +} diff --git a/xc/lib/XIE/conven.c b/xc/lib/XIE/conven.c new file mode 100644 index 000000000..4f1886aa9 --- /dev/null +++ b/xc/lib/XIE/conven.c @@ -0,0 +1,1447 @@ +/* $TOG: conven.c /main/10 1998/02/06 15:11:41 kaleb $ */ + +/* + +Copyright 1993, 1994, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/lib/XIE/conven.c,v 1.3 1999/06/13 16:18:08 dawes Exp $ */ + +#include "XIElibint.h" + +/* + * Element Convenience Functions + */ + +void +XieFloImportClientLUT ( + XiePhotoElement *element, + XieDataClass data_class, + XieOrientation band_order, + XieLTriplet length, + XieLevels levels) +{ + element->elemType = xieElemImportClientLUT; + element->data.ImportClientLUT.data_class = data_class; + element->data.ImportClientLUT.band_order = band_order; + element->data.ImportClientLUT.length[0] = length[0]; + element->data.ImportClientLUT.length[1] = length[1]; + element->data.ImportClientLUT.length[2] = length[2]; + element->data.ImportClientLUT.levels[0] = levels[0]; + element->data.ImportClientLUT.levels[1] = levels[1]; + element->data.ImportClientLUT.levels[2] = levels[2]; +} + + +void +XieFloImportClientPhoto ( + XiePhotoElement *element, + XieDataClass data_class, + XieLTriplet width, + XieLTriplet height, + XieLevels levels, + Bool notify, + XieDecodeTechnique decode_tech, + XiePointer decode_param) +{ + element->elemType = xieElemImportClientPhoto; + element->data.ImportClientPhoto.data_class = data_class; + element->data.ImportClientPhoto.width[0] = width[0]; + element->data.ImportClientPhoto.width[1] = width[1]; + element->data.ImportClientPhoto.width[2] = width[2]; + element->data.ImportClientPhoto.height[0] = height[0]; + element->data.ImportClientPhoto.height[1] = height[1]; + element->data.ImportClientPhoto.height[2] = height[2]; + element->data.ImportClientPhoto.levels[0] = levels[0]; + element->data.ImportClientPhoto.levels[1] = levels[1]; + element->data.ImportClientPhoto.levels[2] = levels[2]; + element->data.ImportClientPhoto.notify = notify; + element->data.ImportClientPhoto.decode_tech = decode_tech; + element->data.ImportClientPhoto.decode_param = decode_param; +} + + +void +XieFloImportClientROI (XiePhotoElement *element, unsigned int rectangles) +{ + element->elemType = xieElemImportClientROI; + element->data.ImportClientROI.rectangles = rectangles; +} + + +void +XieFloImportDrawable ( + XiePhotoElement *element, + Drawable drawable, + int src_x, + int src_y, + unsigned int width, + unsigned int height, + unsigned long fill, + Bool notify) +{ + element->elemType = xieElemImportDrawable; + element->data.ImportDrawable.drawable = drawable; + element->data.ImportDrawable.src_x = src_x; + element->data.ImportDrawable.src_y = src_y; + element->data.ImportDrawable.width = width; + element->data.ImportDrawable.height = height; + element->data.ImportDrawable.fill = fill; + element->data.ImportDrawable.notify = notify; +} + + +void +XieFloImportDrawablePlane ( + XiePhotoElement *element, + Drawable drawable, + int src_x, + int src_y, + unsigned int width, + unsigned int height, + unsigned long fill, + unsigned long bit_plane, + Bool notify) +{ + element->elemType = xieElemImportDrawablePlane; + element->data.ImportDrawablePlane.drawable = drawable; + element->data.ImportDrawablePlane.src_x = src_x; + element->data.ImportDrawablePlane.src_y = src_y; + element->data.ImportDrawablePlane.width = width; + element->data.ImportDrawablePlane.height = height; + element->data.ImportDrawablePlane.fill = fill; + element->data.ImportDrawablePlane.bit_plane = bit_plane; + element->data.ImportDrawablePlane.notify = notify; +} + + +void +XieFloImportLUT (XiePhotoElement *element, XieLut lut) +{ + element->elemType = xieElemImportLUT; + element->data.ImportLUT.lut = lut; +} + + +void +XieFloImportPhotomap ( + XiePhotoElement *element, + XiePhotomap photomap, + Bool notify) +{ + element->elemType = xieElemImportPhotomap; + element->data.ImportPhotomap.photomap = photomap; + element->data.ImportPhotomap.notify = notify; +} + + +void +XieFloImportROI ( XiePhotoElement *element, XieRoi roi) +{ + element->elemType = xieElemImportROI; + element->data.ImportROI.roi = roi; +} + + +void +XieFloArithmetic ( + XiePhotoElement *element, + XiePhototag src1, + XiePhototag src2, + XieProcessDomain *domain, + XieConstant constant, + XieArithmeticOp operator, + unsigned int band_mask) +{ + element->elemType = xieElemArithmetic; + element->data.Arithmetic.src1 = src1; + element->data.Arithmetic.src2 = src2; + element->data.Arithmetic.domain.offset_x = domain->offset_x; + element->data.Arithmetic.domain.offset_y = domain->offset_y; + element->data.Arithmetic.domain.phototag = domain->phototag; + element->data.Arithmetic.constant[0] = constant[0]; + element->data.Arithmetic.constant[1] = constant[1]; + element->data.Arithmetic.constant[2] = constant[2]; + element->data.Arithmetic.operator = operator; + element->data.Arithmetic.band_mask = band_mask; +} + + +void +XieFloBandCombine ( + XiePhotoElement *element, + XiePhototag src1, + XiePhototag src2, + XiePhototag src3) +{ + element->elemType = xieElemBandCombine; + element->data.BandCombine.src1 = src1; + element->data.BandCombine.src2 = src2; + element->data.BandCombine.src3 = src3; +} + + +void +XieFloBandExtract ( + XiePhotoElement *element, + XiePhototag src, + unsigned int levels, + double bias, + XieConstant coefficients) +{ + element->elemType = xieElemBandExtract; + element->data.BandExtract.src = src; + element->data.BandExtract.levels = levels; + element->data.BandExtract.bias = bias; + element->data.BandExtract.coefficients[0] = coefficients[0]; + element->data.BandExtract.coefficients[1] = coefficients[1]; + element->data.BandExtract.coefficients[2] = coefficients[2]; +} + + +void +XieFloBandSelect ( + XiePhotoElement *element, + XiePhototag src, + unsigned int band_number) +{ + element->elemType = xieElemBandSelect; + element->data.BandSelect.src = src; + element->data.BandSelect.band_number = band_number; +} + + +void +XieFloBlend ( + XiePhotoElement *element, + XiePhototag src1, + XiePhototag src2, + XieConstant src_constant, + XiePhototag alpha, + double alpha_constant, + XieProcessDomain *domain, + unsigned int band_mask) +{ + element->elemType = xieElemBlend; + element->data.Blend.src1 = src1; + element->data.Blend.src2 = src2; + element->data.Blend.src_constant[0] = src_constant[0]; + element->data.Blend.src_constant[1] = src_constant[1]; + element->data.Blend.src_constant[2] = src_constant[2]; + element->data.Blend.alpha = alpha; + element->data.Blend.alpha_constant = alpha_constant; + element->data.Blend.domain.offset_x = domain->offset_x; + element->data.Blend.domain.offset_y = domain->offset_y; + element->data.Blend.domain.phototag = domain->phototag; + element->data.Blend.band_mask = band_mask; +} + + +void +XieFloCompare ( + XiePhotoElement *element, + XiePhototag src1, + XiePhototag src2, + XieProcessDomain *domain, + XieConstant constant, + XieCompareOp operator, + Bool combine, + unsigned int band_mask) +{ + element->elemType = xieElemCompare; + element->data.Compare.src1 = src1; + element->data.Compare.src2 = src2; + element->data.Compare.domain.offset_x = domain->offset_x; + element->data.Compare.domain.offset_y = domain->offset_y; + element->data.Compare.domain.phototag = domain->phototag; + element->data.Compare.constant[0] = constant[0]; + element->data.Compare.constant[1] = constant[1]; + element->data.Compare.constant[2] = constant[2]; + element->data.Compare.operator = operator; + element->data.Compare.combine = combine; + element->data.Compare.band_mask = band_mask; +} + + +void +XieFloConstrain ( + XiePhotoElement *element, + XiePhototag src, + XieLevels levels, + XieConstrainTechnique constrain_tech, + XiePointer constrain_param) +{ + element->elemType = xieElemConstrain; + element->data.Constrain.src = src; + element->data.Constrain.levels[0] = levels[0]; + element->data.Constrain.levels[1] = levels[1]; + element->data.Constrain.levels[2] = levels[2]; + element->data.Constrain.constrain_tech = constrain_tech; + element->data.Constrain.constrain_param = constrain_param; +} + + +void +XieFloConvertFromIndex ( + XiePhotoElement *element, + XiePhototag src, + Colormap colormap, + XieDataClass data_class, + unsigned int precision) +{ + element->elemType = xieElemConvertFromIndex; + element->data.ConvertFromIndex.src = src; + element->data.ConvertFromIndex.colormap = colormap; + element->data.ConvertFromIndex.data_class = data_class; + element->data.ConvertFromIndex.precision = precision; +} + + +void +XieFloConvertFromRGB ( + XiePhotoElement *element, + XiePhototag src, + XieColorspace color_space, + XiePointer color_param) +{ + element->elemType = xieElemConvertFromRGB; + element->data.ConvertFromRGB.src = src; + element->data.ConvertFromRGB.color_space = color_space; + element->data.ConvertFromRGB.color_param = color_param; +} + + +void +XieFloConvertToIndex ( + XiePhotoElement *element, + XiePhototag src, + Colormap colormap, + XieColorList color_list, + Bool notify, + XieColorAllocTechnique color_alloc_tech, + XiePointer color_alloc_param) +{ + element->elemType = xieElemConvertToIndex; + element->data.ConvertToIndex.src = src; + element->data.ConvertToIndex.colormap = colormap; + element->data.ConvertToIndex.color_list = color_list; + element->data.ConvertToIndex.notify = notify; + element->data.ConvertToIndex.color_alloc_tech = color_alloc_tech; + element->data.ConvertToIndex.color_alloc_param = color_alloc_param; +} + + +void +XieFloConvertToRGB ( + XiePhotoElement *element, + XiePhototag src, + XieColorspace color_space, + XiePointer color_param) +{ + element->elemType = xieElemConvertToRGB; + element->data.ConvertToRGB.src = src; + element->data.ConvertToRGB.color_space = color_space; + element->data.ConvertToRGB.color_param = color_param; +} + + +void +XieFloConvolve ( + XiePhotoElement *element, + XiePhototag src, + XieProcessDomain *domain, + float *kernel, + int kernel_size, + unsigned int band_mask, + XieConvolveTechnique convolve_tech, + XiePointer convolve_param) +{ + unsigned size; + + element->elemType = xieElemConvolve; + element->data.Convolve.src = src; + element->data.Convolve.domain.offset_x = domain->offset_x; + element->data.Convolve.domain.offset_y = domain->offset_y; + element->data.Convolve.domain.phototag = domain->phototag; + element->data.Convolve.kernel_size = kernel_size; + element->data.Convolve.band_mask = band_mask; + element->data.Convolve.convolve_tech = convolve_tech; + element->data.Convolve.convolve_param = convolve_param; + + size = kernel_size * kernel_size * 4; + element->data.Convolve.kernel = (float *) Xmalloc (size); + memcpy (element->data.Convolve.kernel, kernel, size); +} + + +void +XieFloDither ( + XiePhotoElement *element, + XiePhototag src, + unsigned int band_mask, + XieLevels levels, + XieDitherTechnique dither_tech, + XiePointer dither_param) +{ + element->elemType = xieElemDither; + element->data.Dither.src = src; + element->data.Dither.band_mask = band_mask; + element->data.Dither.levels[0] = levels[0]; + element->data.Dither.levels[1] = levels[1]; + element->data.Dither.levels[2] = levels[2]; + element->data.Dither.dither_tech = dither_tech; + element->data.Dither.dither_param = dither_param; +} + + +void +XieFloGeometry ( + XiePhotoElement *element, + XiePhototag src, + unsigned int width, + unsigned int height, + float coefficients[6], + XieConstant constant, + unsigned int band_mask, + XieGeometryTechnique sample_tech, + XiePointer sample_param) +{ + element->elemType = xieElemGeometry; + element->data.Geometry.src = src; + element->data.Geometry.width = width; + element->data.Geometry.height = height; + element->data.Geometry.coefficients[0] = coefficients[0]; + element->data.Geometry.coefficients[1] = coefficients[1]; + element->data.Geometry.coefficients[2] = coefficients[2]; + element->data.Geometry.coefficients[3] = coefficients[3]; + element->data.Geometry.coefficients[4] = coefficients[4]; + element->data.Geometry.coefficients[5] = coefficients[5]; + element->data.Geometry.constant[0] = constant[0]; + element->data.Geometry.constant[1] = constant[1]; + element->data.Geometry.constant[2] = constant[2]; + element->data.Geometry.band_mask = band_mask; + element->data.Geometry.sample_tech = sample_tech; + element->data.Geometry.sample_param = sample_param; +} + + +void +XieFloLogical ( + XiePhotoElement *element, + XiePhototag src1, + XiePhototag src2, + XieProcessDomain *domain, + XieConstant constant, + unsigned long operator, + unsigned int band_mask) +{ + element->elemType = xieElemLogical; + element->data.Logical.src1 = src1; + element->data.Logical.src2 = src2; + element->data.Logical.domain.offset_x = domain->offset_x; + element->data.Logical.domain.offset_y = domain->offset_y; + element->data.Logical.domain.phototag = domain->phototag; + element->data.Logical.constant[0] = constant[0]; + element->data.Logical.constant[1] = constant[1]; + element->data.Logical.constant[2] = constant[2]; + element->data.Logical.operator = operator; + element->data.Logical.band_mask = band_mask; +} + + +void +XieFloMatchHistogram ( + XiePhotoElement *element, + XiePhototag src, + XieProcessDomain *domain, + XieHistogramShape shape, + XiePointer shape_param) +{ + element->elemType = xieElemMatchHistogram; + element->data.MatchHistogram.src = src; + element->data.MatchHistogram.domain.offset_x = domain->offset_x; + element->data.MatchHistogram.domain.offset_y = domain->offset_y; + element->data.MatchHistogram.domain.phototag = domain->phototag; + element->data.MatchHistogram.shape = shape; + element->data.MatchHistogram.shape_param = shape_param; +} + + +void +XieFloMath ( + XiePhotoElement *element, + XiePhototag src, + XieProcessDomain *domain, + XieMathOp operator, + unsigned int band_mask) +{ + element->elemType = xieElemMath; + element->data.Math.src = src; + element->data.Math.domain.offset_x = domain->offset_x; + element->data.Math.domain.offset_y = domain->offset_y; + element->data.Math.domain.phototag = domain->phototag; + element->data.Math.operator = operator; + element->data.Math.band_mask = band_mask; +} + + +void +XieFloPasteUp ( + XiePhotoElement *element, + unsigned int width, + unsigned int height, + XieConstant constant, + XieTile *tiles, + unsigned int tile_count) +{ + unsigned size; + + element->elemType = xieElemPasteUp; + element->data.PasteUp.width = width; + element->data.PasteUp.height = height; + element->data.PasteUp.constant[0] = constant[0]; + element->data.PasteUp.constant[1] = constant[1]; + element->data.PasteUp.constant[2] = constant[2]; + element->data.PasteUp.tile_count = tile_count; + + size = tile_count * sizeof (XieTile); + element->data.PasteUp.tiles = (XieTile *) Xmalloc (size); + memcpy (element->data.PasteUp.tiles, tiles, size); +} + + +void +XieFloPoint ( + XiePhotoElement *element, + XiePhototag src, + XieProcessDomain *domain, + XiePhototag lut, + unsigned int band_mask) +{ + element->elemType = xieElemPoint; + element->data.Point.src = src; + element->data.Point.domain.offset_x = domain->offset_x; + element->data.Point.domain.offset_y = domain->offset_y; + element->data.Point.domain.phototag = domain->phototag; + element->data.Point.lut = lut; + element->data.Point.band_mask = band_mask; +} + +void +XieFloUnconstrain ( + XiePhotoElement *element, + XiePhototag src) +{ + element->elemType = xieElemUnconstrain; + element->data.Constrain.src = src; +} + +void +XieFloExportClientHistogram ( + XiePhotoElement *element, + XiePhototag src, + XieProcessDomain *domain, + XieExportNotify notify) +{ + element->elemType = xieElemExportClientHistogram; + element->data.ExportClientHistogram.src = src; + element->data.ExportClientHistogram.domain.offset_x = domain->offset_x; + element->data.ExportClientHistogram.domain.offset_y = domain->offset_y; + element->data.ExportClientHistogram.domain.phototag = domain->phototag; + element->data.ExportClientHistogram.notify = notify; +} + + +void +XieFloExportClientLUT ( + XiePhotoElement *element, + XiePhototag src, + XieOrientation band_order, + XieExportNotify notify, + XieLTriplet start, + XieLTriplet length) +{ + int i; + + element->elemType = xieElemExportClientLUT; + element->data.ExportClientLUT.src = src; + element->data.ExportClientLUT.band_order = band_order; + element->data.ExportClientLUT.notify = notify; + + for (i = 0; i < 3; i++) + { + element->data.ExportClientLUT.start[i] = start[i]; + element->data.ExportClientLUT.length[i] = length[i]; + } + +} + + +void +XieFloExportClientPhoto ( + XiePhotoElement *element, + XiePhototag src, + XieExportNotify notify, + XieEncodeTechnique encode_tech, + XiePointer encode_param) +{ + element->elemType = xieElemExportClientPhoto; + element->data.ExportClientPhoto.src = src; + element->data.ExportClientPhoto.notify = notify; + element->data.ExportClientPhoto.encode_tech = encode_tech; + element->data.ExportClientPhoto.encode_param = encode_param; +} + + +void +XieFloExportClientROI ( + XiePhotoElement *element, + XiePhototag src, + XieExportNotify notify) +{ + element->elemType = xieElemExportClientROI; + element->data.ExportClientROI.src = src; + element->data.ExportClientROI.notify = notify; +} + + +void +XieFloExportDrawable ( + XiePhotoElement *element, + XiePhototag src, + Drawable drawable, + GC gc, + int dst_x, + int dst_y) +{ + element->elemType = xieElemExportDrawable; + element->data.ExportDrawable.src = src; + element->data.ExportDrawable.drawable = drawable; + element->data.ExportDrawable.gc = gc; + element->data.ExportDrawable.dst_x = dst_x; + element->data.ExportDrawable.dst_y = dst_y; +} + + +void +XieFloExportDrawablePlane ( + XiePhotoElement *element, + XiePhototag src, + Drawable drawable, + GC gc, + int dst_x, + int dst_y) +{ + element->elemType = xieElemExportDrawablePlane; + element->data.ExportDrawablePlane.src = src; + element->data.ExportDrawablePlane.drawable = drawable; + element->data.ExportDrawablePlane.gc = gc; + element->data.ExportDrawablePlane.dst_x = dst_x; + element->data.ExportDrawablePlane.dst_y = dst_y; +} + + +void +XieFloExportLUT ( + XiePhotoElement *element, + XiePhototag src, + XieLut lut, + Bool merge, + XieLTriplet start) +{ + int i; + + for (i = 0; i < 3; i++) + element->data.ExportLUT.start[i] = start[i]; + + element->elemType = xieElemExportLUT; + element->data.ExportLUT.merge = merge; + element->data.ExportLUT.src = src; + element->data.ExportLUT.lut = lut; +} + + +void +XieFloExportPhotomap ( + XiePhotoElement *element, + XiePhototag src, + XiePhotomap photomap, + XieEncodeTechnique encode_tech, + XiePointer encode_param) +{ + element->elemType = xieElemExportPhotomap; + element->data.ExportPhotomap.src = src; + element->data.ExportPhotomap.photomap = photomap; + element->data.ExportPhotomap.encode_tech = encode_tech; + element->data.ExportPhotomap.encode_param = encode_param; +} + + +void +XieFloExportROI ( + XiePhotoElement *element, + XiePhototag src, + XieRoi roi) +{ + element->elemType = xieElemExportROI; + element->data.ExportROI.src = src; + element->data.ExportROI.roi = roi; +} + + + +/* + * Technique Convenience Functions + */ + +XieColorAllocAllParam * +XieTecColorAllocAll (unsigned long fill) +{ + XieColorAllocAllParam *param = (XieColorAllocAllParam *) + Xmalloc (sizeof (XieColorAllocAllParam)); + + param->fill = fill; + + return (param); +} + + +XieColorAllocMatchParam * +XieTecColorAllocMatch ( double match_limit, double gray_limit) +{ + XieColorAllocMatchParam *param = (XieColorAllocMatchParam *) + Xmalloc (sizeof (XieColorAllocMatchParam)); + + param->match_limit = match_limit; + param->gray_limit = gray_limit; + + return (param); +} + + +XieColorAllocRequantizeParam * +XieTecColorAllocRequantize (unsigned long max_cells) +{ + XieColorAllocRequantizeParam *param = (XieColorAllocRequantizeParam *) + Xmalloc (sizeof (XieColorAllocRequantizeParam)); + + param->max_cells = max_cells; + + return (param); +} + + +XieRGBToCIELabParam * +XieTecRGBToCIELab ( + XieMatrix matrix, + XieWhiteAdjustTechnique white_adjust_tech, + XiePointer white_adjust_param) +{ + XieRGBToCIELabParam *param = (XieRGBToCIELabParam *) + Xmalloc (sizeof (XieRGBToCIELabParam)); + + memcpy (param->matrix, matrix, sizeof (XieMatrix)); + param->white_adjust_tech = white_adjust_tech; + param->white_adjust_param = white_adjust_param; + + return (param); +} + + +XieRGBToCIEXYZParam * +XieTecRGBToCIEXYZ ( + XieMatrix matrix, + XieWhiteAdjustTechnique white_adjust_tech, + XiePointer white_adjust_param) +{ + XieRGBToCIEXYZParam *param = (XieRGBToCIEXYZParam *) + Xmalloc (sizeof (XieRGBToCIEXYZParam)); + + memcpy (param->matrix, matrix, sizeof (XieMatrix)); + param->white_adjust_tech = white_adjust_tech; + param->white_adjust_param = white_adjust_param; + + return (param); +} + + +XieRGBToYCbCrParam * +XieTecRGBToYCbCr ( + XieLevels levels, + double luma_red, + double luma_green, + double luma_blue, + XieConstant bias) +{ + XieRGBToYCbCrParam *param = (XieRGBToYCbCrParam *) + Xmalloc (sizeof (XieRGBToYCbCrParam)); + + param->levels[0] = levels[0]; + param->levels[1] = levels[1]; + param->levels[2] = levels[2]; + param->luma_red = luma_red; + param->luma_green = luma_green; + param->luma_blue = luma_blue; + param->bias[0] = bias[0]; + param->bias[1] = bias[1]; + param->bias[2] = bias[2]; + + return (param); +} + + +XieRGBToYCCParam * +XieTecRGBToYCC ( + XieLevels levels, + double luma_red, + double luma_green, + double luma_blue, + double scale) +{ + XieRGBToYCCParam *param = (XieRGBToYCCParam *) + Xmalloc (sizeof (XieRGBToYCCParam)); + + param->levels[0] = levels[0]; + param->levels[1] = levels[1]; + param->levels[2] = levels[2]; + param->luma_red = luma_red; + param->luma_green = luma_green; + param->luma_blue = luma_blue; + param->scale = scale; + + return (param); +} + + +XieCIELabToRGBParam * +XieTecCIELabToRGB ( + XieMatrix matrix, + XieWhiteAdjustTechnique white_adjust_tech, + XiePointer white_adjust_param, + XieGamutTechnique gamut_tech, + XiePointer gamut_param) +{ + XieCIELabToRGBParam *param = (XieCIELabToRGBParam *) + Xmalloc (sizeof (XieCIELabToRGBParam)); + + memcpy (param->matrix, matrix, sizeof (XieMatrix)); + param->white_adjust_tech = white_adjust_tech; + param->white_adjust_param = white_adjust_param; + param->gamut_tech = gamut_tech; + param->gamut_param = gamut_param; + + return (param); +} + + +XieCIEXYZToRGBParam * +XieTecCIEXYZToRGB ( + XieMatrix matrix, + XieWhiteAdjustTechnique white_adjust_tech, + XiePointer white_adjust_param, + XieGamutTechnique gamut_tech, + XiePointer gamut_param) +{ + XieCIEXYZToRGBParam *param = (XieCIEXYZToRGBParam *) + Xmalloc (sizeof (XieCIEXYZToRGBParam)); + + memcpy (param->matrix, matrix, sizeof (XieMatrix)); + param->white_adjust_tech = white_adjust_tech; + param->white_adjust_param = white_adjust_param; + param->gamut_tech = gamut_tech; + param->gamut_param = gamut_param; + + return (param); +} + + +XieYCbCrToRGBParam * +XieTecYCbCrToRGB ( + XieLevels levels, + double luma_red, + double luma_green, + double luma_blue, + XieConstant bias, + XieGamutTechnique gamut_tech, + XiePointer gamut_param) +{ + XieYCbCrToRGBParam *param = (XieYCbCrToRGBParam *) + Xmalloc (sizeof (XieYCbCrToRGBParam)); + + param->levels[0] = levels[0]; + param->levels[1] = levels[1]; + param->levels[2] = levels[2]; + param->luma_red = luma_red; + param->luma_green = luma_green; + param->luma_blue = luma_blue; + param->bias[0] = bias[0]; + param->bias[1] = bias[1]; + param->bias[2] = bias[2]; + param->gamut_tech = gamut_tech; + param->gamut_param = gamut_param; + + return (param); +} + + +XieYCCToRGBParam * +XieTecYCCToRGB ( + XieLevels levels, + double luma_red, + double luma_green, + double luma_blue, + double scale, + XieGamutTechnique gamut_tech, + XiePointer gamut_param) +{ + XieYCCToRGBParam *param = (XieYCCToRGBParam *) + Xmalloc (sizeof (XieYCCToRGBParam)); + + param->levels[0] = levels[0]; + param->levels[1] = levels[1]; + param->levels[2] = levels[2]; + param->luma_red = luma_red; + param->luma_green = luma_green; + param->luma_blue = luma_blue; + param->scale = scale; + param->gamut_tech = gamut_tech; + param->gamut_param = gamut_param; + + return (param); +} + + +XieClipScaleParam * +XieTecClipScale ( + XieConstant in_low, + XieConstant in_high, + XieLTriplet out_low, + XieLTriplet out_high) +{ + int i; + + XieClipScaleParam *param = (XieClipScaleParam *) + Xmalloc (sizeof (XieClipScaleParam)); + + for (i = 0; i < 3; i++) + { + param->input_low[i] = in_low[i]; + param->input_high[i] = in_high[i]; + param->output_low[i] = out_low[i]; + param->output_high[i] = out_high[i]; + } + + return (param); +} + + +XieConvolveConstantParam * +XieTecConvolveConstant (XieConstant constant) +{ + XieConvolveConstantParam *param = (XieConvolveConstantParam *) + Xmalloc (sizeof (XieConvolveConstantParam)); + + param->constant[0] = constant[0]; + param->constant[1] = constant[1]; + param->constant[2] = constant[2]; + + return (param); +} + + +XieDecodeUncompressedSingleParam * +XieTecDecodeUncompressedSingle ( + XieOrientation fill_order, + XieOrientation pixel_order, + unsigned int pixel_stride, + unsigned int left_pad, + unsigned int scanline_pad) +{ + XieDecodeUncompressedSingleParam *param = + (XieDecodeUncompressedSingleParam *) Xmalloc ( + sizeof (XieDecodeUncompressedSingleParam)); + + param->fill_order = fill_order; + param->pixel_order = pixel_order; + param->pixel_stride = pixel_stride; + param->left_pad = left_pad; + param->scanline_pad = scanline_pad; + + return (param); +} + + +XieDecodeUncompressedTripleParam * +XieTecDecodeUncompressedTriple ( + XieOrientation fill_order, + XieOrientation pixel_order, + XieOrientation band_order, + XieInterleave interleave, + unsigned char pixel_stride[3], + unsigned char left_pad[3], + unsigned char scanline_pad[3]) +{ + XieDecodeUncompressedTripleParam *param = + (XieDecodeUncompressedTripleParam *) Xmalloc ( + sizeof (XieDecodeUncompressedTripleParam)); + + param->left_pad[0] = left_pad[0]; + param->left_pad[1] = left_pad[1]; + param->left_pad[2] = left_pad[2]; + param->fill_order = fill_order; + param->pixel_stride[0] = pixel_stride[0]; + param->pixel_stride[1] = pixel_stride[1]; + param->pixel_stride[2] = pixel_stride[2]; + param->pixel_order = pixel_order; + param->scanline_pad[0] = scanline_pad[0]; + param->scanline_pad[1] = scanline_pad[1]; + param->scanline_pad[2] = scanline_pad[2]; + param->band_order = band_order; + param->interleave = interleave; + + return (param); +} + + +XieDecodeG31DParam * +XieTecDecodeG31D ( + XieOrientation encoded_order, + Bool normal, + Bool radiometric) +{ + XieDecodeG31DParam *param = (XieDecodeG31DParam *) + Xmalloc (sizeof (XieDecodeG31DParam)); + + param->encoded_order = encoded_order; + param->normal = normal; + param->radiometric = radiometric; + + return (param); +} + + +XieDecodeG32DParam * +XieTecDecodeG32D ( + XieOrientation encoded_order, + Bool normal, + Bool radiometric) +{ + XieDecodeG32DParam *param = (XieDecodeG32DParam *) + Xmalloc (sizeof (XieDecodeG32DParam)); + + param->encoded_order = encoded_order; + param->normal = normal; + param->radiometric = radiometric; + + return (param); +} + + +XieDecodeG42DParam * +XieTecDecodeG42D ( + XieOrientation encoded_order, + Bool normal, + Bool radiometric) +{ + XieDecodeG42DParam *param = (XieDecodeG42DParam *) + Xmalloc (sizeof (XieDecodeG42DParam)); + + param->encoded_order = encoded_order; + param->normal = normal; + param->radiometric = radiometric; + + return (param); +} + + +XieDecodeTIFF2Param * +XieTecDecodeTIFF2 ( + XieOrientation encoded_order, + Bool normal, + Bool radiometric) +{ + XieDecodeTIFF2Param *param = (XieDecodeTIFF2Param *) + Xmalloc (sizeof (XieDecodeTIFF2Param)); + + param->encoded_order = encoded_order; + param->normal = normal; + param->radiometric = radiometric; + + return (param); +} + + +XieDecodeTIFFPackBitsParam * +XieTecDecodeTIFFPackBits ( + XieOrientation encoded_order, + Bool normal) +{ + XieDecodeTIFFPackBitsParam *param = (XieDecodeTIFFPackBitsParam *) + Xmalloc (sizeof (XieDecodeTIFFPackBitsParam)); + + param->encoded_order = encoded_order; + param->normal = normal; + + return (param); +} + + +XieDecodeJPEGBaselineParam * +XieTecDecodeJPEGBaseline ( + XieInterleave interleave, + XieOrientation band_order, + Bool up_sample) +{ + XieDecodeJPEGBaselineParam *param = (XieDecodeJPEGBaselineParam *) + Xmalloc (sizeof (XieDecodeJPEGBaselineParam)); + + param->interleave = interleave; + param->band_order = band_order; + param->up_sample = up_sample; + + return (param); +} + + +XieDecodeJPEGLosslessParam * +XieTecDecodeJPEGLossless (XieInterleave interleave, XieOrientation band_order) +{ + XieDecodeJPEGLosslessParam *param = (XieDecodeJPEGLosslessParam *) + Xmalloc (sizeof (XieDecodeJPEGLosslessParam)); + + param->interleave = interleave; + param->band_order = band_order; + + return (param); +} + + +XieDitherOrderedParam * +XieTecDitherOrderedParam (unsigned int threshold_order) +{ + XieDitherOrderedParam *param = (XieDitherOrderedParam *) + Xmalloc (sizeof (XieDitherOrderedParam)); + + param->threshold_order = threshold_order; + + return (param); +} + + +XieEncodeUncompressedSingleParam * +XieTecEncodeUncompressedSingle ( + XieOrientation fill_order, + XieOrientation pixel_order, + unsigned int pixel_stride, + unsigned int scanline_pad) +{ + XieEncodeUncompressedSingleParam *param = + (XieEncodeUncompressedSingleParam *) Xmalloc ( + sizeof (XieEncodeUncompressedSingleParam)); + + param->fill_order = fill_order; + param->pixel_order = pixel_order; + param->pixel_stride = pixel_stride; + param->scanline_pad = scanline_pad; + + return (param); +} + + +XieEncodeUncompressedTripleParam * +XieTecEncodeUncompressedTriple ( + XieOrientation fill_order, + XieOrientation pixel_order, + XieOrientation band_order, + XieInterleave interleave, + unsigned char pixel_stride[3], + unsigned char scanline_pad[3]) +{ + XieEncodeUncompressedTripleParam *param = + (XieEncodeUncompressedTripleParam *) Xmalloc ( + sizeof (XieEncodeUncompressedTripleParam)); + + param->pixel_stride[0] = pixel_stride[0]; + param->pixel_stride[1] = pixel_stride[1]; + param->pixel_stride[2] = pixel_stride[2]; + param->pixel_order = pixel_order; + param->scanline_pad[0] = scanline_pad[0]; + param->scanline_pad[1] = scanline_pad[1]; + param->scanline_pad[2] = scanline_pad[2]; + param->fill_order = fill_order; + param->band_order = band_order; + param->interleave = interleave; + + return (param); +} + + +XieEncodeG31DParam * +XieTecEncodeG31D ( + Bool align_eol, + Bool radiometric, + XieOrientation encoded_order) +{ + XieEncodeG31DParam *param = (XieEncodeG31DParam *) + Xmalloc (sizeof (XieEncodeG31DParam)); + + param->align_eol = align_eol; + param->radiometric = radiometric; + param->encoded_order = encoded_order; + + return (param); +} + + +XieEncodeG32DParam * +XieTecEncodeG32D ( + Bool uncompressed, + Bool align_eol, + Bool radiometric, + XieOrientation encoded_order, + unsigned long k_factor) +{ + XieEncodeG32DParam *param = (XieEncodeG32DParam *) + Xmalloc (sizeof (XieEncodeG32DParam)); + + param->uncompressed = uncompressed; + param->align_eol = align_eol; + param->radiometric = radiometric; + param->encoded_order = encoded_order; + param->k_factor = k_factor; + + return (param); +} + + +XieEncodeG42DParam * +XieTecEncodeG42D ( + Bool uncompressed, + Bool radiometric, + XieOrientation encoded_order) +{ + XieEncodeG42DParam *param = (XieEncodeG42DParam *) + Xmalloc (sizeof (XieEncodeG42DParam)); + + param->uncompressed = uncompressed; + param->radiometric = radiometric; + param->encoded_order = encoded_order; + + return (param); +} + + +XieEncodeJPEGBaselineParam * +XieTecEncodeJPEGBaseline ( + XieInterleave interleave, + XieOrientation band_order, + unsigned char horizontal_samples[3], + unsigned char vertical_samples[3], + char *q_table, + unsigned int q_size, + char *ac_table, + unsigned int ac_size, + char *dc_table, + unsigned int dc_size) +{ + XieEncodeJPEGBaselineParam *param = (XieEncodeJPEGBaselineParam *) + Xmalloc (sizeof (XieEncodeJPEGBaselineParam)); + + param->interleave = interleave; + param->band_order = band_order; + + param->horizontal_samples[0] = horizontal_samples[0]; + param->horizontal_samples[1] = horizontal_samples[1]; + param->horizontal_samples[2] = horizontal_samples[2]; + + param->vertical_samples[0] = vertical_samples[0]; + param->vertical_samples[1] = vertical_samples[1]; + param->vertical_samples[2] = vertical_samples[2]; + + param->q_size = q_size; + param->ac_size = ac_size; + param->dc_size = dc_size; + + param->q_table = (char *) Xmalloc (q_size); + param->ac_table = (char *) Xmalloc (ac_size); + param->dc_table = (char *) Xmalloc (dc_size); + + memcpy (param->q_table, q_table, q_size); + memcpy (param->ac_table, ac_table, ac_size); + memcpy (param->dc_table, dc_table, dc_size); + + return (param); +} + + +XieEncodeJPEGLosslessParam * +XieTecEncodeJPEGLossless ( + XieInterleave interleave, + XieOrientation band_order, + unsigned char predictor[3], + char *table, + unsigned int table_size) +{ + XieEncodeJPEGLosslessParam *param = (XieEncodeJPEGLosslessParam *) + Xmalloc (sizeof (XieEncodeJPEGLosslessParam)); + + param->interleave = interleave; + param->band_order = band_order; + param->predictor[0] = predictor[0]; + param->predictor[1] = predictor[1]; + param->predictor[2] = predictor[2]; + param->table_size = table_size; + + param->table = (char *) Xmalloc (table_size); + memcpy (param->table, table, table_size); + + return (param); +} + + +XieEncodeTIFF2Param * +XieTecEncodeTIFF2 (XieOrientation encoded_order, Bool radiometric) +{ + XieEncodeTIFF2Param *param = (XieEncodeTIFF2Param *) + Xmalloc (sizeof (XieEncodeTIFF2Param)); + + param->encoded_order = encoded_order; + param->radiometric = radiometric; + + return (param); +} + + +XieEncodeTIFFPackBitsParam * +XieTecEncodeTIFFPackBits (XieOrientation encoded_order) +{ + XieEncodeTIFFPackBitsParam *param = (XieEncodeTIFFPackBitsParam *) + Xmalloc (sizeof (XieEncodeTIFFPackBitsParam)); + + param->encoded_order = encoded_order; + + return (param); +} + +XieEncodeServerChoiceParam * +XieTecEncodeServerChoice (unsigned int preference) +{ + XieEncodeServerChoiceParam *param = (XieEncodeServerChoiceParam *) + Xmalloc (sizeof (XieEncodeServerChoiceParam)); + + param->preference = preference; + + return (param); +} + + +XieGeomAntialiasByAreaParam * +XieTecGeomAntialiasByArea (int simple) +{ + XieGeomAntialiasByAreaParam *param = (XieGeomAntialiasByAreaParam *) + Xmalloc (sizeof (XieGeomAntialiasByAreaParam)); + + param->simple = simple; + + return (param); +} + + +XieGeomAntialiasByLowpassParam * +XieTecGeomAntialiasByLowpass ( int kernel_size) +{ + XieGeomAntialiasByLowpassParam *param = (XieGeomAntialiasByLowpassParam *) + Xmalloc (sizeof (XieGeomAntialiasByLowpassParam)); + + param->kernel_size = kernel_size; + + return (param); +} + + +XieGeomGaussianParam * +XieTecGeomGaussian ( + double sigma, + double normalize, + unsigned int radius, + Bool simple) +{ + XieGeomGaussianParam *param = (XieGeomGaussianParam *) + Xmalloc (sizeof (XieGeomGaussianParam)); + + param->sigma = sigma; + param->normalize = normalize; + param->radius = radius; + param->simple = simple; + + return (param); +} + + +XieGeomNearestNeighborParam * +XieTecGeomNearestNeighbor (unsigned int modify) +{ + XieGeomNearestNeighborParam *param = (XieGeomNearestNeighborParam *) + Xmalloc (sizeof (XieGeomNearestNeighborParam)); + + param->modify = modify; + + return (param); +} + +XieHistogramGaussianParam * +XieTecHistogramGaussian (double mean, double sigma) +{ + XieHistogramGaussianParam *param = (XieHistogramGaussianParam *) + Xmalloc (sizeof (XieHistogramGaussianParam)); + + param->mean = mean; + param->sigma = sigma; + + return (param); +} + + +XieHistogramHyperbolicParam * +XieTecHistogramHyperbolic (double constant, Bool shape_factor) +{ + XieHistogramHyperbolicParam *param = (XieHistogramHyperbolicParam *) + Xmalloc (sizeof (XieHistogramHyperbolicParam)); + + param->constant = constant; + param->shape_factor = shape_factor; + + return (param); +} + + +XieWhiteAdjustCIELabShiftParam * +XieTecWhiteAdjustCIELabShift (XieConstant white_point) +{ + XieWhiteAdjustCIELabShiftParam *param = (XieWhiteAdjustCIELabShiftParam *) + Xmalloc (sizeof (XieWhiteAdjustCIELabShiftParam)); + + param->white_point[0] = white_point[0]; + param->white_point[1] = white_point[1]; + param->white_point[2] = white_point[2]; + + return (param); +} diff --git a/xc/lib/XIE/elements.c b/xc/lib/XIE/elements.c new file mode 100644 index 000000000..c1f144f85 --- /dev/null +++ b/xc/lib/XIE/elements.c @@ -0,0 +1,1191 @@ +/* $TOG: elements.c /main/6 1998/02/06 15:11:48 kaleb $ */ + +/* + +Copyright 1993, 1994, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/lib/XIE/elements.c,v 1.3 1999/06/13 16:18:08 dawes Exp $ */ + +#include "XIElibint.h" +#include "elements.h" +#include "globals.h" + +#include <stdio.h> + + +int +_XiePhotofloSize ( + XiePhotoElement *elem_list, + int elem_count) +{ + XiePhotoElement *elemSrc; + int size = 0; + int i; + + for (i = 0; i < elem_count; i++) + { + elemSrc = &elem_list[i]; + + switch (elemSrc->elemType) + { + case xieElemImportClientLUT: + size += SIZEOF (xieFloImportClientLUT); + break; + + case xieElemImportClientPhoto: + size += SIZEOF (xieFloImportClientPhoto) + + (_XieTechniqueLength (xieValDecode, + elemSrc->data.ImportClientPhoto.decode_tech, + elemSrc->data.ImportClientPhoto.decode_param) << 2); + break; + + case xieElemImportClientROI: + size += SIZEOF (xieFloImportClientROI); + break; + + case xieElemImportDrawable: + size += SIZEOF (xieFloImportDrawable); + break; + + case xieElemImportDrawablePlane: + size += SIZEOF (xieFloImportDrawablePlane); + break; + + case xieElemImportLUT: + size += SIZEOF (xieFloImportLUT); + break; + + case xieElemImportPhotomap: + size += SIZEOF (xieFloImportPhotomap); + break; + + case xieElemImportROI: + size += SIZEOF (xieFloImportROI); + break; + + case xieElemArithmetic: + size += SIZEOF (xieFloArithmetic); + break; + + case xieElemBandCombine: + size += SIZEOF (xieFloBandCombine); + break; + + case xieElemBandExtract: + size += SIZEOF (xieFloBandExtract); + break; + + case xieElemBandSelect: + size += SIZEOF (xieFloBandSelect); + break; + + case xieElemBlend: + size += SIZEOF (xieFloBlend); + break; + + case xieElemCompare: + size += SIZEOF (xieFloCompare); + break; + + case xieElemConstrain: + size += SIZEOF (xieFloConstrain) + + (_XieTechniqueLength (xieValConstrain, + elemSrc->data.Constrain.constrain_tech, + elemSrc->data.Constrain.constrain_param) << 2); + break; + + case xieElemConvertFromIndex: + size += SIZEOF (xieFloConvertFromIndex); + break; + + case xieElemConvertFromRGB: + size += SIZEOF (xieFloConvertFromRGB) + + (_XieTechniqueLength (xieValConvertFromRGB, + elemSrc->data.ConvertFromRGB.color_space, + elemSrc->data.ConvertFromRGB.color_param) << 2); + break; + + case xieElemConvertToIndex: + size += SIZEOF (xieFloConvertToIndex) + + (_XieTechniqueLength (xieValColorAlloc, + elemSrc->data.ConvertToIndex.color_alloc_tech, + elemSrc->data.ConvertToIndex.color_alloc_param) << 2); + break; + + case xieElemConvertToRGB: + size += SIZEOF (xieFloConvertToRGB) + + (_XieTechniqueLength (xieValConvertToRGB, + elemSrc->data.ConvertToRGB.color_space, + elemSrc->data.ConvertToRGB.color_param) << 2); + break; + + case xieElemConvolve: + size += SIZEOF (xieFloConvolve) + + (4 * elemSrc->data.Convolve.kernel_size * + elemSrc->data.Convolve.kernel_size) + + (_XieTechniqueLength (xieValConvolve, + elemSrc->data.Convolve.convolve_tech, + elemSrc->data.Convolve.convolve_param) << 2); + break; + + case xieElemDither: + size += SIZEOF (xieFloDither) + + (_XieTechniqueLength (xieValDither, + elemSrc->data.Dither.dither_tech, + elemSrc->data.Dither.dither_param) << 2); + break; + + case xieElemGeometry: + size += SIZEOF (xieFloGeometry) + + (_XieTechniqueLength (xieValGeometry, + elemSrc->data.Geometry.sample_tech, + elemSrc->data.Geometry.sample_param) << 2); + break; + + case xieElemLogical: + size += SIZEOF (xieFloLogical); + break; + + case xieElemMatchHistogram: + size += SIZEOF (xieFloMatchHistogram) + + (_XieTechniqueLength (xieValHistogram, + elemSrc->data.MatchHistogram.shape, + elemSrc->data.MatchHistogram.shape_param) << 2); + break; + + case xieElemMath: + size += SIZEOF (xieFloMath); + break; + + case xieElemPasteUp: + size += SIZEOF (xieFloPasteUp) + + elemSrc->data.PasteUp.tile_count * SIZEOF (xieTypTile); + break; + + case xieElemPoint: + size += SIZEOF (xieFloPoint); + break; + + case xieElemUnconstrain: + size += SIZEOF (xieFloUnconstrain); + break; + + case xieElemExportClientHistogram: + size += SIZEOF (xieFloExportClientHistogram); + break; + + case xieElemExportClientLUT: + size += SIZEOF (xieFloExportClientLUT); + break; + + case xieElemExportClientPhoto: + size += SIZEOF (xieFloExportClientPhoto) + + (_XieTechniqueLength (xieValEncode, + elemSrc->data.ExportClientPhoto.encode_tech, + elemSrc->data.ExportClientPhoto.encode_param) << 2); + break; + + case xieElemExportClientROI: + size += SIZEOF (xieFloExportClientROI); + break; + + case xieElemExportDrawable: + size += SIZEOF (xieFloExportDrawable); + break; + + case xieElemExportDrawablePlane: + size += SIZEOF (xieFloExportDrawablePlane); + break; + + case xieElemExportLUT: + size += SIZEOF (xieFloExportLUT); + break; + + case xieElemExportPhotomap: + size += SIZEOF (xieFloExportPhotomap) + + (_XieTechniqueLength (xieValEncode, + elemSrc->data.ExportPhotomap.encode_tech, + elemSrc->data.ExportPhotomap.encode_param) << 2); + break; + + case xieElemExportROI: + size += SIZEOF (xieFloExportROI); + break; + + default: + break; + } + } + + return (size); +} + + +void +_XieElemImportClientLUT ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloImportClientLUT *elemDest; + + BEGIN_ELEM_HEAD (ImportClientLUT, elemSrc, + LENOF (xieFloImportClientLUT), *bufDest, elemDest); + + elemDest->class = elemSrc->data.ImportClientLUT.data_class; + elemDest->bandOrder = elemSrc->data.ImportClientLUT.band_order; + elemDest->length0 = elemSrc->data.ImportClientLUT.length[0]; + elemDest->length1 = elemSrc->data.ImportClientLUT.length[1]; + elemDest->length2 = elemSrc->data.ImportClientLUT.length[2]; + elemDest->levels0 = elemSrc->data.ImportClientLUT.levels[0]; + elemDest->levels1 = elemSrc->data.ImportClientLUT.levels[1]; + elemDest->levels2 = elemSrc->data.ImportClientLUT.levels[2]; + + END_ELEM_HEAD (ImportClientLUT, *bufDest, elemDest); +} + + +void +_XieElemImportClientPhoto ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloImportClientPhoto *elemDest; + unsigned techLen; + + techLen = _XieTechniqueLength (xieValDecode, + elemSrc->data.ImportClientPhoto.decode_tech, + elemSrc->data.ImportClientPhoto.decode_param); + + BEGIN_ELEM_HEAD (ImportClientPhoto, elemSrc, + LENOF (xieFloImportClientPhoto) + techLen, *bufDest, elemDest); + + elemDest->notify = elemSrc->data.ImportClientPhoto.notify; + elemDest->class = elemSrc->data.ImportClientPhoto.data_class; + elemDest->width0 = elemSrc->data.ImportClientPhoto.width[0]; + elemDest->width1 = elemSrc->data.ImportClientPhoto.width[1]; + elemDest->width2 = elemSrc->data.ImportClientPhoto.width[2]; + elemDest->height0 = elemSrc->data.ImportClientPhoto.height[0]; + elemDest->height1 = elemSrc->data.ImportClientPhoto.height[1]; + elemDest->height2 = elemSrc->data.ImportClientPhoto.height[2]; + elemDest->levels0 = elemSrc->data.ImportClientPhoto.levels[0]; + elemDest->levels1 = elemSrc->data.ImportClientPhoto.levels[1]; + elemDest->levels2 = elemSrc->data.ImportClientPhoto.levels[2]; + elemDest->decodeTechnique = elemSrc->data.ImportClientPhoto.decode_tech; + elemDest->lenParams = techLen; + + END_ELEM_HEAD (ImportClientPhoto, *bufDest, elemDest); + + /* Technique dependent decode params */ + + _XieEncodeTechnique (bufDest, xieValDecode, + elemSrc->data.ImportClientPhoto.decode_tech, + elemSrc->data.ImportClientPhoto.decode_param); +} + + +void +_XieElemImportClientROI ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloImportClientROI *elemDest; + + BEGIN_ELEM_HEAD (ImportClientROI, elemSrc, + LENOF (xieFloImportClientROI), *bufDest, elemDest); + + elemDest->rectangles = elemSrc->data.ImportClientROI.rectangles; + + END_ELEM_HEAD (ImportClientROI, *bufDest, elemDest); +} + + +void +_XieElemImportDrawable ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloImportDrawable *elemDest; + + BEGIN_ELEM_HEAD (ImportDrawable, elemSrc, + LENOF (xieFloImportDrawable), *bufDest, elemDest); + + elemDest->drawable = elemSrc->data.ImportDrawable.drawable; + elemDest->srcX = elemSrc->data.ImportDrawable.src_x; + elemDest->srcY = elemSrc->data.ImportDrawable.src_y; + elemDest->width = elemSrc->data.ImportDrawable.width; + elemDest->height = elemSrc->data.ImportDrawable.height; + elemDest->fill = elemSrc->data.ImportDrawable.fill; + elemDest->notify = elemSrc->data.ImportDrawable.notify; + + END_ELEM_HEAD (ImportDrawable, *bufDest, elemDest); +} + + +void +_XieElemImportDrawablePlane ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloImportDrawablePlane *elemDest; + + BEGIN_ELEM_HEAD (ImportDrawablePlane, elemSrc, + LENOF (xieFloImportDrawablePlane), *bufDest, elemDest); + + elemDest->drawable = elemSrc->data.ImportDrawablePlane.drawable; + elemDest->srcX = elemSrc->data.ImportDrawablePlane.src_x; + elemDest->srcY = elemSrc->data.ImportDrawablePlane.src_y; + elemDest->width = elemSrc->data.ImportDrawablePlane.width; + elemDest->height = elemSrc->data.ImportDrawablePlane.height; + elemDest->fill = elemSrc->data.ImportDrawablePlane.fill; + elemDest->bitPlane = elemSrc->data.ImportDrawablePlane.bit_plane; + elemDest->notify = elemSrc->data.ImportDrawablePlane.notify; + + END_ELEM_HEAD (ImportDrawablePlane, *bufDest, elemDest); +} + + +void +_XieElemImportLUT ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloImportLUT *elemDest; + + BEGIN_ELEM_HEAD (ImportLUT, elemSrc, + LENOF (xieFloImportLUT), *bufDest, elemDest); + + elemDest->lut = elemSrc->data.ImportLUT.lut; + + END_ELEM_HEAD (ImportLUT, *bufDest, elemDest); +} + + +void +_XieElemImportPhotomap ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloImportPhotomap *elemDest; + + BEGIN_ELEM_HEAD (ImportPhotomap, elemSrc, + LENOF (xieFloImportPhotomap), *bufDest, elemDest); + + elemDest->photomap = elemSrc->data.ImportPhotomap.photomap; + elemDest->notify = elemSrc->data.ImportPhotomap.notify; + + END_ELEM_HEAD (ImportPhotomap, *bufDest, elemDest); +} + + +void +_XieElemImportROI ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloImportROI *elemDest; + + BEGIN_ELEM_HEAD (ImportROI, elemSrc, + LENOF (xieFloImportROI), *bufDest, elemDest); + + elemDest->roi = elemSrc->data.ImportROI.roi; + + END_ELEM_HEAD (ImportROI, *bufDest, elemDest); +} + + +void +_XieElemArithmetic ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloArithmetic *elemDest; + + BEGIN_ELEM_HEAD (Arithmetic, elemSrc, + LENOF (xieFloArithmetic), *bufDest, elemDest); + + elemDest->src1 = elemSrc->data.Arithmetic.src1; + elemDest->src2 = elemSrc->data.Arithmetic.src2; + elemDest->domainOffsetX = elemSrc->data.Arithmetic.domain.offset_x; + elemDest->domainOffsetY = elemSrc->data.Arithmetic.domain.offset_y; + elemDest->domainPhototag = elemSrc->data.Arithmetic.domain.phototag; + elemDest->operator = elemSrc->data.Arithmetic.operator; + elemDest->bandMask = elemSrc->data.Arithmetic.band_mask; + elemDest->constant0 = + _XieConvertToIEEE (elemSrc->data.Arithmetic.constant[0]); + elemDest->constant1 = + _XieConvertToIEEE (elemSrc->data.Arithmetic.constant[1]); + elemDest->constant2 = + _XieConvertToIEEE (elemSrc->data.Arithmetic.constant[2]); + + END_ELEM_HEAD (Arithmetic, *bufDest, elemDest); +} + + +void +_XieElemBandCombine ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloBandCombine *elemDest; + + BEGIN_ELEM_HEAD (BandCombine, elemSrc, + LENOF (xieFloBandCombine), *bufDest, elemDest); + + elemDest->src1 = elemSrc->data.BandCombine.src1; + elemDest->src2 = elemSrc->data.BandCombine.src2; + elemDest->src3 = elemSrc->data.BandCombine.src3; + + END_ELEM_HEAD (BandCombine, *bufDest, elemDest); +} + + +void +_XieElemBandExtract ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloBandExtract *elemDest; + + BEGIN_ELEM_HEAD (BandExtract, elemSrc, + LENOF (xieFloBandExtract), *bufDest, elemDest); + + elemDest->src = elemSrc->data.BandExtract.src; + elemDest->levels = elemSrc->data.BandExtract.levels; + elemDest->bias = + _XieConvertToIEEE (elemSrc->data.BandExtract.bias); + elemDest->constant0 = + _XieConvertToIEEE (elemSrc->data.BandExtract.coefficients[0]); + elemDest->constant1 = + _XieConvertToIEEE (elemSrc->data.BandExtract.coefficients[1]); + elemDest->constant2 = + _XieConvertToIEEE (elemSrc->data.BandExtract.coefficients[2]); + END_ELEM_HEAD (BandExtract, *bufDest, elemDest); +} + +void +_XieElemBandSelect ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloBandSelect *elemDest; + + BEGIN_ELEM_HEAD (BandSelect, elemSrc, + LENOF (xieFloBandSelect), *bufDest, elemDest); + + elemDest->src = elemSrc->data.BandSelect.src; + elemDest->bandNumber= elemSrc->data.BandSelect.band_number; + + END_ELEM_HEAD (BandSelect, *bufDest, elemDest); +} + + +void +_XieElemBlend ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloBlend *elemDest; + + BEGIN_ELEM_HEAD (Blend, elemSrc, + LENOF (xieFloBlend), *bufDest, elemDest); + + elemDest->src1 = elemSrc->data.Blend.src1; + elemDest->src2 = elemSrc->data.Blend.src2; + elemDest->alpha = elemSrc->data.Blend.alpha; + elemDest->constant0 = + _XieConvertToIEEE (elemSrc->data.Blend.src_constant[0]); + elemDest->constant1 = + _XieConvertToIEEE (elemSrc->data.Blend.src_constant[1]); + elemDest->constant2 = + _XieConvertToIEEE (elemSrc->data.Blend.src_constant[2]); + elemDest->alphaConst = + _XieConvertToIEEE (elemSrc->data.Blend.alpha_constant); + elemDest->domainOffsetX = elemSrc->data.Blend.domain.offset_x; + elemDest->domainOffsetY = elemSrc->data.Blend.domain.offset_y; + elemDest->domainPhototag = elemSrc->data.Blend.domain.phototag; + elemDest->bandMask = elemSrc->data.Blend.band_mask; + + END_ELEM_HEAD (Blend, *bufDest, elemDest); +} + + +void +_XieElemCompare (bufDest, elemSrc) + +char **bufDest; +XiePhotoElement *elemSrc; + +{ + xieFloCompare *elemDest; + + BEGIN_ELEM_HEAD (Compare, elemSrc, + LENOF (xieFloCompare), *bufDest, elemDest); + + elemDest->src1 = elemSrc->data.Compare.src1; + elemDest->src2 = elemSrc->data.Compare.src2; + elemDest->domainOffsetX = elemSrc->data.Compare.domain.offset_x; + elemDest->domainOffsetY = elemSrc->data.Compare.domain.offset_y; + elemDest->domainPhototag = elemSrc->data.Compare.domain.phototag; + elemDest->operator = elemSrc->data.Compare.operator; + elemDest->combine = elemSrc->data.Compare.combine; + elemDest->constant0 = + _XieConvertToIEEE (elemSrc->data.Compare.constant[0]); + elemDest->constant1 = + _XieConvertToIEEE (elemSrc->data.Compare.constant[1]); + elemDest->constant2 = + _XieConvertToIEEE (elemSrc->data.Compare.constant[2]); + elemDest->bandMask = elemSrc->data.Compare.band_mask; + + END_ELEM_HEAD (Compare, *bufDest, elemDest); +} + + +void +_XieElemConstrain ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloConstrain *elemDest; + unsigned techLen; + + techLen = _XieTechniqueLength (xieValConstrain, + elemSrc->data.Constrain.constrain_tech, + elemSrc->data.Constrain.constrain_param); + + BEGIN_ELEM_HEAD (Constrain, elemSrc, + LENOF (xieFloConstrain) + techLen, *bufDest, elemDest); + + elemDest->src = elemSrc->data.Constrain.src; + elemDest->levels0 = elemSrc->data.Constrain.levels[0]; + elemDest->levels1 = elemSrc->data.Constrain.levels[1]; + elemDest->levels2 = elemSrc->data.Constrain.levels[2]; + elemDest->constrain = elemSrc->data.Constrain.constrain_tech; + elemDest->lenParams = techLen; + + END_ELEM_HEAD (Constrain, *bufDest, elemDest); + + /* Technique dependent constrain params */ + + _XieEncodeTechnique (bufDest, xieValConstrain, + elemSrc->data.Constrain.constrain_tech, + elemSrc->data.Constrain.constrain_param); +} + + +void +_XieElemConvertFromIndex (bufDest, elemSrc) + +char **bufDest; +XiePhotoElement *elemSrc; + +{ + xieFloConvertFromIndex *elemDest; + + BEGIN_ELEM_HEAD (ConvertFromIndex, elemSrc, + LENOF (xieFloConvertFromIndex), *bufDest, elemDest); + + elemDest->src = elemSrc->data.ConvertFromIndex.src; + elemDest->class = elemSrc->data.ConvertFromIndex.data_class; + elemDest->precision = elemSrc->data.ConvertFromIndex.precision; + elemDest->colormap = elemSrc->data.ConvertFromIndex.colormap; + + END_ELEM_HEAD (ConvertFromIndex, *bufDest, elemDest); +} + + +void +_XieElemConvertFromRGB ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloConvertFromRGB *elemDest; + unsigned techLen; + + techLen = _XieTechniqueLength (xieValConvertFromRGB, + elemSrc->data.ConvertFromRGB.color_space, + elemSrc->data.ConvertFromRGB.color_param); + + BEGIN_ELEM_HEAD (ConvertFromRGB, elemSrc, + LENOF (xieFloConvertFromRGB) + techLen, *bufDest, elemDest); + + elemDest->src = elemSrc->data.ConvertFromRGB.src; + elemDest->convert = elemSrc->data.ConvertFromRGB.color_space; + elemDest->lenParams = techLen; + + END_ELEM_HEAD (ConvertFromRGB, *bufDest, elemDest); + + /* Technique dependent color params */ + + _XieEncodeTechnique (bufDest, xieValConvertFromRGB, + elemSrc->data.ConvertFromRGB.color_space, + elemSrc->data.ConvertFromRGB.color_param); +} + + +void +_XieElemConvertToIndex ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloConvertToIndex *elemDest; + unsigned techLen; + + techLen = _XieTechniqueLength (xieValColorAlloc, + elemSrc->data.ConvertToIndex.color_alloc_tech, + elemSrc->data.ConvertToIndex.color_alloc_param); + + BEGIN_ELEM_HEAD (ConvertToIndex, elemSrc, + LENOF (xieFloConvertToIndex) + techLen, *bufDest, elemDest); + + elemDest->src = elemSrc->data.ConvertToIndex.src; + elemDest->notify = elemSrc->data.ConvertToIndex.notify; + elemDest->colormap = elemSrc->data.ConvertToIndex.colormap; + elemDest->colorList = elemSrc->data.ConvertToIndex.color_list; + elemDest->colorAlloc = elemSrc->data.ConvertToIndex.color_alloc_tech; + elemDest->lenParams = techLen; + + END_ELEM_HEAD (ConvertToIndex, *bufDest, elemDest); + + /* Technique dependent color alloc params */ + + _XieEncodeTechnique (bufDest, xieValColorAlloc, + elemSrc->data.ConvertToIndex.color_alloc_tech, + elemSrc->data.ConvertToIndex.color_alloc_param); +} + + +void +_XieElemConvertToRGB ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloConvertToRGB *elemDest; + unsigned techLen; + + techLen = _XieTechniqueLength (xieValConvertToRGB, + elemSrc->data.ConvertToRGB.color_space, + elemSrc->data.ConvertToRGB.color_param); + + BEGIN_ELEM_HEAD (ConvertToRGB, elemSrc, + LENOF (xieFloConvertToRGB) + techLen, *bufDest, elemDest); + + elemDest->src = elemSrc->data.ConvertToRGB.src; + elemDest->convert = elemSrc->data.ConvertToRGB.color_space; + elemDest->lenParams = techLen; + + END_ELEM_HEAD (ConvertToRGB, *bufDest, elemDest); + + /* Technique dependent color params */ + + _XieEncodeTechnique (bufDest, xieValConvertToRGB, + elemSrc->data.ConvertToRGB.color_space, + elemSrc->data.ConvertToRGB.color_param); +} + + +void +_XieElemConvolve (bufDest, elemSrc) + +char **bufDest; +XiePhotoElement *elemSrc; + +{ + int ksize = elemSrc->data.Convolve.kernel_size; + int i, j; + xieTypFloat *fptr; + xieFloConvolve *elemDest; + unsigned techLen, kernelLen; + + techLen = _XieTechniqueLength (xieValConvolve, + elemSrc->data.Convolve.convolve_tech, + elemSrc->data.Convolve.convolve_param); + + kernelLen = elemSrc->data.Convolve.kernel_size * + elemSrc->data.Convolve.kernel_size; + + BEGIN_ELEM_HEAD (Convolve, elemSrc, + LENOF (xieFloConvolve) + kernelLen + techLen, *bufDest, elemDest); + + elemDest->src = elemSrc->data.Convolve.src; + elemDest->domainOffsetX = elemSrc->data.Convolve.domain.offset_x; + elemDest->domainOffsetY = elemSrc->data.Convolve.domain.offset_y; + elemDest->domainPhototag = elemSrc->data.Convolve.domain.phototag; + elemDest->bandMask = elemSrc->data.Convolve.band_mask; + elemDest->kernelSize = elemSrc->data.Convolve.kernel_size; + elemDest->convolve = elemSrc->data.Convolve.convolve_tech; + elemDest->lenParams = techLen; + + END_ELEM_HEAD (Convolve, *bufDest, elemDest); + + + /* LISTofFloat (kernelSize^2) */ + + fptr = (xieTypFloat *) *bufDest; + for (i = 0; i < ksize; i++) + for (j = 0; j < ksize; j++) + *fptr++ = _XieConvertToIEEE ( + elemSrc->data.Convolve.kernel[i * ksize + j]); + + *bufDest += NUMBYTES (kernelLen); + + + /* Technique dependent convolve params */ + + _XieEncodeTechnique (bufDest, xieValConvolve, + elemSrc->data.Convolve.convolve_tech, + elemSrc->data.Convolve.convolve_param); + +} + + +void +_XieElemDither ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloDither *elemDest; + unsigned techLen; + + techLen = _XieTechniqueLength (xieValDither, + elemSrc->data.Dither.dither_tech, + elemSrc->data.Dither.dither_param); + + BEGIN_ELEM_HEAD (Dither, elemSrc, + LENOF (xieFloDither) + techLen, *bufDest, elemDest); + + elemDest->src = elemSrc->data.Dither.src; + elemDest->bandMask = elemSrc->data.Dither.band_mask; + elemDest->levels0 = elemSrc->data.Dither.levels[0]; + elemDest->levels1 = elemSrc->data.Dither.levels[1]; + elemDest->levels2 = elemSrc->data.Dither.levels[2]; + elemDest->dither = elemSrc->data.Dither.dither_tech; + elemDest->lenParams = techLen; + + END_ELEM_HEAD (Dither, *bufDest, elemDest); + + /* Technique dependent dither params */ + + _XieEncodeTechnique (bufDest, xieValDither, + elemSrc->data.Dither.dither_tech, + elemSrc->data.Dither.dither_param); +} + + +void +_XieElemGeometry ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloGeometry *elemDest; + unsigned techLen; + + techLen = _XieTechniqueLength (xieValGeometry, + elemSrc->data.Geometry.sample_tech, + elemSrc->data.Geometry.sample_param); + + BEGIN_ELEM_HEAD (Geometry, elemSrc, + LENOF (xieFloGeometry) + techLen, *bufDest, elemDest); + + elemDest->src = elemSrc->data.Geometry.src; + elemDest->bandMask = elemSrc->data.Geometry.band_mask; + elemDest->width = elemSrc->data.Geometry.width; + elemDest->height = elemSrc->data.Geometry.height; + elemDest->a = _XieConvertToIEEE ( + elemSrc->data.Geometry.coefficients[0]); + elemDest->b = _XieConvertToIEEE ( + elemSrc->data.Geometry.coefficients[1]); + elemDest->c = _XieConvertToIEEE ( + elemSrc->data.Geometry.coefficients[2]); + elemDest->d = _XieConvertToIEEE ( + elemSrc->data.Geometry.coefficients[3]); + elemDest->tx = _XieConvertToIEEE ( + elemSrc->data.Geometry.coefficients[4]); + elemDest->ty = _XieConvertToIEEE ( + elemSrc->data.Geometry.coefficients[5]); + elemDest->constant0 = _XieConvertToIEEE ( + elemSrc->data.Geometry.constant[0] ); + elemDest->constant1 = _XieConvertToIEEE ( + elemSrc->data.Geometry.constant[1] ); + elemDest->constant2 = _XieConvertToIEEE ( + elemSrc->data.Geometry.constant[2] ); + elemDest->sample = elemSrc->data.Geometry.sample_tech; + elemDest->lenParams = techLen; + + END_ELEM_HEAD (Geometry, *bufDest, elemDest); + + /* Technique dependent sample params */ + + _XieEncodeTechnique (bufDest, xieValGeometry, + elemSrc->data.Geometry.sample_tech, + elemSrc->data.Geometry.sample_param); +} + + +void +_XieElemLogical ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloLogical *elemDest; + + BEGIN_ELEM_HEAD (Logical, elemSrc, + LENOF (xieFloLogical), *bufDest, elemDest); + + elemDest->src1 = elemSrc->data.Logical.src1; + elemDest->src2 = elemSrc->data.Logical.src2; + elemDest->domainOffsetX = elemSrc->data.Logical.domain.offset_x; + elemDest->domainOffsetY = elemSrc->data.Logical.domain.offset_y; + elemDest->domainPhototag = elemSrc->data.Logical.domain.phototag; + elemDest->operator = elemSrc->data.Logical.operator; + elemDest->bandMask = elemSrc->data.Logical.band_mask; + elemDest->constant0 = + _XieConvertToIEEE (elemSrc->data.Logical.constant[0]); + elemDest->constant1 = + _XieConvertToIEEE (elemSrc->data.Logical.constant[1]); + elemDest->constant2 = + _XieConvertToIEEE (elemSrc->data.Logical.constant[2]); + + END_ELEM_HEAD (Logical, *bufDest, elemDest); +} + + +void +_XieElemMatchHistogram (bufDest, elemSrc) + +char **bufDest; +XiePhotoElement *elemSrc; + +{ + xieFloMatchHistogram *elemDest; + unsigned techLen; + + techLen = _XieTechniqueLength (xieValHistogram, + elemSrc->data.MatchHistogram.shape, + elemSrc->data.MatchHistogram.shape_param); + + BEGIN_ELEM_HEAD (MatchHistogram, elemSrc, + LENOF (xieFloMatchHistogram) + techLen, *bufDest, elemDest); + + elemDest->src = elemSrc->data.MatchHistogram.src; + elemDest->domainOffsetX = elemSrc->data.MatchHistogram.domain.offset_x; + elemDest->domainOffsetY = elemSrc->data.MatchHistogram.domain.offset_y; + elemDest->domainPhototag = elemSrc->data.MatchHistogram.domain.phototag; + elemDest->shape = elemSrc->data.MatchHistogram.shape; + elemDest->lenParams = techLen; + + END_ELEM_HEAD (MatchHistogram, *bufDest, elemDest); + + /* Technique dependent shape params */ + + _XieEncodeTechnique (bufDest, xieValHistogram, + elemSrc->data.MatchHistogram.shape, + elemSrc->data.MatchHistogram.shape_param); +} + + +void +_XieElemMath ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloMath *elemDest; + + BEGIN_ELEM_HEAD (Math, elemSrc, + LENOF (xieFloMath), *bufDest, elemDest); + + elemDest->src = elemSrc->data.Math.src; + elemDest->domainOffsetX = elemSrc->data.Math.domain.offset_x; + elemDest->domainOffsetY = elemSrc->data.Math.domain.offset_y; + elemDest->domainPhototag = elemSrc->data.Math.domain.phototag; + elemDest->operator = elemSrc->data.Math.operator; + elemDest->bandMask = elemSrc->data.Math.band_mask; + + END_ELEM_HEAD (Math, *bufDest, elemDest); +} + + +void +_XieElemPasteUp ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloPasteUp *elemDest; + + BEGIN_ELEM_HEAD (PasteUp, elemSrc, + LENOF (xieFloPasteUp) + + elemSrc->data.PasteUp.tile_count * LENOF (xieTypTile), + *bufDest, elemDest); + + elemDest->numTiles = elemSrc->data.PasteUp.tile_count; + elemDest->width = elemSrc->data.PasteUp.width; + elemDest->height = elemSrc->data.PasteUp.height; + elemDest->constant0 = + _XieConvertToIEEE (elemSrc->data.PasteUp.constant[0]); + elemDest->constant1 = + _XieConvertToIEEE (elemSrc->data.PasteUp.constant[1]); + elemDest->constant2 = + _XieConvertToIEEE (elemSrc->data.PasteUp.constant[2]); + + END_ELEM_HEAD (PasteUp, *bufDest, elemDest); + + /* LISTofTile (numTiles) */ + + STORE_LISTOF_TILES (elemSrc->data.PasteUp.tiles, + elemSrc->data.PasteUp.tile_count, *bufDest); +} + + +void +_XieElemPoint ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloPoint *elemDest; + + BEGIN_ELEM_HEAD (Point, elemSrc, + LENOF (xieFloPoint), *bufDest, elemDest); + + elemDest->src = elemSrc->data.Point.src; + elemDest->lut = elemSrc->data.Point.lut; + elemDest->domainOffsetX = elemSrc->data.Point.domain.offset_x; + elemDest->domainOffsetY = elemSrc->data.Point.domain.offset_y; + elemDest->domainPhototag = elemSrc->data.Point.domain.phototag; + elemDest->bandMask = elemSrc->data.Point.band_mask; + + END_ELEM_HEAD (Point, *bufDest, elemDest); +} + +void +_XieElemUnconstrain ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloUnconstrain *elemDest; + + BEGIN_ELEM_HEAD (Unconstrain, elemSrc, + LENOF (xieFloUnconstrain), *bufDest, elemDest); + + elemDest->src = elemSrc->data.Unconstrain.src; + + END_ELEM_HEAD (Unconstrain, *bufDest, elemDest); +} + +void +_XieElemExportClientHistogram ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloExportClientHistogram *elemDest; + + BEGIN_ELEM_HEAD (ExportClientHistogram, elemSrc, + LENOF (xieFloExportClientHistogram), *bufDest, elemDest); + + elemDest->src = elemSrc->data.ExportClientHistogram.src; + elemDest->notify = elemSrc->data.ExportClientHistogram.notify; + elemDest->domainOffsetX = + elemSrc->data.ExportClientHistogram.domain.offset_x; + elemDest->domainOffsetY = + elemSrc->data.ExportClientHistogram.domain.offset_y; + elemDest->domainPhototag = + elemSrc->data.ExportClientHistogram.domain.phototag; + + END_ELEM_HEAD (ExportClientHistogram, *bufDest, elemDest); +} + + +void +_XieElemExportClientLUT ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloExportClientLUT *elemDest; + + BEGIN_ELEM_HEAD (ExportClientLUT, elemSrc, + LENOF (xieFloExportClientLUT), *bufDest, elemDest); + + elemDest->src = elemSrc->data.ExportClientLUT.src; + elemDest->notify = elemSrc->data.ExportClientLUT.notify; + elemDest->bandOrder = elemSrc->data.ExportClientLUT.band_order; + elemDest->start0 = elemSrc->data.ExportClientLUT.start[0]; + elemDest->start1 = elemSrc->data.ExportClientLUT.start[1]; + elemDest->start2 = elemSrc->data.ExportClientLUT.start[2]; + elemDest->length0 = elemSrc->data.ExportClientLUT.length[0]; + elemDest->length1 = elemSrc->data.ExportClientLUT.length[1]; + elemDest->length2 = elemSrc->data.ExportClientLUT.length[2]; + + END_ELEM_HEAD (ExportClientLUT, *bufDest, elemDest); +} + + +void +_XieElemExportClientPhoto ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloExportClientPhoto *elemDest; + unsigned techLen; + + techLen = _XieTechniqueLength (xieValEncode, + elemSrc->data.ExportClientPhoto.encode_tech, + elemSrc->data.ExportClientPhoto.encode_param); + + BEGIN_ELEM_HEAD (ExportClientPhoto, elemSrc, + LENOF (xieFloExportClientPhoto) + techLen, *bufDest, elemDest); + + elemDest->src = elemSrc->data.ExportClientPhoto.src; + elemDest->notify = elemSrc->data.ExportClientPhoto.notify; + elemDest->encodeTechnique = elemSrc->data.ExportClientPhoto.encode_tech; + elemDest->lenParams = techLen; + + END_ELEM_HEAD (ExportClientPhoto, *bufDest, elemDest); + + /* Technique dependent encode params */ + + _XieEncodeTechnique (bufDest, xieValEncode, + elemSrc->data.ExportClientPhoto.encode_tech, + elemSrc->data.ExportClientPhoto.encode_param); +} + + +void +_XieElemExportClientROI ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloExportClientROI *elemDest; + + BEGIN_ELEM_HEAD (ExportClientROI, elemSrc, + LENOF (xieFloExportClientROI), *bufDest, elemDest); + + elemDest->src = elemSrc->data.ExportClientROI.src; + elemDest->notify = elemSrc->data.ExportClientROI.notify; + + END_ELEM_HEAD (ExportClientROI, *bufDest, elemDest); +} + + +void +_XieElemExportDrawable ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloExportDrawable *elemDest; + + BEGIN_ELEM_HEAD (ExportDrawable, elemSrc, + LENOF (xieFloExportDrawable), *bufDest, elemDest); + + elemDest->src = elemSrc->data.ExportDrawable.src; + elemDest->dstX = elemSrc->data.ExportDrawable.dst_x; + elemDest->dstY = elemSrc->data.ExportDrawable.dst_y; + elemDest->drawable = elemSrc->data.ExportDrawable.drawable; + elemDest->gc = (elemSrc->data.ExportDrawable.gc)->gid; + + END_ELEM_HEAD (ExportDrawable, *bufDest, elemDest); +} + + +void +_XieElemExportDrawablePlane ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloExportDrawablePlane *elemDest; + + BEGIN_ELEM_HEAD (ExportDrawablePlane, elemSrc, + LENOF (xieFloExportDrawablePlane), *bufDest, elemDest); + + elemDest->src = elemSrc->data.ExportDrawablePlane.src; + elemDest->dstX = elemSrc->data.ExportDrawablePlane.dst_x; + elemDest->dstY = elemSrc->data.ExportDrawablePlane.dst_y; + elemDest->drawable = elemSrc->data.ExportDrawablePlane.drawable; + elemDest->gc = (elemSrc->data.ExportDrawablePlane.gc)->gid; + + END_ELEM_HEAD (ExportDrawablePlane, *bufDest, elemDest); +} + + +void +_XieElemExportLUT ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloExportLUT *elemDest; + + BEGIN_ELEM_HEAD (ExportLUT, elemSrc, + LENOF (xieFloExportLUT), *bufDest, elemDest); + + elemDest->src = elemSrc->data.ExportLUT.src; + elemDest->lut = elemSrc->data.ExportLUT.lut; + elemDest->merge = elemSrc->data.ExportLUT.merge; + elemDest->start0 = elemSrc->data.ExportLUT.start[0]; + elemDest->start1 = elemSrc->data.ExportLUT.start[1]; + elemDest->start2 = elemSrc->data.ExportLUT.start[2]; + + END_ELEM_HEAD (ExportLUT, *bufDest, elemDest); +} + + +void +_XieElemExportPhotomap ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloExportPhotomap *elemDest; + unsigned techLen; + + techLen = _XieTechniqueLength (xieValEncode, + elemSrc->data.ExportPhotomap.encode_tech, + elemSrc->data.ExportPhotomap.encode_param); + + BEGIN_ELEM_HEAD (ExportPhotomap, elemSrc, + LENOF (xieFloExportPhotomap) + techLen, *bufDest, elemDest); + + elemDest->src = elemSrc->data.ExportPhotomap.src; + elemDest->photomap = elemSrc->data.ExportPhotomap.photomap; + elemDest->encodeTechnique = elemSrc->data.ExportPhotomap.encode_tech; + elemDest->lenParams = techLen; + + END_ELEM_HEAD (ExportPhotomap, *bufDest, elemDest); + + /* Technique dependent encode params */ + + _XieEncodeTechnique (bufDest, xieValEncode, + elemSrc->data.ExportPhotomap.encode_tech, + elemSrc->data.ExportPhotomap.encode_param); +} + + +void +_XieElemExportROI ( + char **bufDest, + XiePhotoElement *elemSrc) +{ + xieFloExportROI *elemDest; + + BEGIN_ELEM_HEAD (ExportROI, elemSrc, + LENOF (xieFloExportROI), *bufDest, elemDest); + + elemDest->src = elemSrc->data.ExportROI.src; + elemDest->roi = elemSrc->data.ExportROI.roi; + + END_ELEM_HEAD (ExportROI, *bufDest, elemDest); +} diff --git a/xc/lib/XIE/elements.h b/xc/lib/XIE/elements.h new file mode 100644 index 000000000..718534525 --- /dev/null +++ b/xc/lib/XIE/elements.h @@ -0,0 +1,102 @@ +/* $TOG: elements.h /main/6 1998/02/06 15:11:55 kaleb $ */ + +/* + +Copyright 1993, 1994, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifndef _ELEMENTS_H_ +#define _ELEMENTS_H_ + +#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#define ELEM_NAME(_name_) xieFlo##_name_ +#define ELEM_SIZE(_name_) sz_xieFlo##_name_ +#else +#define ELEM_NAME(_name_) xieFlo/**/_name_ +#define ELEM_SIZE(_name_) sz_xieFlo/**/_name_ +#endif + + +#ifndef WORD64 + +#define BEGIN_ELEM_HEAD(_name, _elemSrc, _elemLength, _bufDest, _elemDest) \ + _elemDest = (ELEM_NAME(_name) *) _bufDest; \ + _elemDest->elemType = elemSrc->elemType; \ + _elemDest->elemLength = _elemLength; + +#define END_ELEM_HEAD(_name, _bufDest, _elemDest) \ + _bufDest += ELEM_SIZE(_name); + +#else /* WORD64 */ + +#define BEGIN_ELEM_HEAD(_name, _elemSrc, _elemLength, _bufDest, _elemDest) \ +{ \ + ELEM_NAME(_name) tElem; \ + _elemDest = &tElem; \ + _elemDest->elemType = elemSrc->elemType; \ + _elemDest->elemLength = _elemLength; + +#define END_ELEM_HEAD(_name, _bufDest, _elemDest) \ + memcpy (_bufDest, _elemDest, ELEM_SIZE(_name)); \ + _bufDest += ELEM_SIZE(_name); \ +} + +#endif /* WORD64 */ + + +#ifndef WORD64 + +#define STORE_LISTOF_TILES(_tiles, _count, _pBuf) \ +{ \ + xieTypTile *tileDest = (xieTypTile *) _pBuf; \ + int i; \ +\ + for (i = 0; i < _count; i++) \ + { \ + tileDest->src = _tiles[i].src; \ + tileDest->dstX = _tiles[i].dst_x; \ + tileDest->dstY = _tiles[i].dst_y; \ + tileDest++; \ + } \ + _pBuf += (SIZEOF (xieTypTile) * _count); \ +} + +#else /* WORD64 */ + +#define STORE_LISTOF_TILES(_tiles, _count, _pBuf) \ +{ \ + xieTypTile temp; \ + int i; \ +\ + for (i = 0; i < _count; i++) \ + { \ + temp.src = _tiles[i].src; \ + temp.dstX = _tiles[i].dst_x; \ + temp.dstY = _tiles[i].dst_y; \ + memcpy (_pBuf, &temp, SIZEOF (xieTypTile)); \ + _pBuf += SIZEOF (xieTypTile); \ + } \ +} + +#endif + +#endif /* _ELEMENTS_H_ */ diff --git a/xc/lib/XIE/errors.c b/xc/lib/XIE/errors.c new file mode 100644 index 000000000..fdd92837b --- /dev/null +++ b/xc/lib/XIE/errors.c @@ -0,0 +1,133 @@ +/* $TOG: errors.c /main/6 1998/02/06 15:12:00 kaleb $ */ + +/* + +Copyright 1993, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/lib/XIE/errors.c,v 3.3 1999/06/13 16:18:09 dawes Exp $ */ + +#define NEED_EVENTS /* so XErrorEvent will get pulled in */ + +#include "XIElibint.h" + + +Bool +_XieFloError ( + Display *display, + XErrorEvent *host, + xError *wire) +{ + XieFloAccessError *flo_host_error = (XieFloAccessError *) host; + xieFloAccessErr *flo_wire_error = (xieFloAccessErr *) wire; + + /* + * All flo errors have this basic info. + */ + +/* these are assigned by Xlib already + flo_host_error->error_code = flo_wire_error->code; + flo_host_error->flo_id = flo_wire_error->floID; + flo_host_error->minor_code = flo_wire_error->minorOpcode; + flo_host_error->request_code = flo_wire_error->majorOpcode; +*/ + flo_host_error->flo_error_code = flo_wire_error->floErrorCode; + flo_host_error->name_space = flo_wire_error->nameSpace; + flo_host_error->phototag = flo_wire_error->phototag; + flo_host_error->elem_type = flo_wire_error->type; + + + /* + * Now handle the particularites of each flo error. + */ + + switch (((xieFloAccessErr *) wire)->floErrorCode) + { + case xieErrNoFloAccess: + case xieErrNoFloAlloc: + case xieErrNoFloElement: + case xieErrNoFloID: + case xieErrNoFloMatch: + case xieErrNoFloSource: + case xieErrNoFloImplementation: + + break; + + case xieErrNoFloColormap: + case xieErrNoFloColorList: + case xieErrNoFloDrawable: + case xieErrNoFloGC: + case xieErrNoFloLUT: + case xieErrNoFloPhotomap: + case xieErrNoFloROI: + + { + XieFloResourceError *host_error = (XieFloResourceError *) host; + xieFloResourceErr *wire_error = (xieFloResourceErr *) wire; + + host_error->resource_id = wire_error->resourceID; + break; + } + + case xieErrNoFloDomain: + { + XieFloDomainError *host_error = (XieFloDomainError *) host; + xieFloDomainErr *wire_error = (xieFloDomainErr *) wire; + + host_error->domain_src = wire_error->domainSrc; + break; + } + + case xieErrNoFloOperator: + { + XieFloOperatorError *host_error = (XieFloOperatorError *) host; + xieFloOperatorErr *wire_error = (xieFloOperatorErr *) wire; + + host_error->operator = wire_error->operator; + break; + } + + case xieErrNoFloTechnique: + { + XieFloTechniqueError *host_error = (XieFloTechniqueError *) host; + xieFloTechniqueErr *wire_error = (xieFloTechniqueErr *) wire; + + host_error->technique_number = wire_error->techniqueNumber; + host_error->num_tech_params = wire_error->lenTechParams; + host_error->tech_group = wire_error->techniqueGroup; + break; + } + + case xieErrNoFloValue: + { + XieFloValueError *host_error = (XieFloValueError *) host; + xieFloValueErr *wire_error = (xieFloValueErr *) wire; + + host_error->bad_value = wire_error->badValue; + break; + } + + default: + return (False); + } + + return (True); +} diff --git a/xc/lib/XIE/events.c b/xc/lib/XIE/events.c new file mode 100644 index 000000000..0c27b1113 --- /dev/null +++ b/xc/lib/XIE/events.c @@ -0,0 +1,160 @@ +/* $TOG: events.c /main/7 1998/02/06 15:12:05 kaleb $ */ + +/* + +Copyright 1993, 1994, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/lib/XIE/events.c,v 1.3 1999/06/13 16:18:09 dawes Exp $ */ + +#define NEED_EVENTS /* so xEvent will get pulled in */ +#include "XIElibint.h" + + +Status +_XieColorAllocEvent ( + Display *display, + XEvent *host, + xEvent *wire) +{ + XieColorAllocEvent *host_event = (XieColorAllocEvent *) host; + xieColorAllocEvn *wire_event = (xieColorAllocEvn *) wire; + + host_event->type = wire_event->event & 0x7f; + host_event->serial = wire_event->sequenceNum; + host_event->send_event = (wire_event->event & 0x80) != 0; + host_event->display = display; + host_event->name_space = wire_event->instanceNameSpace; + host_event->time = wire_event->time; + host_event->flo_id = wire_event->instanceFloID; + host_event->src = wire_event->src; + host_event->elem_type = wire_event->type; + host_event->color_list = wire_event->colorList; + host_event->color_alloc_technique = wire_event->colorAllocTechnique; + host_event->color_alloc_data = wire_event->data; + + return (True); +} + + +Status +_XieDecodeNotifyEvent ( + Display *display, + XEvent *host, + xEvent *wire) +{ + XieDecodeNotifyEvent *host_event = (XieDecodeNotifyEvent *) host; + xieDecodeNotifyEvn *wire_event = (xieDecodeNotifyEvn *) wire; + + host_event->type = wire_event->event & 0x7f; + host_event->serial = wire_event->sequenceNum; + host_event->send_event = (wire_event->event & 0x80) != 0; + host_event->display = display; + host_event->name_space = wire_event->instanceNameSpace; + host_event->time = wire_event->time; + host_event->flo_id = wire_event->instanceFloID; + host_event->src = wire_event->src; + host_event->elem_type = wire_event->type; + host_event->decode_technique = wire_event->decodeTechnique; + host_event->aborted = wire_event->aborted; + host_event->band_number = wire_event->bandNumber; + host_event->width = wire_event->width; + host_event->height = wire_event->height; + + return (True); +} + + +Status +_XieExportAvailableEvent ( + Display *display, + XEvent *host, + xEvent *wire) +{ + XieExportAvailableEvent *host_event = (XieExportAvailableEvent *) host; + xieExportAvailableEvn *wire_event = (xieExportAvailableEvn *) wire; + + host_event->type = wire_event->event & 0x7f; + host_event->serial = wire_event->sequenceNum; + host_event->send_event = (wire_event->event & 0x80) != 0; + host_event->display = display; + host_event->name_space = wire_event->instanceNameSpace; + host_event->time = wire_event->time; + host_event->flo_id = wire_event->instanceFloID; + host_event->src = wire_event->src; + host_event->elem_type = wire_event->type; + host_event->band_number = wire_event->bandNumber; + host_event->data[0] = wire_event->data0; + host_event->data[1] = wire_event->data1; + host_event->data[2] = wire_event->data2; + + return (True); +} + + +Status +_XieImportObscuredEvent ( + Display *display, + XEvent *host, + xEvent *wire) +{ + XieImportObscuredEvent *host_event = (XieImportObscuredEvent *) host; + xieImportObscuredEvn *wire_event = (xieImportObscuredEvn *) wire; + + host_event->type = wire_event->event & 0x7f; + host_event->serial = wire_event->sequenceNum; + host_event->send_event = (wire_event->event & 0x80) != 0; + host_event->display = display; + host_event->name_space = wire_event->instanceNameSpace; + host_event->time = wire_event->time; + host_event->flo_id = wire_event->instanceFloID; + host_event->src = wire_event->src; + host_event->elem_type = wire_event->type; + host_event->window = wire_event->window; + host_event->x = wire_event->x; + host_event->y = wire_event->y; + host_event->width = wire_event->width; + host_event->height = wire_event->height; + + return (True); +} + + +Status +_XiePhotofloDoneEvent ( + Display *display, + XEvent *host, + xEvent *wire) +{ + XiePhotofloDoneEvent *host_event = (XiePhotofloDoneEvent *) host; + xiePhotofloDoneEvn *wire_event = (xiePhotofloDoneEvn *) wire; + + host_event->type = wire_event->event & 0x7f; + host_event->serial = wire_event->sequenceNum; + host_event->send_event = (wire_event->event & 0x80) != 0; + host_event->display = display; + host_event->name_space = wire_event->instanceNameSpace; + host_event->time = wire_event->time; + host_event->flo_id = wire_event->instanceFloID; + host_event->outcome = wire_event->outcome; + + return (True); +} diff --git a/xc/lib/XIE/free.c b/xc/lib/XIE/free.c new file mode 100644 index 000000000..4734f7d9d --- /dev/null +++ b/xc/lib/XIE/free.c @@ -0,0 +1,117 @@ +/* $TOG: free.c /main/4 1998/02/06 15:12:10 kaleb $ */ + +/* + +Copyright 1993, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/lib/XIE/free.c,v 1.3 1999/06/13 16:18:10 dawes Exp $ */ + +#include "XIElibint.h" + +#define CHECK_AND_FREE(_ptr) if (_ptr) Xfree (_ptr) + + +void +XieFreeTechniques (XieTechnique *techs, unsigned int count) +{ + unsigned i; + + if (techs) + { + for (i = 0; i < count; i++) + CHECK_AND_FREE (techs[i].name); + + Xfree ((char *) techs); + } +} + + +void +XieFreePhotofloGraph (XiePhotoElement *elements, unsigned int count) +{ + /* + * NOTE: We do not free the technique parameters here. + * Most of the technique parameters should be freed by the + * client using Xfree (exception: EncodeJPEGBaseline and + * EncodeJPEGLossless, see functions below). This is so + * the client can reuse technique parameters between photoflos. + */ + + unsigned i; + + if (!elements) + return; + + for (i = 0; i < count; i++) + { + switch (elements[i].elemType) + { + case xieElemConvolve: + CHECK_AND_FREE ((char *) elements[i].data.Convolve.kernel); + break; + case xieElemPasteUp: + CHECK_AND_FREE ((char *) elements[i].data.PasteUp.tiles); + break; + default: + break; + } + } + + Xfree ((char *) elements); +} + + +void +XieFreeEncodeJPEGBaseline (XieEncodeJPEGBaselineParam *param) +{ + if (param) + { + CHECK_AND_FREE ((char *) param->q_table); + CHECK_AND_FREE ((char *) param->ac_table); + CHECK_AND_FREE ((char *) param->dc_table); + Xfree ((char *) param); + } +} + + +void +XieFreeEncodeJPEGLossless (XieEncodeJPEGLosslessParam *param) +{ + if (param) + { + CHECK_AND_FREE ((char *) param->table); + Xfree ((char *) param); + } +} + + +void +XieFreePasteUpTiles (XiePhotoElement *element) +{ + XieTile *tiles= element->data.PasteUp.tiles; + + if (tiles) + { + Xfree (tiles); + element->data.PasteUp.tiles=NULL; + } +} diff --git a/xc/lib/XIE/globals.h b/xc/lib/XIE/globals.h new file mode 100644 index 000000000..58c399ad2 --- /dev/null +++ b/xc/lib/XIE/globals.h @@ -0,0 +1,120 @@ +/* $TOG: globals.h /main/4 1998/02/06 15:12:14 kaleb $ */ + +/* + +Copyright 1993, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/lib/XIE/globals.h,v 1.3 1999/06/13 13:47:01 dawes Exp $ */ + +extern void _XieElemImportClientLUT (char **, XiePhotoElement *); +extern void _XieElemImportClientPhoto (char **, XiePhotoElement *); +extern void _XieElemImportClientROI (char **, XiePhotoElement *); +extern void _XieElemImportDrawable (char **, XiePhotoElement *); +extern void _XieElemImportDrawablePlane (char **, XiePhotoElement *); +extern void _XieElemImportLUT (char **, XiePhotoElement *); +extern void _XieElemImportPhotomap (char **, XiePhotoElement *); +extern void _XieElemImportROI (char **, XiePhotoElement *); +extern void _XieElemArithmetic (char **, XiePhotoElement *); +extern void _XieElemBandCombine (char **, XiePhotoElement *); +extern void _XieElemBandExtract (char **, XiePhotoElement *); +extern void _XieElemBandSelect (char **, XiePhotoElement *); +extern void _XieElemBlend (char **, XiePhotoElement *); +extern void _XieElemCompare (char **, XiePhotoElement *); +extern void _XieElemConstrain (char **, XiePhotoElement *); +extern void _XieElemConvertFromIndex (char **, XiePhotoElement *); +extern void _XieElemConvertFromRGB (char **, XiePhotoElement *); +extern void _XieElemConvertToIndex (char **, XiePhotoElement *); +extern void _XieElemConvertToRGB (char **, XiePhotoElement *); +extern void _XieElemConvolve (char **, XiePhotoElement *); +extern void _XieElemDither (char **, XiePhotoElement *); +extern void _XieElemGeometry (char **, XiePhotoElement *); +extern void _XieElemLogical (char **, XiePhotoElement *); +extern void _XieElemMatchHistogram (char **, XiePhotoElement *); +extern void _XieElemMath (char **, XiePhotoElement *); +extern void _XieElemPasteUp (char **, XiePhotoElement *); +extern void _XieElemPoint (char **, XiePhotoElement *); +extern void _XieElemUnconstrain (char **, XiePhotoElement *); +extern void _XieElemExportClientHistogram (char **, XiePhotoElement *); +extern void _XieElemExportClientLUT (char **, XiePhotoElement *); +extern void _XieElemExportClientPhoto (char **, XiePhotoElement *); +extern void _XieElemExportClientROI (char **, XiePhotoElement *); +extern void _XieElemExportDrawable (char **, XiePhotoElement *); +extern void _XieElemExportDrawablePlane (char **, XiePhotoElement *); +extern void _XieElemExportLUT (char **, XiePhotoElement *); +extern void _XieElemExportPhotomap (char **, XiePhotoElement *); +extern void _XieElemExportROI (char **, XiePhotoElement *); + +#ifdef NEED_XIE_GLOBALS + +XieExtInfo *_XieExtInfoHeader = NULL; + +void (*(_XieElemFuncs[]))(char **, XiePhotoElement *) = +{ + _XieElemImportClientLUT, + _XieElemImportClientPhoto, + _XieElemImportClientROI, + _XieElemImportDrawable, + _XieElemImportDrawablePlane, + _XieElemImportLUT, + _XieElemImportPhotomap, + _XieElemImportROI, + _XieElemArithmetic, + _XieElemBandCombine, + _XieElemBandExtract, + _XieElemBandSelect, + _XieElemBlend, + _XieElemCompare, + _XieElemConstrain, + _XieElemConvertFromIndex, + _XieElemConvertFromRGB, + _XieElemConvertToIndex, + _XieElemConvertToRGB, + _XieElemConvolve, + _XieElemDither, + _XieElemGeometry, + _XieElemLogical, + _XieElemMatchHistogram, + _XieElemMath, + _XieElemPasteUp, + _XieElemPoint, + _XieElemUnconstrain, + _XieElemExportClientHistogram, + _XieElemExportClientLUT, + _XieElemExportClientPhoto, + _XieElemExportClientROI, + _XieElemExportDrawable, + _XieElemExportDrawablePlane, + _XieElemExportLUT, + _XieElemExportPhotomap, + _XieElemExportROI +}; + + +#ifndef __EMX__ +XieTechFuncRec *_XieTechFuncs[xieValMaxTechGroup]; +#else +XieTechFuncRec *_XieTechFuncs[xieValMaxTechGroup] = {0}; +#endif + +Bool _XieTechFuncsInitialized = 0; + +#endif /* NEED_XIE_GLOBALS */ diff --git a/xc/lib/XIE/ieee.c b/xc/lib/XIE/ieee.c new file mode 100644 index 000000000..1533e9365 --- /dev/null +++ b/xc/lib/XIE/ieee.c @@ -0,0 +1,192 @@ +/* $TOG: ieee.c /main/6 1998/02/06 15:12:20 kaleb $ */ + +/****************************************************************************** + NOTICE + +This software is being provided by AGE Logic, Inc. under the +following license. By obtaining, using and/or copying this software, +you agree that you have read, understood, and will comply with these +terms and conditions: + +Permission to use, copy, modify, distribute and sell this +software and its documentation for any purpose and without +fee or royalty and to grant others any or all rights granted +herein is hereby granted, provided that you agree to comply +with the following copyright notice and statements, including +the disclaimer, and that the same appears on all copies and +derivative works of the software and documentation you make. + + "Copyright 1993 by AGE Logic, Inc. + +THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO +REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of +example, but not limitation, AGE LOGIC MAKES NO +REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT +INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC +SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO +EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT, +INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS +OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR +ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR +BASED ON A WARRANTY, EVEN IF AGE LOGIC OR MIT OR LICENSEES +HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + +The name AGE Logic, Inc. may not be used in +advertising or publicity pertaining to this software without +specific, written prior permission from AGE Logic. + +Title to this software shall at all times remain with AGE +Logic, Inc. +****************************************************************************/ + +/* + +Copyright 1993, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/lib/XIE/ieee.c,v 1.3 1999/06/13 16:18:10 dawes Exp $ */ + +#include "XIElibint.h" +#include <math.h> + +#define ieeeFloatSignMask 0x80000000 +#define ieeeFloatExpMask 0x7F800000 +#define ieeeFloatExpShift 23 +#define ieeeFloatMantissaMask 0x007FFFFF +#define ieeeMantissaSize 23 + +/* + From page 2-8 of spec, IEEE format. This is laid out as: + + bit 31 = 1 bit for sign (if bit on, negative) + bits 23-39 = 8 bit "biased" exponent (see below) + bits 0-22 = 23 bit mantissa + + A "normal" number is formed as + + (-1)^sign_bit * 2^(exp-127) * (1.0 + .mantissa) + + That is, the mantissa is interpreted as a fractional binary + number between 0 and 2^-1 + 2^-2 + ... + 2^-23. + + If the exponent is 255, the value is taken as infinity. + + I stole definition out of TMS Family Code tools, pages 5-22, 5-23 +*/ + +/**********************************************************************/ +xieTypFloat _XieConvertToIEEE(double native) +{ +#ifndef NATIVE_FP_FORMAT + XieFloat really_float = native; /* stupid language */ + return *((xieTypFloat *)&really_float); +#else +xieTypFloat value; +int sign; +int exponent; +int ieee_exp; +long ieee_mantissa; +double frac_part; + + + if (native == 0.0) + return(0); /* frexp() can't handle 0.0 reliably */ + + +/*** frexp() breaks a double into the form + + "frac_part * 2^exponent" + + where 1/2 <= |frac_part| < 1. + +***/ + sign = (native < 0); + frac_part = frexp(native,&exponent) * (sign? -1: 1); + +/*** + In IEEE, a normal number is formed as: + + (-1)^sign_bit * 2^(exp-127) * (1.0 + .mantissa) + + It is easy for us to figure out the sign bit. To convert to + IEEE form, we work with the absolute value of the fractional + part, which is between 1/2 and 1. + + To normalize for IEEE format, the mantissa must be converted + to be between 1 and 2 instead of 1/2 and 1. In other words, + we re-express + + frac_part * 2^exponent + as + 2*frac_part * 2^(exponent-1) + + Then the IEEE mantissa is 2*frac_part - 1, and the IEEE exponent + is given by exponent-1 = exp-127, or exp = 126+exponent. + + example: + The number 0.75 is expressed as f * 2^0, f=0.75. + We convert mantissa to 2*0.75 = 1.5 and subtract + one to get IEEE mantissa coding of 0.5. The exponent + is downgraded to -1 so (1 + 0.5) * 2^-1 is 0.75, + which is coded with IEEE bias as -1 = exp-127, + yielding exp=126. 0.75 = (1+0.5) * 2^(126-127), + and we code 0 for sign bit, 0.5 for mantissa, 126 + for the exponent. + + note: if the exponent becomes larger than 128, then + exp+127>255, and we can't code it any more in + 8 bits. Therefore if the exponent is >= 128, + we set exp=255, which means infinity. +***/ + frac_part = 2*frac_part; + --exponent; + + frac_part -= 1; + + if (exponent >= 128) + ieee_exp = 255; + else + ieee_exp = 127+exponent; + /* notice we already decremented exponent by one, above */ + + +/*** Now assemble the number ***/ + value = 0; + if (sign) + value |= ieeeFloatSignMask; + + value |= (ieee_exp << ieeeFloatExpShift); + +/*** For the mantissa, we know we have a fractional part between 0 and 1. + We want the most significant 23 bits. Just shift 23 places to the + left and truncate. +***/ + ieee_mantissa = (pow(2.0,23.0) * frac_part); + value |= ieee_mantissa; + + return(value); +#endif +} +/**********************************************************************/ + + diff --git a/xc/lib/XIE/init.c b/xc/lib/XIE/init.c new file mode 100644 index 000000000..1760e82c2 --- /dev/null +++ b/xc/lib/XIE/init.c @@ -0,0 +1,452 @@ +/* $TOG: init.c /main/12 1998/02/06 15:12:25 kaleb $ */ + +/* + +Copyright 1993, 1994, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/lib/XIE/init.c,v 3.3 1999/06/13 16:18:10 dawes Exp $ */ + +#define NEED_EVENTS /* so XErrorEvent will get pulled in */ + +#define NEED_XIE_GLOBALS +#include "XIElibint.h" +#include "globals.h" +#include "init.h" +#include <stdio.h> + + + +Status +XieInitialize (display, extinfo_ret) + +Display *display; +XieExtensionInfo **extinfo_ret; + +{ + XieExtInfo *xieExtInfo; + XExtCodes *extCodes; + xieQueryImageExtensionReq *req; + xieQueryImageExtensionReply rep; + char *pBuf; + + LockDisplay (display); + GET_EXTENSION_INFO (display, xieExtInfo); + + if (xieExtInfo) + { + *extinfo_ret = xieExtInfo->extInfo; + + return (1); + } + + *extinfo_ret = NULL; + + if ((extCodes = XInitExtension (display, xieExtName)) == NULL) + { + UnlockDisplay (display); + SYNC_HANDLE (display); + + return (0); + } + + xieExtInfo = (XieExtInfo *) Xmalloc (sizeof (XieExtInfo)); + xieExtInfo->extCodes = extCodes; + xieExtInfo->extInfo = *extinfo_ret = + (XieExtensionInfo *) Xmalloc (sizeof (XieExtensionInfo)); + + ADD_EXTENSION_INFO (display, xieExtInfo); + + GET_REQUEST (QueryImageExtension, pBuf); + + BEGIN_REQUEST_HEADER (QueryImageExtension, pBuf, req); + + STORE_REQUEST_HEADER (QueryImageExtension, req); + req->majorVersion = xieMajorVersion; + req->minorVersion = xieMinorVersion; + + END_REQUEST_HEADER (QueryImageExtension, pBuf, req); + + if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0) + { + UnlockDisplay (display); + SYNC_HANDLE (display); + + return (0); + } + + (*extinfo_ret)->server_major_rev = rep.majorVersion; + (*extinfo_ret)->server_minor_rev = rep.minorVersion; + (*extinfo_ret)->service_class = rep.serviceClass; + (*extinfo_ret)->alignment = rep.alignment; + (*extinfo_ret)->uncnst_mantissa = rep.unconstrainedMantissa; + (*extinfo_ret)->uncnst_min_exp = rep.unconstrainedMinExp; + (*extinfo_ret)->uncnst_max_exp = rep.unconstrainedMaxExp; + (*extinfo_ret)->n_cnst_levels = rep.length; + (*extinfo_ret)->major_opcode = extCodes->major_opcode; + (*extinfo_ret)->first_event = extCodes->first_event; + (*extinfo_ret)->first_error = extCodes->first_error; + + + (*extinfo_ret)->cnst_levels = (unsigned long *) + Xmalloc (rep.length * sizeof (unsigned long)); + + _XRead32 (display, (*extinfo_ret)->cnst_levels, rep.length << 2); + + + /* + * Tell Xlib which function to call when the display is closed. + */ + + XESetCloseDisplay (display, extCodes->extension, _XieCloseDisplay); + + + /* + * Tell Xlib how to convert wire events to host format. + */ + + XESetWireToEvent (display, extCodes->first_event + xieEvnNoColorAlloc, + _XieColorAllocEvent); + + XESetWireToEvent (display, extCodes->first_event + xieEvnNoDecodeNotify, + _XieDecodeNotifyEvent); + + XESetWireToEvent (display, extCodes->first_event + xieEvnNoExportAvailable, + _XieExportAvailableEvent); + + XESetWireToEvent (display, extCodes->first_event + xieEvnNoImportObscured, + _XieImportObscuredEvent); + + XESetWireToEvent (display, extCodes->first_event + xieEvnNoPhotofloDone, + _XiePhotofloDoneEvent); + + + /* + * Tell Xlib how to convert Flo errors from wire to host format. + * Xlib can convert the other errors for us. + */ + + XESetWireToError (display, extCodes->first_error + xieErrNoFlo, + _XieFloError); + + + /* + * Tell Xlib how to print XIE errors. + */ + + XESetPrintErrorValues (display, extCodes->extension, _XiePrintError); + + + /* + * If this is the first time XieInitialize has been called, + * we must register the standard technique functions. + */ + + if (!_XieTechFuncsInitialized) + { + _XieInitTechFuncTable (); + _XieTechFuncsInitialized = 1; + } + + + UnlockDisplay (display); + SYNC_HANDLE (display); + + return (1); +} + + + +Status +XieQueryTechniques (display, technique_group, ntechniques_ret, techniques_ret) + +Display *display; +XieTechniqueGroup technique_group; +int *ntechniques_ret; +XieTechnique **techniques_ret; + +{ + xieQueryTechniquesReq *req; + xieQueryTechniquesReply rep; + char *pBuf, *pBufStart; + XieTechnique *techRet; + xieTypTechniqueRec *techRec; + int i; + + LockDisplay (display); + + GET_REQUEST (QueryTechniques, pBuf); + + BEGIN_REQUEST_HEADER (QueryTechniques, pBuf, req); + + STORE_REQUEST_HEADER (QueryTechniques, req); + req->techniqueGroup = technique_group; + + END_REQUEST_HEADER (QueryTechniques, pBuf, req); + + if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0) + { + UnlockDisplay (display); + SYNC_HANDLE (display); + + *ntechniques_ret = 0; + *techniques_ret = NULL; + + return (0); + } + + XREAD_INTO_SCRATCH (display, pBuf, rep.length << 2); + pBufStart = pBuf; + + *ntechniques_ret = rep.numTechniques; + + *techniques_ret = techRet = (XieTechnique *) Xmalloc ( + sizeof (XieTechnique) * rep.numTechniques); + + for (i = 0; i < (int) rep.numTechniques; i++) + { + GET_TECHNIQUE_REC (pBuf, techRec); + pBuf += SIZEOF (xieTypTechniqueRec); + + techRet[i].needs_param = techRec->needsParam; + techRet[i].group = techRec->group; + techRet[i].number = techRec->number; + techRet[i].speed = techRec->speed; + + techRet[i].name = (char *) Xmalloc ( + (unsigned) techRec->nameLength + 1); + memcpy (techRet[i].name, pBuf, (unsigned) techRec->nameLength); + techRet[i].name[techRec->nameLength] = '\0'; + pBuf += PADDED_BYTES (techRec->nameLength); + } + + FINISH_WITH_SCRATCH (display, pBufStart, rep.length << 2); + UnlockDisplay (display); + SYNC_HANDLE (display); + + return (1); +} + + + +/* + * Routine called when a display is closed via XCloseDisplay. + * The extension information attached to this display is freed. + * The callback is set up in XieInitialize. + */ + +int +_XieCloseDisplay ( + Display *display, + XExtCodes *codes) +{ + XieExtInfo *xieExtInfo; + + REMOVE_EXTENSION_INFO (display, xieExtInfo); + + if (xieExtInfo == NULL) + return (0); + else + { + Xfree ((char *) xieExtInfo->extInfo->cnst_levels); + Xfree ((char *) xieExtInfo->extInfo); + Xfree ((char *) xieExtInfo); + return (1); + } +} + + + +/* + * Routine called when Xlib wants to print an error. This callback + * is setup in XieInitialize. + */ + +void +_XiePrintError ( + Display *display, + XErrorEvent *error, + void *fp) +{ + XieExtInfo *xieExtInfo; + XieFloAccessError *flo_error = (XieFloAccessError *) error; + XieFloResourceError *res_error = (XieFloResourceError *) error; + XieFloDomainError *domain_error = (XieFloDomainError *) error; + XieFloOperatorError *operator_error = (XieFloOperatorError *) error; + XieFloTechniqueError *tech_error = (XieFloTechniqueError *) error; + XieFloValueError *value_error = (XieFloValueError *) error; + + /* + * Xlib bug - extension codes should be passed to this function, + * but they're not. We must get them ourselves. + */ + + GET_EXTENSION_INFO (display, xieExtInfo); + + if (error->error_code == + xieExtInfo->extCodes->first_error + xieErrNoFlo) + { + /* + * Print the flo error type. + */ + + fprintf (fp, " Flo error: "); + + switch (flo_error->flo_error_code) + { + case xieErrNoFloAccess: + fprintf (fp, "FloAccess\n"); + break; + case xieErrNoFloAlloc: + fprintf (fp, "FloAlloc\n"); + break; + case xieErrNoFloElement: + fprintf (fp, "FloElement\n"); + break; + case xieErrNoFloID: + fprintf (fp, "FloID\n"); + break; + case xieErrNoFloMatch: + fprintf (fp, "FloMatch\n"); + break; + case xieErrNoFloSource: + fprintf (fp, "FloSource\n"); + break; + case xieErrNoFloColormap: + fprintf (fp, "FloColormap\n"); + break; + case xieErrNoFloColorList: + fprintf (fp, "FloColorList\n"); + break; + case xieErrNoFloDrawable: + fprintf (fp, "FloDrawable\n"); + break; + case xieErrNoFloGC: + fprintf (fp, "FloGC\n"); + break; + case xieErrNoFloLUT: + fprintf (fp, "FloLUT\n"); + break; + case xieErrNoFloPhotomap: + fprintf (fp, "FloPhotomap\n"); + break; + case xieErrNoFloROI: + fprintf (fp, "FloROI\n"); + break; + case xieErrNoFloDomain: + fprintf (fp, "FloDomain\n"); + break; + case xieErrNoFloOperator: + fprintf (fp, "FloOperator\n"); + break; + case xieErrNoFloTechnique: + fprintf (fp, "FloTechnique\n"); + break; + case xieErrNoFloValue: + fprintf (fp, "FloValue\n"); + break; + case xieErrNoFloImplementation: + fprintf (fp, "FloImplementation\n"); + break; + default: + break; + } + + + /* + * All flo errors have this basic info to print. + */ + + fprintf (fp, " Name-space: 0x%lx\n", flo_error->name_space); + fprintf (fp, " Phototag: %d\n", flo_error->phototag); + fprintf (fp, " Element type: %d\n", flo_error->elem_type); + + + /* + * Now handle the particularites of each flo error. + */ + + switch (flo_error->flo_error_code) + { + case xieErrNoFloAccess: + case xieErrNoFloAlloc: + case xieErrNoFloElement: + case xieErrNoFloID: + case xieErrNoFloMatch: + case xieErrNoFloSource: + case xieErrNoFloImplementation: + break; + + case xieErrNoFloColormap: + fprintf (fp, " Colormap: 0x%lx\n", res_error->resource_id); + break; + + case xieErrNoFloColorList: + fprintf (fp, " ColorList: 0x%lx\n", res_error->resource_id); + break; + + case xieErrNoFloDrawable: + fprintf (fp, " Drawable: 0x%lx\n", res_error->resource_id); + break; + + case xieErrNoFloGC: + fprintf (fp, " GC: 0x%lx\n", res_error->resource_id); + break; + + case xieErrNoFloLUT: + fprintf (fp, " LUT: 0x%lx\n", res_error->resource_id); + break; + + case xieErrNoFloPhotomap: + fprintf (fp, " Photomap: 0x%lx\n", res_error->resource_id); + break; + + case xieErrNoFloROI: + fprintf (fp, " ROI: 0x%lx\n", res_error->resource_id); + break; + + case xieErrNoFloDomain: + fprintf (fp, " Phototag of domain src: %d\n", + domain_error->domain_src); + break; + + case xieErrNoFloOperator: + fprintf (fp, " Operator: 0x%lx\n", (long) operator_error->operator); + break; + + case xieErrNoFloTechnique: + fprintf (fp, " Technique number: 0x%lx\n", + (long) tech_error->technique_number); + fprintf (fp, " Number of technique params: %d\n", + tech_error->num_tech_params); + fprintf (fp, " Technique group: %d\n", + tech_error->tech_group); + break; + + case xieErrNoFloValue: + fprintf (fp, " Bad value: 0x%lx\n", value_error->bad_value); + break; + + default: + break; + } + } +} diff --git a/xc/lib/XIE/init.h b/xc/lib/XIE/init.h new file mode 100644 index 000000000..b2cbfaaf1 --- /dev/null +++ b/xc/lib/XIE/init.h @@ -0,0 +1,39 @@ +/* $TOG: init.h /main/4 1998/02/06 15:12:30 kaleb $ */ + +/* + +Copyright 1993, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifndef WORD64 + +#define GET_TECHNIQUE_REC(_pBuf, _techRec) \ + _techRec = (xieTypTechniqueRec *) _pBuf; + +#else /* WORD64 */ + +#define GET_TECHNIQUE_REC(_pBuf, _techRec) \ + xieTypTechniqueRec temp; \ + memcpy (&temp, _pBuf, SIZEOF (xieTypTechniqueRec)); \ + _techRec = &temp; + +#endif /* WORD64 */ diff --git a/xc/lib/XIE/jump_funcs b/xc/lib/XIE/jump_funcs new file mode 100644 index 000000000..e590f57c2 --- /dev/null +++ b/xc/lib/XIE/jump_funcs @@ -0,0 +1,197 @@ +# $XConsortium: jump_funcs,v 1.2 94/12/07 10:44:37 kaleb Exp $ +# $XFree86: xc/lib/XIE/jump_funcs,v 3.1 1995/01/28 15:43:09 dawes Exp $ +00000000 T _XieAbort libXIE abort +00000000 T _XieAwait libXIE await +00000000 T _XiePutClientData libXIE clientdata +00000000 T _XieGetClientData libXIE clientdata +00000000 T _XieCreateColorList libXIE colorlist +00000000 T _XieDestroyColorList libXIE colorlist +00000000 T _XiePurgeColorList libXIE colorlist +00000000 T _XieQueryColorList libXIE colorlist +00000000 T _XieFloImportClientLUT libXIE conven +00000000 T _XieFloImportClientPhoto libXIE conven +00000000 T _XieFloImportClientROI libXIE conven +00000000 T _XieFloImportDrawable libXIE conven +00000000 T _XieFloImportDrawablePlane libXIE conven +00000000 T _XieFloImportLUT libXIE conven +00000000 T _XieFloImportPhotomap libXIE conven +00000000 T _XieFloImportROI libXIE conven +00000000 T _XieFloArithmetic libXIE conven +00000000 T _XieFloBandCombine libXIE conven +00000000 T _XieFloBandExtract libXIE conven +00000000 T _XieFloBandSelect libXIE conven +00000000 T _XieFloBlend libXIE conven +00000000 T _XieFloCompare libXIE conven +00000000 T _XieFloConstrain libXIE conven +00000000 T _XieFloConvertFromIndex libXIE conven +00000000 T _XieFloConvertFromRGB libXIE conven +00000000 T _XieFloConvertToIndex libXIE conven +00000000 T _XieFloConvertToRGB libXIE conven +00000000 T _XieFloConvolve libXIE conven +00000000 T _XieFloDither libXIE conven +00000000 T _XieFloGeometry libXIE conven +00000000 T _XieFloLogical libXIE conven +00000000 T _XieFloMatchHistogram libXIE conven +00000000 T _XieFloMath libXIE conven +00000000 T _XieFloPasteUp libXIE conven +00000000 T _XieFloPoint libXIE conven +00000000 T _XieFloUnconstrain libXIE conven +00000000 T _XieFloExportClientHistogram libXIE conven +00000000 T _XieFloExportClientLUT libXIE conven +00000000 T _XieFloExportClientPhoto libXIE conven +00000000 T _XieFloExportClientROI libXIE conven +00000000 T _XieFloExportDrawable libXIE conven +00000000 T _XieFloExportDrawablePlane libXIE conven +00000000 T _XieFloExportLUT libXIE conven +00000000 T _XieFloExportPhotomap libXIE conven +00000000 T _XieFloExportROI libXIE conven +00000000 T _XieTecColorAllocAll libXIE conven +00000000 T _XieTecColorAllocMatch libXIE conven +00000000 T _XieTecColorAllocRequantize libXIE conven +00000000 T _XieTecRGBToCIELab libXIE conven +00000000 T _XieTecRGBToCIEXYZ libXIE conven +00000000 T _XieTecRGBToYCbCr libXIE conven +00000000 T _XieTecRGBToYCC libXIE conven +00000000 T _XieTecCIELabToRGB libXIE conven +00000000 T _XieTecCIEXYZToRGB libXIE conven +00000000 T _XieTecYCbCrToRGB libXIE conven +00000000 T _XieTecYCCToRGB libXIE conven +00000000 T _XieTecClipScale libXIE conven +00000000 T _XieTecConvolveConstant libXIE conven +00000000 T _XieTecDecodeUncompressedSingle libXIE conven +00000000 T _XieTecDecodeUncompressedTriple libXIE conven +00000000 T _XieTecDecodeG31D libXIE conven +00000000 T _XieTecDecodeG32D libXIE conven +00000000 T _XieTecDecodeG42D libXIE conven +00000000 T _XieTecDecodeTIFF2 libXIE conven +00000000 T _XieTecDecodeTIFFPackBits libXIE conven +00000000 T _XieTecDecodeJPEGBaseline libXIE conven +00000000 T _XieTecDecodeJPEGLossless libXIE conven +00000000 T _XieTecDitherOrderedParam libXIE conven +00000000 T _XieTecEncodeUncompressedSingle libXIE conven +00000000 T _XieTecEncodeUncompressedTriple libXIE conven +00000000 T _XieTecEncodeG31D libXIE conven +00000000 T _XieTecEncodeG32D libXIE conven +00000000 T _XieTecEncodeG42D libXIE conven +00000000 T _XieTecEncodeJPEGBaseline libXIE conven +00000000 T _XieTecEncodeJPEGLossless libXIE conven +00000000 T _XieTecEncodeTIFF2 libXIE conven +00000000 T _XieTecEncodeTIFFPackBits libXIE conven +00000000 T _XieTecEncodeServerChoice libXIE conven +00000000 T _XieTecGeomAntialiasByArea libXIE conven +00000000 T _XieTecGeomAntialiasByLowpass libXIE conven +00000000 T _XieTecGeomGaussian libXIE conven +00000000 T _XieTecGeomNearestNeighbor libXIE conven +00000000 T _XieTecHistogramGaussian libXIE conven +00000000 T _XieTecHistogramHyperbolic libXIE conven +00000000 T _XieTecWhiteAdjustCIELabShift libXIE conven +00000000 T __XiePhotofloSize libXIE elements +00000000 T __XieElemImportClientLUT libXIE elements +00000000 T __XieElemImportClientPhoto libXIE elements +00000000 T __XieElemImportClientROI libXIE elements +00000000 T __XieElemImportDrawable libXIE elements +00000000 T __XieElemImportDrawablePlane libXIE elements +00000000 T __XieElemImportLUT libXIE elements +00000000 T __XieElemImportPhotomap libXIE elements +00000000 T __XieElemImportROI libXIE elements +00000000 T __XieElemArithmetic libXIE elements +00000000 T __XieElemBandCombine libXIE elements +00000000 T __XieElemBandExtract libXIE elements +00000000 T __XieElemBandSelect libXIE elements +00000000 T __XieElemBlend libXIE elements +00000000 T __XieElemCompare libXIE elements +00000000 T __XieElemConstrain libXIE elements +00000000 T __XieElemConvertFromIndex libXIE elements +00000000 T __XieElemConvertFromRGB libXIE elements +00000000 T __XieElemConvertToIndex libXIE elements +00000000 T __XieElemConvertToRGB libXIE elements +00000000 T __XieElemConvolve libXIE elements +00000000 T __XieElemDither libXIE elements +00000000 T __XieElemGeometry libXIE elements +00000000 T __XieElemLogical libXIE elements +00000000 T __XieElemMatchHistogram libXIE elements +00000000 T __XieElemMath libXIE elements +00000000 T __XieElemPasteUp libXIE elements +00000000 T __XieElemPoint libXIE elements +00000000 T __XieElemUnconstrain libXIE elements +00000000 T __XieElemExportClientHistogram libXIE elements +00000000 T __XieElemExportClientLUT libXIE elements +00000000 T __XieElemExportClientPhoto libXIE elements +00000000 T __XieElemExportClientROI libXIE elements +00000000 T __XieElemExportDrawable libXIE elements +00000000 T __XieElemExportDrawablePlane libXIE elements +00000000 T __XieElemExportLUT libXIE elements +00000000 T __XieElemExportPhotomap libXIE elements +00000000 T __XieElemExportROI libXIE elements +00000000 T __XieFloError libXIE errors +00000000 T __XieColorAllocEvent libXIE events +00000000 T __XieDecodeNotifyEvent libXIE events +00000000 T __XieExportAvailableEvent libXIE events +00000000 T __XieImportObscuredEvent libXIE events +00000000 T __XiePhotofloDoneEvent libXIE events +00000000 T _XieFreeTechniques libXIE free +00000000 T _XieFreePhotofloGraph libXIE free +00000000 T _XieFreeEncodeJPEGBaseline libXIE free +00000000 T _XieFreeEncodeJPEGLossless libXIE free +00000000 T _XieFreePasteUpTiles libXIE free +00000000 T __XieConvertToIEEE libXIE ieee +00000000 T _XieInitialize libXIE init +00000000 T _XieQueryTechniques libXIE init +00000000 T __XieCloseDisplay libXIE init +00000000 T __XiePrintError libXIE init +00000000 T _XieCreateLUT libXIE lut +00000000 T _XieDestroyLUT libXIE lut +00000000 T _XieAllocatePhotofloGraph libXIE photoflo +00000000 T _XieCreatePhotoflo libXIE photoflo +00000000 T _XieDestroyPhotoflo libXIE photoflo +00000000 T _XieExecutePhotoflo libXIE photoflo +00000000 T _XieModifyPhotoflo libXIE photoflo +00000000 T _XieRedefinePhotoflo libXIE photoflo +00000000 T _XieQueryPhotoflo libXIE photoflo +00000000 T _XieCreatePhotomap libXIE photomap +00000000 T _XieDestroyPhotomap libXIE photomap +00000000 T _XieQueryPhotomap libXIE photomap +00000000 T _XieCreatePhotospace libXIE photospace +00000000 T _XieDestroyPhotospace libXIE photospace +00000000 T _XieExecuteImmediate libXIE photospace +00000000 T _XieCreateROI libXIE roi +00000000 T _XieDestroyROI libXIE roi +00000000 T __XieTechniqueLength libXIE technique +00000000 T __XieEncodeTechnique libXIE technique +00000000 T __XieColorAllocAllParam libXIE technique +00000000 T __XieColorAllocMatchParam libXIE technique +00000000 T __XieColorAllocRequantizeParam libXIE technique +00000000 T __XieRGBToCIELabParam libXIE technique +00000000 T __XieRGBToYCbCrParam libXIE technique +00000000 T __XieRGBToYCCParam libXIE technique +00000000 T __XieYCbCrToRGBParam libXIE technique +00000000 T __XieYCCToRGBParam libXIE technique +00000000 T __XieCIELabToRGBParam libXIE technique +00000000 T __XieConvolveConstantParam libXIE technique +00000000 T __XieClipScaleParam libXIE technique +00000000 T __XieDecodeUncompressedSingleParam libXIE technique +00000000 T __XieDecodeUncompressedTripleParam libXIE technique +00000000 T __XieDecodeG31DParam libXIE technique +00000000 T __XieDecodeTIFFPackBitsParam libXIE technique +00000000 T __XieDecodeJPEGBaselineParam libXIE technique +00000000 T __XieDitherOrderedParam libXIE technique +00000000 T __XieEncodeUncompressedSingleParam libXIE technique +00000000 T __XieEncodeUncompressedTripleParam libXIE technique +00000000 T __XieEncodeG31DParam libXIE technique +00000000 T __XieEncodeTIFFPackBitsParam libXIE technique +00000000 T __XieEncodeServerChoiceParam libXIE technique +00000000 T __XieEncodeG32DParam libXIE technique +00000000 T __XieEncodeG42DParam libXIE technique +00000000 T __XieEncodeJPEGBaselineParam libXIE technique +00000000 T __XieEncodeJPEGLosslessParam libXIE technique +00000000 T __XieEncodeTIFF2Param libXIE technique +00000000 T __XieGeomAntialiasByAreaParam libXIE technique +00000000 T __XieGeomAntialiasByLowpassParam libXIE technique +00000000 T __XieGeomGaussianParam libXIE technique +00000000 T __XieGeomNearestNeighborParam libXIE technique +00000000 T __XieHistogramGaussianParam libXIE technique +00000000 T __XieHistogramHyperbolicParam libXIE technique +00000000 T __XieWhiteAdjustCIELabShiftParam libXIE technique +00000000 T __XieInitTechFuncTable libXIE technique +00000000 T __XieRegisterTechFunc libXIE utils +00000000 T __XieLookupTechFunc libXIE utils diff --git a/xc/lib/XIE/jump_ignore b/xc/lib/XIE/jump_ignore new file mode 100644 index 000000000..939a888dc --- /dev/null +++ b/xc/lib/XIE/jump_ignore @@ -0,0 +1,3 @@ +# $XConsortium: jump_ignore,v 1.2 94/12/07 10:44:37 kaleb Exp $ +# $XFree86: xc/lib/XIE/jump_ignore,v 3.1 1995/01/28 15:43:12 dawes Exp $ +# jump_ignore diff --git a/xc/lib/XIE/jump_vars b/xc/lib/XIE/jump_vars new file mode 100644 index 000000000..481d2e3f4 --- /dev/null +++ b/xc/lib/XIE/jump_vars @@ -0,0 +1,6 @@ +# $XConsortium: jump_vars,v 1.2 94/12/07 10:44:37 kaleb Exp $ +# $XFree86: xc/lib/XIE/jump_vars,v 3.1 1995/01/28 15:43:13 dawes Exp $ +00000004 D __XieExtInfoHeader libXIE init +000000b4 D __XieElemFuncs libXIE init +00000004 D __XieTechFuncsInitialized libXIE init +00000080 C __XieTechFuncs libXIE init diff --git a/xc/lib/XIE/lut.c b/xc/lib/XIE/lut.c new file mode 100644 index 000000000..bcfa46cb8 --- /dev/null +++ b/xc/lib/XIE/lut.c @@ -0,0 +1,77 @@ +/* $TOG: lut.c /main/3 1998/02/06 15:12:36 kaleb $ */ + +/* + +Copyright 1993, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/lib/XIE/lut.c,v 1.3 1999/06/13 16:18:10 dawes Exp $ */ + +#include "XIElibint.h" + + +XieLut +XieCreateLUT (Display *display) +{ + xieCreateLUTReq *req; + char *pBuf; + XieLut id; + + LockDisplay (display); + + id = XAllocID (display); + + GET_REQUEST (CreateLUT, pBuf); + + BEGIN_REQUEST_HEADER (CreateLUT, pBuf, req); + + STORE_REQUEST_HEADER (CreateLUT, req); + req->lut = id; + + END_REQUEST_HEADER (CreateLUT, pBuf, req); + + UnlockDisplay (display); + SYNC_HANDLE (display); + + return (id); +} + + +void +XieDestroyLUT (Display *display, XieLut lut) +{ + xieDestroyLUTReq *req; + char *pBuf; + + LockDisplay (display); + + GET_REQUEST (DestroyLUT, pBuf); + + BEGIN_REQUEST_HEADER (DestroyLUT, pBuf, req); + + STORE_REQUEST_HEADER (DestroyLUT, req); + req->lut = lut; + + END_REQUEST_HEADER (DestroyLUT, pBuf, req); + + UnlockDisplay (display); + SYNC_HANDLE (display); +} diff --git a/xc/lib/XIE/photoflo.c b/xc/lib/XIE/photoflo.c new file mode 100644 index 000000000..43ef91681 --- /dev/null +++ b/xc/lib/XIE/photoflo.c @@ -0,0 +1,301 @@ +/* $TOG: photoflo.c /main/7 1998/02/06 15:12:41 kaleb $ */ + +/* + +Copyright 1993, 1994, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/lib/XIE/photoflo.c,v 1.3 1999/06/13 16:18:11 dawes Exp $ */ + +#include "XIElibint.h" + + +XiePhotoElement * +XieAllocatePhotofloGraph (unsigned int count) +{ + XiePhotoElement *ptr; + unsigned size; + + size = count * sizeof (XiePhotoElement); + ptr = (XiePhotoElement *) Xmalloc (size); + bzero ((char *) ptr, size); + + return (ptr); +} + + +XiePhotoflo +XieCreatePhotoflo ( + Display *display, + XiePhotoElement *elem_list, + int elem_count) +{ + xieCreatePhotofloReq *req; + char *pBuf, *pStart; + unsigned size; + XiePhotoflo id; + int i; + + LockDisplay (display); + + id = XAllocID (display); + + size = _XiePhotofloSize (elem_list, elem_count); + + GET_REQUEST (CreatePhotoflo, pBuf); + + BEGIN_REQUEST_HEADER (CreatePhotoflo, pBuf, req); + + STORE_REQUEST_EXTRA_HEADER (CreatePhotoflo, size, req); + req->floID = id; + req->numElements = elem_count; + + END_REQUEST_HEADER (CreatePhotoflo, pBuf, req); + + pBuf = pStart = _XAllocScratch (display, size); + + for (i = 0; i < elem_count; i++) + (*_XieElemFuncs[elem_list[i].elemType - 1]) (&pBuf, &elem_list[i]); + + Data (display, pStart, size); + + UnlockDisplay (display); + SYNC_HANDLE (display); + + return (id); +} + + +void +XieDestroyPhotoflo ( + Display *display, + XiePhotoflo photoflo) +{ + xieDestroyPhotofloReq *req; + char *pBuf; + + LockDisplay (display); + + GET_REQUEST (DestroyPhotoflo, pBuf); + + BEGIN_REQUEST_HEADER (DestroyPhotoflo, pBuf, req); + + STORE_REQUEST_HEADER (DestroyPhotoflo, req); + req->floID = photoflo; + + END_REQUEST_HEADER (DestroyPhotoflo, pBuf, req); + + UnlockDisplay (display); + SYNC_HANDLE (display); +} + + +void +XieExecutePhotoflo ( + Display *display, + XiePhotoflo photoflo, + Bool notify) +{ + xieExecutePhotofloReq *req; + char *pBuf; + + LockDisplay (display); + + GET_REQUEST (ExecutePhotoflo, pBuf); + + BEGIN_REQUEST_HEADER (ExecutePhotoflo, pBuf, req); + + STORE_REQUEST_HEADER (ExecutePhotoflo, req); + req->floID = photoflo; + req->notify = notify; + + END_REQUEST_HEADER (ExecutePhotoflo, pBuf, req); + + UnlockDisplay (display); + SYNC_HANDLE (display); +} + + +void +XieModifyPhotoflo ( + Display *display, + XiePhotoflo photoflo, + int start, + XiePhotoElement *elem_list, + int elem_count) +{ + xieModifyPhotofloReq *req; + char *pBuf, *pStart; + unsigned size; + int i; + + LockDisplay (display); + + size = _XiePhotofloSize (elem_list, elem_count); + + GET_REQUEST (ModifyPhotoflo, pBuf); + + BEGIN_REQUEST_HEADER (ModifyPhotoflo, pBuf, req); + + STORE_REQUEST_EXTRA_HEADER (ModifyPhotoflo, size, req); + req->floID = photoflo; + req->start = start; + req->numElements = elem_count; + + END_REQUEST_HEADER (ModifyPhotoflo, pBuf, req); + + pBuf = pStart = _XAllocScratch (display, size); + + for (i = 0; i < elem_count; i++) + (*_XieElemFuncs[elem_list[i].elemType - 1]) (&pBuf, &elem_list[i]); + + Data (display, pStart, size); + + UnlockDisplay (display); + SYNC_HANDLE (display); +} + + +void +XieRedefinePhotoflo ( + Display *display, + XiePhotoflo photoflo, + XiePhotoElement *elem_list, + int elem_count) +{ + xieRedefinePhotofloReq *req; + char *pBuf, *pStart; + unsigned size; + int i; + + LockDisplay (display); + + size = _XiePhotofloSize (elem_list, elem_count); + + GET_REQUEST (RedefinePhotoflo, pBuf); + + BEGIN_REQUEST_HEADER (RedefinePhotoflo, pBuf, req); + + STORE_REQUEST_EXTRA_HEADER (RedefinePhotoflo, size, req); + req->floID = photoflo; + req->numElements = elem_count; + + END_REQUEST_HEADER (RedefinePhotoflo, pBuf, req); + + pBuf = pStart = _XAllocScratch (display, size); + + for (i = 0; i < elem_count; i++) + (*_XieElemFuncs[elem_list[i].elemType - 1]) (&pBuf, &elem_list[i]); + + Data (display, pStart, size); + + UnlockDisplay (display); + SYNC_HANDLE (display); +} + + +Status +XieQueryPhotoflo ( + Display *display, + unsigned long name_space, + unsigned long flo_id, + XiePhotofloState *state_ret, + XiePhototag **data_expected_ret, + unsigned int *nexpected_ret, + XiePhototag **data_available_ret, + unsigned int *navailable_ret) +{ + xieQueryPhotofloReq *req; + xieQueryPhotofloReply rep; + char *pBuf; + int i; + + LockDisplay (display); + + GET_REQUEST (QueryPhotoflo, pBuf); + + BEGIN_REQUEST_HEADER (QueryPhotoflo, pBuf, req); + + STORE_REQUEST_HEADER (QueryPhotoflo, req); + req->nameSpace = name_space; + req->floID = flo_id; + + END_REQUEST_HEADER (QueryPhotoflo, pBuf, req); + + *state_ret = 0; + *nexpected_ret = 0; + *data_expected_ret = NULL; + *navailable_ret = 0; + *data_available_ret = NULL; + + if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0) + { + UnlockDisplay (display); + SYNC_HANDLE (display); + + return (0); + } + + *state_ret = rep.state; + + if (rep.expectedCount > 0) + { + short *temp = (short *) _XAllocTemp (display, + sizeof (short) * rep.expectedCount); + + *nexpected_ret = rep.expectedCount; + *data_expected_ret = (XiePhototag *) Xmalloc ( + sizeof (XiePhototag) * rep.expectedCount); + + _XRead16Pad (display, temp, + rep.expectedCount * SIZEOF (xieTypPhototag)); + + for (i = 0; i < rep.expectedCount; i++) + (*data_expected_ret)[i] = (XiePhototag) temp[i]; + + _XFreeTemp (display, (char *) temp, + sizeof (short) * rep.expectedCount); + } + + if (rep.availableCount > 0) + { + short *temp = (short *) _XAllocTemp (display, + sizeof (short) * rep.availableCount); + + *navailable_ret = rep.availableCount; + *data_available_ret = (XiePhototag *) Xmalloc ( + sizeof (XiePhototag) * rep.availableCount); + + _XRead16Pad (display, temp, + rep.availableCount * SIZEOF (xieTypPhototag)); + + for (i = 0; i < rep.availableCount; i++) + (*data_available_ret)[i] = (XiePhototag) temp[i]; + + _XFreeTemp (display, (char *) temp, + sizeof (short) * rep.availableCount); + } + + UnlockDisplay (display); + SYNC_HANDLE (display); + + return (1); +} diff --git a/xc/lib/XIE/photomap.c b/xc/lib/XIE/photomap.c new file mode 100644 index 000000000..3ad31dcaa --- /dev/null +++ b/xc/lib/XIE/photomap.c @@ -0,0 +1,134 @@ +/* $TOG: photomap.c /main/7 1998/02/06 15:12:46 kaleb $ */ + +/* + +Copyright 1993, 1994, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/lib/XIE/photomap.c,v 1.3 1999/06/13 16:18:11 dawes Exp $ */ + +#include "XIElibint.h" + + +XiePhotomap +XieCreatePhotomap (Display *display) +{ + xieCreatePhotomapReq *req; + char *pBuf; + XiePhotomap id; + + LockDisplay (display); + + id = XAllocID (display); + + GET_REQUEST (CreatePhotomap, pBuf); + + BEGIN_REQUEST_HEADER (CreatePhotomap, pBuf, req); + + STORE_REQUEST_HEADER (CreatePhotomap, req); + req->photomap = id; + + END_REQUEST_HEADER (CreatePhotomap, pBuf, req); + + UnlockDisplay (display); + SYNC_HANDLE (display); + + return (id); +} + + +void +XieDestroyPhotomap (Display *display, XiePhotomap photomap) +{ + xieDestroyPhotomapReq *req; + char *pBuf; + + LockDisplay (display); + + GET_REQUEST (DestroyPhotomap, pBuf); + + BEGIN_REQUEST_HEADER (DestroyPhotomap, pBuf, req); + + STORE_REQUEST_HEADER (DestroyPhotomap, req); + req->photomap = photomap; + + END_REQUEST_HEADER (DestroyPhotomap, pBuf, req); + + UnlockDisplay (display); + SYNC_HANDLE (display); +} + + +Status +XieQueryPhotomap ( + Display *display, + XiePhotomap photomap, + Bool *populated_ret, + XieDataType *datatype_ret, + XieDataClass *dataclass_ret, + XieDecodeTechnique *decode_technique_ret, + XieLTriplet width_ret, + XieLTriplet height_ret, + XieLTriplet levels_ret) +{ + xieQueryPhotomapReq *req; + xieQueryPhotomapReply rep; + char *pBuf; + + LockDisplay (display); + + GET_REQUEST (QueryPhotomap, pBuf); + + BEGIN_REQUEST_HEADER (QueryPhotomap, pBuf, req); + + STORE_REQUEST_HEADER (QueryPhotomap, req); + req->photomap = photomap; + + END_REQUEST_HEADER (QueryPhotomap, pBuf, req); + + if (_XReply (display, (xReply *)&rep, + (SIZEOF (xieQueryPhotomapReply) - 32) >> 2, xTrue) == 0) + { + UnlockDisplay (display); + SYNC_HANDLE (display); + + return (0); + } + + *populated_ret = rep.populated; + *datatype_ret = rep.dataType; + *dataclass_ret = rep.dataClass; + *decode_technique_ret = rep.decodeTechnique; + width_ret[0] = rep.width0; + width_ret[1] = rep.width1; + width_ret[2] = rep.width2; + height_ret[0] = rep.height0; + height_ret[1] = rep.height1; + height_ret[2] = rep.height2; + levels_ret[0] = rep.levels0; + levels_ret[1] = rep.levels1; + levels_ret[2] = rep.levels2; + + UnlockDisplay (display); + SYNC_HANDLE (display); + + return (1); +} diff --git a/xc/lib/XIE/photospace.c b/xc/lib/XIE/photospace.c new file mode 100644 index 000000000..ff57e5f9e --- /dev/null +++ b/xc/lib/XIE/photospace.c @@ -0,0 +1,120 @@ +/* $TOG: photospace.c /main/3 1998/02/06 15:12:51 kaleb $ */ + +/* + +Copyright 1993, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/lib/XIE/photospace.c,v 1.3 1999/06/13 16:18:11 dawes Exp $ */ + +#include "XIElibint.h" + + + +XiePhotospace +XieCreatePhotospace (Display *display) +{ + xieCreatePhotospaceReq *req; + char *pBuf; + XiePhotospace id; + + LockDisplay (display); + + id = XAllocID (display); + + GET_REQUEST (CreatePhotospace, pBuf); + + BEGIN_REQUEST_HEADER (CreatePhotospace, pBuf, req); + + STORE_REQUEST_HEADER (CreatePhotospace, req); + req->nameSpace = id; + + END_REQUEST_HEADER (CreatePhotospace, pBuf, req); + + UnlockDisplay (display); + SYNC_HANDLE (display); + + return (id); +} + + +void +XieDestroyPhotospace (Display *display, XiePhotospace photospace) +{ + xieDestroyPhotospaceReq *req; + char *pBuf; + + LockDisplay (display); + + GET_REQUEST (DestroyPhotospace, pBuf); + + BEGIN_REQUEST_HEADER (DestroyPhotospace, pBuf, req); + + STORE_REQUEST_HEADER (DestroyPhotospace, req); + req->nameSpace = photospace; + + END_REQUEST_HEADER (DestroyPhotospace, pBuf, req); + + UnlockDisplay (display); + SYNC_HANDLE (display); +} + + +void +XieExecuteImmediate ( + Display *display, + XiePhotospace photospace, + unsigned long flo_id, + Bool notify, + XiePhotoElement *elem_list, + int elem_count) +{ + xieExecuteImmediateReq *req; + char *pBuf, *pStart; + unsigned size; + int i; + + LockDisplay (display); + + size = _XiePhotofloSize (elem_list, elem_count); + + GET_REQUEST (ExecuteImmediate, pBuf); + + BEGIN_REQUEST_HEADER (ExecuteImmediate, pBuf, req); + + STORE_REQUEST_EXTRA_HEADER (ExecuteImmediate, size, req); + req->nameSpace = photospace; + req->floID = flo_id; + req->numElements = elem_count; + req->notify = notify; + + END_REQUEST_HEADER (ExecuteImmediate, pBuf, req); + + pBuf = pStart = _XAllocScratch (display, size); + + for (i = 0; i < elem_count; i++) + (*_XieElemFuncs[elem_list[i].elemType - 1]) (&pBuf, &elem_list[i]); + + Data (display, pStart, size); + + UnlockDisplay (display); + SYNC_HANDLE (display); +} diff --git a/xc/lib/XIE/roi.c b/xc/lib/XIE/roi.c new file mode 100644 index 000000000..82b9869a9 --- /dev/null +++ b/xc/lib/XIE/roi.c @@ -0,0 +1,77 @@ +/* $TOG: roi.c /main/3 1998/02/06 15:12:57 kaleb $ */ + +/* + +Copyright 1993, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/lib/XIE/roi.c,v 1.3 1999/06/13 16:18:12 dawes Exp $ */ + +#include "XIElibint.h" + + +XieRoi +XieCreateROI (Display *display) +{ + xieCreateROIReq *req; + char *pBuf; + XieRoi id; + + LockDisplay (display); + + id = XAllocID (display); + + GET_REQUEST (CreateROI, pBuf); + + BEGIN_REQUEST_HEADER (CreateROI, pBuf, req); + + STORE_REQUEST_HEADER (CreateROI, req); + req->roi = id; + + END_REQUEST_HEADER (CreateROI, pBuf, req); + + UnlockDisplay (display); + SYNC_HANDLE (display); + + return (id); +} + + +void +XieDestroyROI (Display *display, XieRoi roi) +{ + xieDestroyROIReq *req; + char *pBuf; + + LockDisplay (display); + + GET_REQUEST (DestroyROI, pBuf); + + BEGIN_REQUEST_HEADER (DestroyROI, pBuf, req); + + STORE_REQUEST_HEADER (DestroyROI, req); + req->roi = roi; + + END_REQUEST_HEADER (DestroyROI, pBuf, req); + + UnlockDisplay (display); + SYNC_HANDLE (display); +} diff --git a/xc/lib/XIE/technique.c b/xc/lib/XIE/technique.c new file mode 100644 index 000000000..b4c72c7a0 --- /dev/null +++ b/xc/lib/XIE/technique.c @@ -0,0 +1,1329 @@ +/* $TOG: technique.c /main/8 1998/02/06 15:13:02 kaleb $ */ + +/* + +Copyright 1993, 1994, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/lib/XIE/technique.c,v 1.3 1999/06/13 16:18:12 dawes Exp $ */ + +#include "XIElibint.h" +#include "technique.h" + +/* these really should have been static, but they're listed in XIEos2.def */ + +extern int _XieColorAllocAllParam (char **, XiePointer, int); +extern int _XieColorAllocMatchParam (char **, XiePointer, int); +extern int _XieColorAllocRequantizeParam (char **, XiePointer, int); +extern int _XieRGBToCIELabParam (char **, XiePointer, int); +extern int _XieRGBToYCbCrParam (char **, XiePointer, int); +extern int _XieRGBToYCCParam (char **, XiePointer, int); +extern int _XieYCbCrToRGBParam (char **, XiePointer, int); +extern int _XieYCCToRGBParam (char **, XiePointer, int); +extern int _XieCIELabToRGBParam (char **, XiePointer, int); +extern int _XieConvolveConstantParam (char **, XiePointer, int); +extern int _XieClipScaleParam (char **, XiePointer, int); +extern int _XieDecodeUncompressedSingleParam (char **, XiePointer, int); +extern int _XieDecodeUncompressedTripleParam (char **, XiePointer, int); +extern int _XieDecodeG31DParam (char **, XiePointer, int); +extern int _XieDecodeTIFFPackBitsParam (char **, XiePointer, int); +extern int _XieDecodeJPEGBaselineParam (char **, XiePointer, int); +extern int _XieDitherOrderedParam (char **, XiePointer, int); +extern int _XieEncodeUncompressedSingleParam (char **, XiePointer, int); +extern int _XieEncodeUncompressedTripleParam (char **, XiePointer, int); +extern int _XieEncodeG31DParam (char **, XiePointer, int); +extern int _XieEncodeTIFFPackBitsParam (char **, XiePointer, int); +extern int _XieEncodeServerChoiceParam (char **, XiePointer, int); +extern int _XieEncodeG32DParam (char **, XiePointer, int); +extern int _XieEncodeG42DParam (char **, XiePointer, int); +extern int _XieEncodeJPEGBaselineParam (char **, XiePointer, int); +extern int _XieEncodeJPEGLosslessParam (char **, XiePointer, int); +extern int _XieEncodeTIFF2Param (char **, XiePointer, int); +extern int _XieGeomAntialiasByAreaParam (char **, XiePointer, int); +extern int _XieGeomAntialiasByLowpassParam (char **, XiePointer, int); +extern int _XieGeomGaussianParam (char **, XiePointer, int); +extern int _XieGeomNearestNeighborParam (char **, XiePointer, int); +extern int _XieHistogramGaussianParam (char **, XiePointer, int); +extern int _XieHistogramHyperbolicParam (char **, XiePointer, int); +extern int _XieWhiteAdjustCIELabShiftParam (char **, XiePointer, int); + + +int +_XieTechniqueLength (int group, int technique, XiePointer param) +{ + XieTechFuncPtr techfunc = _XieLookupTechFunc (group, technique); + int length; + + if (techfunc) + length = (*techfunc) (NULL, param, 0); + else + length = 0; + + return (length); +} + + +void +_XieEncodeTechnique ( + char **bufDest, + int group, + int technique, + XiePointer param) +{ + XieTechFuncPtr techfunc = _XieLookupTechFunc (group, technique); + + if (techfunc) + (void) (*techfunc) (bufDest, param, 1); +} + + + +#define srcParam ((XieColorAllocAllParam *)srcPtr) +int +_XieColorAllocAllParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (CARD32); + + if (srcParam == NULL) + return(0); + + if (encode) + STORE_CARD32 (srcParam->fill, *bufDest); + + return (length); +} +#undef srcParam + + +#define srcParam ((XieColorAllocMatchParam *)srcPtr) +int +_XieColorAllocMatchParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecColorAllocMatch); + xieTecColorAllocMatch *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecColorAllocMatch, *bufDest, dstParam); + + dstParam->matchLimit = _XieConvertToIEEE (srcParam->match_limit); + dstParam->grayLimit = _XieConvertToIEEE (srcParam->gray_limit); + + END_TECHNIQUE (xieTecColorAllocMatch, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieColorAllocRequantizeParam *)srcPtr) +int +_XieColorAllocRequantizeParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (CARD32); + + if (srcParam == NULL) + return(0); + + if (encode) + STORE_CARD32 (srcParam->max_cells, *bufDest); + + return (length); +} +#undef srcParam + + +#define srcParam ((XieRGBToCIELabParam *)srcPtr) +int +_XieRGBToCIELabParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length, techLen; + xieTecRGBToCIELab *dstParam; + + if (srcParam == NULL) + return(0); + + techLen = _XieTechniqueLength (xieValWhiteAdjust, + srcParam->white_adjust_tech, srcParam->white_adjust_param); + + length = LENOF (xieTecRGBToCIELab) + techLen; + + if (encode) + { + BEGIN_TECHNIQUE (xieTecRGBToCIELab, *bufDest, dstParam); + + /* memcpy (dstParam->matrix00, srcParam->matrix, 36); */ + dstParam->matrix00 = _XieConvertToIEEE (srcParam->matrix[0]); + dstParam->matrix01 = _XieConvertToIEEE (srcParam->matrix[1]); + dstParam->matrix02 = _XieConvertToIEEE (srcParam->matrix[2]); + dstParam->matrix10 = _XieConvertToIEEE (srcParam->matrix[3]); + dstParam->matrix11 = _XieConvertToIEEE (srcParam->matrix[4]); + dstParam->matrix12 = _XieConvertToIEEE (srcParam->matrix[5]); + dstParam->matrix20 = _XieConvertToIEEE (srcParam->matrix[6]); + dstParam->matrix21 = _XieConvertToIEEE (srcParam->matrix[7]); + dstParam->matrix22 = _XieConvertToIEEE (srcParam->matrix[8]); + + dstParam->whiteAdjusted = srcParam->white_adjust_tech; + dstParam->lenParams = techLen; + + END_TECHNIQUE (xieTecRGBToCIELab, *bufDest, dstParam); + + _XieEncodeTechnique (bufDest, xieValWhiteAdjust, + srcParam->white_adjust_tech, srcParam->white_adjust_param); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieRGBToYCbCrParam *)srcPtr) +int +_XieRGBToYCbCrParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecRGBToYCbCr); + xieTecRGBToYCbCr *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecRGBToYCbCr, *bufDest, dstParam); + + dstParam->levels0 = srcParam->levels[0]; + dstParam->levels1 = srcParam->levels[1]; + dstParam->levels2 = srcParam->levels[2]; + dstParam->lumaRed = _XieConvertToIEEE (srcParam->luma_red); + dstParam->lumaGreen = _XieConvertToIEEE (srcParam->luma_green); + dstParam->lumaBlue = _XieConvertToIEEE (srcParam->luma_blue); + dstParam->bias0 = _XieConvertToIEEE (srcParam->bias[0]); + dstParam->bias1 = _XieConvertToIEEE (srcParam->bias[1]); + dstParam->bias2 = _XieConvertToIEEE (srcParam->bias[2]); + + END_TECHNIQUE (xieTecRGBToYCbCr, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieRGBToYCCParam *)srcPtr) +int +_XieRGBToYCCParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecRGBToYCC); + xieTecRGBToYCC *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecRGBToYCC, *bufDest, dstParam); + + dstParam->levels0 = srcParam->levels[0]; + dstParam->levels1 = srcParam->levels[1]; + dstParam->levels2 = srcParam->levels[2]; + dstParam->lumaRed = _XieConvertToIEEE (srcParam->luma_red); + dstParam->lumaGreen = _XieConvertToIEEE (srcParam->luma_green); + dstParam->lumaBlue = _XieConvertToIEEE (srcParam->luma_blue); + dstParam->scale = _XieConvertToIEEE (srcParam->scale); + + END_TECHNIQUE (xieTecRGBToYCC, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieYCbCrToRGBParam *)srcPtr) +int +_XieYCbCrToRGBParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length, gamutLen; + xieTecYCbCrToRGB *dstParam; + + if (srcParam == NULL) + return(0); + + gamutLen = _XieTechniqueLength (xieValGamut, + srcParam->gamut_tech, srcParam->gamut_param); + + length = LENOF (xieTecYCbCrToRGB) + gamutLen; + + if (encode) + { + BEGIN_TECHNIQUE (xieTecYCbCrToRGB, *bufDest, dstParam); + + dstParam->levels0 = srcParam->levels[0]; + dstParam->levels1 = srcParam->levels[1]; + dstParam->levels2 = srcParam->levels[2]; + dstParam->lumaRed = _XieConvertToIEEE (srcParam->luma_red); + dstParam->lumaGreen = _XieConvertToIEEE (srcParam->luma_green); + dstParam->lumaBlue = _XieConvertToIEEE (srcParam->luma_blue); + dstParam->bias0 = _XieConvertToIEEE (srcParam->bias[0]); + dstParam->bias1 = _XieConvertToIEEE (srcParam->bias[1]); + dstParam->bias2 = _XieConvertToIEEE (srcParam->bias[2]); + dstParam->gamutCompress = srcParam->gamut_tech; + dstParam->lenGamutParams = gamutLen; + + END_TECHNIQUE (xieTecYCbCrToRGB, *bufDest, dstParam); + + _XieEncodeTechnique (bufDest, xieValGamut, + srcParam->gamut_tech, srcParam->gamut_param); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieYCCToRGBParam *)srcPtr) +int +_XieYCCToRGBParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length, gamutLen; + xieTecYCCToRGB *dstParam; + + if (srcParam == NULL) + return(0); + + gamutLen = _XieTechniqueLength (xieValGamut, + srcParam->gamut_tech, srcParam->gamut_param); + + length = LENOF (xieTecYCCToRGB) + gamutLen; + + if (encode) + { + BEGIN_TECHNIQUE (xieTecYCCToRGB, *bufDest, dstParam); + + dstParam->levels0 = srcParam->levels[0]; + dstParam->levels1 = srcParam->levels[1]; + dstParam->levels2 = srcParam->levels[2]; + dstParam->lumaRed = _XieConvertToIEEE (srcParam->luma_red); + dstParam->lumaGreen = _XieConvertToIEEE (srcParam->luma_green); + dstParam->lumaBlue = _XieConvertToIEEE (srcParam->luma_blue); + dstParam->scale = _XieConvertToIEEE (srcParam->scale); + dstParam->gamutCompress = srcParam->gamut_tech; + dstParam->lenGamutParams = gamutLen; + + END_TECHNIQUE (xieTecYCCToRGB, *bufDest, dstParam); + + _XieEncodeTechnique (bufDest, xieValGamut, + srcParam->gamut_tech, srcParam->gamut_param); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieCIELabToRGBParam *)srcPtr) +int +_XieCIELabToRGBParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + xieTecCIELabToRGB *dstParam; + int length, whiteLen, gamutLen; + + if (srcParam == NULL) + return(0); + + whiteLen = _XieTechniqueLength (xieValWhiteAdjust, + srcParam->white_adjust_tech, srcParam->white_adjust_param); + + gamutLen = _XieTechniqueLength (xieValGamut, + srcParam->gamut_tech, srcParam->gamut_param); + + length = LENOF (xieTecCIELabToRGB) + whiteLen + gamutLen; + + if (encode) + { + BEGIN_TECHNIQUE (xieTecCIELabToRGB, *bufDest, dstParam); + + /* memcpy (dstParam->matrix00, srcParam->matrix, 36); */ + dstParam->matrix00 = _XieConvertToIEEE (srcParam->matrix[0]); + dstParam->matrix01 = _XieConvertToIEEE (srcParam->matrix[1]); + dstParam->matrix02 = _XieConvertToIEEE (srcParam->matrix[2]); + dstParam->matrix10 = _XieConvertToIEEE (srcParam->matrix[3]); + dstParam->matrix11 = _XieConvertToIEEE (srcParam->matrix[4]); + dstParam->matrix12 = _XieConvertToIEEE (srcParam->matrix[5]); + dstParam->matrix20 = _XieConvertToIEEE (srcParam->matrix[6]); + dstParam->matrix21 = _XieConvertToIEEE (srcParam->matrix[7]); + dstParam->matrix22 = _XieConvertToIEEE (srcParam->matrix[8]); + + dstParam->whiteAdjusted = srcParam->white_adjust_tech; + dstParam->lenWhiteParams = whiteLen; + dstParam->gamutCompress = srcParam->gamut_tech; + dstParam->lenGamutParams = gamutLen; + + END_TECHNIQUE (xieTecCIELabToRGB, *bufDest, dstParam); + + _XieEncodeTechnique (bufDest, xieValWhiteAdjust, + srcParam->white_adjust_tech, srcParam->white_adjust_param); + + _XieEncodeTechnique (bufDest, xieValGamut, + srcParam->gamut_tech, srcParam->gamut_param); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieConvolveConstantParam *)srcPtr) +int +_XieConvolveConstantParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + xieTecConvolveConstant *dstParam; + int length = LENOF (xieTecConvolveConstant); + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecConvolveConstant, *bufDest, dstParam); + + dstParam->constant0 = _XieConvertToIEEE (srcParam->constant[0]); + dstParam->constant1 = _XieConvertToIEEE (srcParam->constant[1]); + dstParam->constant2 = _XieConvertToIEEE (srcParam->constant[2]); + + END_TECHNIQUE (xieTecConvolveConstant, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieClipScaleParam *)srcPtr) +int +_XieClipScaleParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + xieTecClipScale *dstParam; + int length = LENOF (xieTecClipScale); + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecClipScale, *bufDest, dstParam); + + dstParam->inputLow0 = _XieConvertToIEEE (srcParam->input_low[0]); + dstParam->inputLow1 = _XieConvertToIEEE (srcParam->input_low[1]); + dstParam->inputLow2 = _XieConvertToIEEE (srcParam->input_low[2]); + dstParam->inputHigh0 = _XieConvertToIEEE (srcParam->input_high[0]); + dstParam->inputHigh1 = _XieConvertToIEEE (srcParam->input_high[1]); + dstParam->inputHigh2 = _XieConvertToIEEE (srcParam->input_high[2]); + dstParam->outputLow0 = srcParam->output_low[0]; + dstParam->outputLow1 = srcParam->output_low[1]; + dstParam->outputLow2 = srcParam->output_low[2]; + dstParam->outputHigh0 = srcParam->output_high[0]; + dstParam->outputHigh1 = srcParam->output_high[1]; + dstParam->outputHigh2 = srcParam->output_high[2]; + + END_TECHNIQUE (xieTecClipScale, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieDecodeUncompressedSingleParam *)srcPtr) +int +_XieDecodeUncompressedSingleParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecDecodeUncompressedSingle); + xieTecDecodeUncompressedSingle *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecDecodeUncompressedSingle, *bufDest, dstParam); + + dstParam->fillOrder = srcParam->fill_order; + dstParam->pixelOrder = srcParam->pixel_order; + dstParam->pixelStride = srcParam->pixel_stride; + dstParam->leftPad = srcParam->left_pad; + dstParam->scanlinePad = srcParam->scanline_pad; + + END_TECHNIQUE (xieTecDecodeUncompressedSingle, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieDecodeUncompressedTripleParam *)srcPtr) +int +_XieDecodeUncompressedTripleParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecDecodeUncompressedTriple); + xieTecDecodeUncompressedTriple *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecDecodeUncompressedTriple, *bufDest, dstParam); + + dstParam->leftPad[0] = srcParam->left_pad[0]; + dstParam->leftPad[1] = srcParam->left_pad[1]; + dstParam->leftPad[2] = srcParam->left_pad[2]; + dstParam->fillOrder = srcParam->fill_order; + dstParam->pixelStride[0] = srcParam->pixel_stride[0]; + dstParam->pixelStride[1] = srcParam->pixel_stride[1]; + dstParam->pixelStride[2] = srcParam->pixel_stride[2]; + dstParam->pixelOrder = srcParam->pixel_order; + dstParam->scanlinePad[0] = srcParam->scanline_pad[0]; + dstParam->scanlinePad[1] = srcParam->scanline_pad[1]; + dstParam->scanlinePad[2] = srcParam->scanline_pad[2]; + dstParam->bandOrder = srcParam->band_order; + dstParam->interleave = srcParam->interleave; + + END_TECHNIQUE (xieTecDecodeUncompressedTriple, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieDecodeG31DParam *)srcPtr) +int +_XieDecodeG31DParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecDecodeG31D); + xieTecDecodeG31D *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecDecodeG31D, *bufDest, dstParam); + + dstParam->encodedOrder = srcParam->encoded_order; + dstParam->normal = srcParam->normal; + dstParam->radiometric = srcParam->radiometric; + + END_TECHNIQUE (xieTecDecodeG31D, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieDecodeTIFFPackBitsParam *)srcPtr) +int +_XieDecodeTIFFPackBitsParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecDecodeTIFFPackBits); + xieTecDecodeTIFFPackBits *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecDecodeTIFFPackBits, *bufDest, dstParam); + + dstParam->encodedOrder = srcParam->encoded_order; + dstParam->normal = srcParam->normal; + + END_TECHNIQUE (xieTecDecodeTIFFPackBits, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieDecodeJPEGBaselineParam *)srcPtr) +int +_XieDecodeJPEGBaselineParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + xieTecDecodeJPEGBaseline *dstParam; + int length = LENOF (xieTecDecodeJPEGBaseline); + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecDecodeJPEGBaseline, *bufDest, dstParam); + + dstParam->interleave = srcParam->interleave; + dstParam->bandOrder = srcParam->band_order; + dstParam->upSample = srcParam->up_sample; + + END_TECHNIQUE (xieTecDecodeJPEGBaseline, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieDitherOrderedParam *)srcPtr) +int +_XieDitherOrderedParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecDitherOrdered); + xieTecDitherOrdered *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecDitherOrdered, *bufDest, dstParam); + + dstParam->thresholdOrder = srcParam->threshold_order; + + END_TECHNIQUE (xieTecDitherOrdered, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieEncodeUncompressedSingleParam *)srcPtr) +int +_XieEncodeUncompressedSingleParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecEncodeUncompressedSingle); + xieTecEncodeUncompressedSingle *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecEncodeUncompressedSingle, *bufDest, dstParam); + + dstParam->fillOrder = srcParam->fill_order; + dstParam->pixelOrder = srcParam->pixel_order; + dstParam->pixelStride = srcParam->pixel_stride; + dstParam->scanlinePad = srcParam->scanline_pad; + + END_TECHNIQUE (xieTecEncodeUncompressedSingle, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieEncodeUncompressedTripleParam *)srcPtr) +int +_XieEncodeUncompressedTripleParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecEncodeUncompressedTriple); + xieTecEncodeUncompressedTriple *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecEncodeUncompressedTriple, *bufDest, dstParam); + + dstParam->pixelStride[0] = srcParam->pixel_stride[0]; + dstParam->pixelStride[1] = srcParam->pixel_stride[1]; + dstParam->pixelStride[2] = srcParam->pixel_stride[2]; + dstParam->pixelOrder = srcParam->pixel_order; + dstParam->scanlinePad[0] = srcParam->scanline_pad[0]; + dstParam->scanlinePad[1] = srcParam->scanline_pad[1]; + dstParam->scanlinePad[2] = srcParam->scanline_pad[2]; + dstParam->fillOrder = srcParam->fill_order; + dstParam->bandOrder = srcParam->band_order; + dstParam->interleave = srcParam->interleave; + + END_TECHNIQUE (xieTecEncodeUncompressedTriple, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieEncodeG31DParam *)srcPtr) +int +_XieEncodeG31DParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecEncodeG31D); + xieTecEncodeG31D *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecEncodeG31D, *bufDest, dstParam); + + dstParam->alignEol = srcParam->align_eol; + dstParam->encodedOrder = srcParam->encoded_order; + dstParam->radiometric = srcParam->radiometric; + + END_TECHNIQUE (xieTecEncodeG31D, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieEncodeTIFFPackBitsParam *)srcPtr) +int +_XieEncodeTIFFPackBitsParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecEncodeTIFFPackBits); + xieTecEncodeTIFFPackBits *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecEncodeTIFFPackBits, *bufDest, dstParam); + + dstParam->encodedOrder = srcParam->encoded_order; + + END_TECHNIQUE (xieTecEncodeTIFFPackBits, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieEncodeServerChoiceParam *)srcPtr) +int +_XieEncodeServerChoiceParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecEncodeServerChoice); + xieTecEncodeServerChoice *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecEncodeServerChoice, *bufDest, dstParam); + + dstParam->preference = srcParam->preference; + + END_TECHNIQUE (xieTecEncodeServerChoice, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieEncodeG32DParam *)srcPtr) +int +_XieEncodeG32DParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecEncodeG32D); + xieTecEncodeG32D *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecEncodeG32D, *bufDest, dstParam); + + dstParam->uncompressed = srcParam->uncompressed; + dstParam->alignEol = srcParam->align_eol; + dstParam->encodedOrder = srcParam->encoded_order; + dstParam->kFactor = srcParam->k_factor; + dstParam->radiometric = srcParam->radiometric; + + END_TECHNIQUE (xieTecEncodeG32D, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieEncodeG42DParam *)srcPtr) +int +_XieEncodeG42DParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecEncodeG42D); + xieTecEncodeG42D *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecEncodeG42D, *bufDest, dstParam); + + dstParam->uncompressed = srcParam->uncompressed; + dstParam->encodedOrder = srcParam->encoded_order; + dstParam->radiometric = srcParam->radiometric; + + END_TECHNIQUE (xieTecEncodeG42D, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieEncodeJPEGBaselineParam *)srcPtr) +int +_XieEncodeJPEGBaselineParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecEncodeJPEGBaseline) + + ((srcParam->q_size + srcParam->ac_size + srcParam->dc_size) >> 2); + xieTecEncodeJPEGBaseline *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecEncodeJPEGBaseline, *bufDest, dstParam); + + dstParam->interleave = srcParam->interleave; + dstParam->bandOrder = srcParam->band_order; + dstParam->horizontalSamples[0] = srcParam->horizontal_samples[0]; + dstParam->horizontalSamples[1] = srcParam->horizontal_samples[1]; + dstParam->horizontalSamples[2] = srcParam->horizontal_samples[2]; + dstParam->verticalSamples[0] = srcParam->vertical_samples[0]; + dstParam->verticalSamples[1] = srcParam->vertical_samples[1]; + dstParam->verticalSamples[2] = srcParam->vertical_samples[2]; + dstParam->lenQtable = srcParam->q_size; + dstParam->lenACtable = srcParam->ac_size; + dstParam->lenDCtable = srcParam->dc_size; + + END_TECHNIQUE (xieTecEncodeJPEGBaseline, *bufDest, dstParam); + + /* + * q_size, ac_size, dc_size should be multiple of 4, + * so no need to pad. + */ + + memcpy (*bufDest, srcParam->q_table, srcParam->q_size); + *bufDest += srcParam->q_size; + memcpy (*bufDest, srcParam->ac_table, srcParam->ac_size); + *bufDest += srcParam->ac_size; + memcpy (*bufDest, srcParam->dc_table, srcParam->dc_size); + *bufDest += srcParam->dc_size; + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieEncodeJPEGLosslessParam *)srcPtr) +int +_XieEncodeJPEGLosslessParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecEncodeJPEGLossless) + + (srcParam->table_size >> 2); + xieTecEncodeJPEGLossless *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecEncodeJPEGLossless, *bufDest, dstParam); + + dstParam->interleave = srcParam->interleave; + dstParam->bandOrder = srcParam->band_order; + dstParam->lenTable = srcParam->table_size; + dstParam->predictor[0] = srcParam->predictor[0]; + dstParam->predictor[1] = srcParam->predictor[1]; + dstParam->predictor[2] = srcParam->predictor[2]; + + END_TECHNIQUE (xieTecEncodeJPEGLossless, *bufDest, dstParam); + + /* table_size should be multiple of 4, so no need to pad */ + + memcpy (*bufDest, srcParam->table, srcParam->table_size); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieEncodeTIFF2Param *)srcPtr) +int +_XieEncodeTIFF2Param ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecEncodeTIFF2); + xieTecEncodeTIFF2 *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecEncodeTIFF2, *bufDest, dstParam); + + dstParam->encodedOrder = srcParam->encoded_order; + dstParam->radiometric = srcParam->radiometric; + + END_TECHNIQUE (xieTecEncodeTIFF2, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieGeomAntialiasByAreaParam *)srcPtr) +int +_XieGeomAntialiasByAreaParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecGeomAntialiasByArea); + xieTecGeomAntialiasByArea *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecGeomAntialiasByArea, *bufDest, dstParam); + + dstParam->simple = srcParam->simple; + + END_TECHNIQUE (xieTecGeomAntialiasByArea, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieGeomAntialiasByLowpassParam *)srcPtr) +int +_XieGeomAntialiasByLowpassParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecGeomAntialiasByLowpass); + xieTecGeomAntialiasByLowpass *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecGeomAntialiasByLowpass, *bufDest, dstParam); + + dstParam->kernelSize = srcParam->kernel_size; + + END_TECHNIQUE (xieTecGeomAntialiasByLowpass, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieGeomGaussianParam *)srcPtr) +int +_XieGeomGaussianParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecGeomGaussian); + xieTecGeomGaussian *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecGeomGaussian, *bufDest, dstParam); + + dstParam->radius = srcParam->radius; + dstParam->simple = srcParam->simple; + dstParam->sigma = _XieConvertToIEEE (srcParam->sigma); + dstParam->normalize = _XieConvertToIEEE (srcParam->normalize); + + END_TECHNIQUE (xieTecGeomGaussian, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieGeomNearestNeighborParam *)srcPtr) +int +_XieGeomNearestNeighborParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + xieTecGeomNearestNeighbor *dstParam; + int length = LENOF (xieTecGeomNearestNeighbor); + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecGeomNearestNeighbor, *bufDest, dstParam); + + dstParam->modify = srcParam->modify; + + END_TECHNIQUE (xieTecGeomNearestNeighbor, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieHistogramGaussianParam *)srcPtr) +int +_XieHistogramGaussianParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecHistogramGaussian); + xieTecHistogramGaussian *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecHistogramGaussian, *bufDest, dstParam); + + dstParam->mean = _XieConvertToIEEE (srcParam->mean); + dstParam->sigma = _XieConvertToIEEE (srcParam->sigma); + + END_TECHNIQUE (xieTecHistogramGaussian, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieHistogramHyperbolicParam *)srcPtr) +int +_XieHistogramHyperbolicParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecHistogramHyperbolic); + xieTecHistogramHyperbolic *dstParam; + + if (srcParam == NULL) + return(0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecHistogramHyperbolic, *bufDest, dstParam); + + dstParam->shapeFactor = srcParam->shape_factor; + dstParam->constant = _XieConvertToIEEE (srcParam->constant); + + END_TECHNIQUE (xieTecHistogramHyperbolic, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + +#define srcParam ((XieWhiteAdjustCIELabShiftParam *)srcPtr) +int +_XieWhiteAdjustCIELabShiftParam ( + char ** bufDest, + XiePointer srcPtr, + int encode) +{ + int length = LENOF (xieTecWhiteAdjustCIELabShift); + xieTecWhiteAdjustCIELabShift *dstParam; + + if (srcParam == NULL) + return (0); + + if (encode) + { + BEGIN_TECHNIQUE (xieTecWhiteAdjustCIELabShift, *bufDest, dstParam); + + dstParam->whitePoint0 = _XieConvertToIEEE (srcParam->white_point[0]); + dstParam->whitePoint1 = _XieConvertToIEEE (srcParam->white_point[1]); + dstParam->whitePoint2 = _XieConvertToIEEE (srcParam->white_point[2]); + + END_TECHNIQUE (xieTecWhiteAdjustCIELabShift, *bufDest, dstParam); + } + + return (length); +} +#undef srcParam + + + +void _XieInitTechFuncTable (void) +{ + int i; + + for (i = 0; i < xieValMaxTechGroup; i++) + _XieTechFuncs[i] = NULL; + + + _XieRegisterTechFunc (xieValColorAlloc, + xieValColorAllocDefault, 0); + _XieRegisterTechFunc (xieValColorAlloc, + xieValColorAllocAll, _XieColorAllocAllParam); + _XieRegisterTechFunc (xieValColorAlloc, + xieValColorAllocMatch, _XieColorAllocMatchParam); + _XieRegisterTechFunc (xieValColorAlloc, + xieValColorAllocRequantize, _XieColorAllocRequantizeParam); + + _XieRegisterTechFunc (xieValConvertFromRGB, + xieValRGBToCIELab, _XieRGBToCIELabParam); + _XieRegisterTechFunc (xieValConvertFromRGB, + xieValRGBToCIEXYZ, _XieRGBToCIEXYZParam); + _XieRegisterTechFunc (xieValConvertFromRGB, + xieValRGBToYCbCr, _XieRGBToYCbCrParam); + _XieRegisterTechFunc (xieValConvertFromRGB, + xieValRGBToYCC, _XieRGBToYCCParam); + + _XieRegisterTechFunc (xieValConvertToRGB, + xieValCIELabToRGB, _XieCIELabToRGBParam); + _XieRegisterTechFunc (xieValConvertToRGB, + xieValCIEXYZToRGB, _XieCIEXYZToRGBParam); + _XieRegisterTechFunc (xieValConvertToRGB, + xieValYCbCrToRGB, _XieYCbCrToRGBParam); + _XieRegisterTechFunc (xieValConvertToRGB, + xieValYCCToRGB, _XieYCCToRGBParam); + + _XieRegisterTechFunc (xieValConstrain, + xieValConstrainClipScale, _XieClipScaleParam); + _XieRegisterTechFunc (xieValConstrain, + xieValConstrainHardClip, 0); + + _XieRegisterTechFunc (xieValConvolve, + xieValConvolveDefault, 0); + _XieRegisterTechFunc (xieValConvolve, + xieValConvolveConstant, _XieConvolveConstantParam); + _XieRegisterTechFunc (xieValConvolve, + xieValConvolveReplicate, 0); + + _XieRegisterTechFunc (xieValDecode, + xieValDecodeUncompressedSingle, _XieDecodeUncompressedSingleParam); + _XieRegisterTechFunc (xieValDecode, + xieValDecodeUncompressedTriple, _XieDecodeUncompressedTripleParam); + _XieRegisterTechFunc (xieValDecode, + xieValDecodeG31D, _XieDecodeG31DParam); + _XieRegisterTechFunc (xieValDecode, + xieValDecodeG32D, _XieDecodeG32DParam); + _XieRegisterTechFunc (xieValDecode, + xieValDecodeG42D, _XieDecodeG42DParam); + _XieRegisterTechFunc (xieValDecode, + xieValDecodeJPEGBaseline, _XieDecodeJPEGBaselineParam); + _XieRegisterTechFunc (xieValDecode, + xieValDecodeJPEGLossless, _XieDecodeJPEGLosslessParam); + _XieRegisterTechFunc (xieValDecode, + xieValDecodeTIFF2, _XieDecodeTIFF2Param); + _XieRegisterTechFunc (xieValDecode, + xieValDecodeTIFFPackBits, _XieDecodeTIFFPackBitsParam); + + _XieRegisterTechFunc (xieValDither, + xieValDitherDefault, 0); + _XieRegisterTechFunc (xieValDither, + xieValDitherErrorDiffusion, 0); + _XieRegisterTechFunc (xieValDither, + xieValDitherOrdered, _XieDitherOrderedParam); + +/* + _XieRegisterTechFunc (xieValEncode, + xieValEncodeServerChoice, 0); +*/ + _XieRegisterTechFunc (xieValEncode, + xieValEncodeServerChoice, _XieEncodeServerChoiceParam); + _XieRegisterTechFunc (xieValEncode, + xieValEncodeUncompressedSingle, _XieEncodeUncompressedSingleParam); + _XieRegisterTechFunc (xieValEncode, + xieValEncodeUncompressedTriple, _XieEncodeUncompressedTripleParam); + _XieRegisterTechFunc (xieValEncode, + xieValEncodeG31D, _XieEncodeG31DParam); + _XieRegisterTechFunc (xieValEncode, + xieValEncodeG32D, _XieEncodeG32DParam); + _XieRegisterTechFunc (xieValEncode, + xieValEncodeG42D, _XieEncodeG42DParam); + _XieRegisterTechFunc (xieValEncode, + xieValEncodeJPEGBaseline, _XieEncodeJPEGBaselineParam); + _XieRegisterTechFunc (xieValEncode, + xieValEncodeJPEGLossless, _XieEncodeJPEGLosslessParam); + _XieRegisterTechFunc (xieValEncode, + xieValEncodeTIFF2, _XieEncodeTIFF2Param); + _XieRegisterTechFunc (xieValEncode, + xieValEncodeTIFFPackBits, _XieEncodeTIFFPackBitsParam); + + _XieRegisterTechFunc (xieValGamut, + xieValGamutDefault, 0); + _XieRegisterTechFunc (xieValGamut, + xieValGamutNone, 0); + _XieRegisterTechFunc (xieValGamut, + xieValGamutClipRGB, 0); + + _XieRegisterTechFunc (xieValGeometry, + xieValGeomDefault, 0); + _XieRegisterTechFunc (xieValGeometry, + xieValGeomAntialias, 0); + _XieRegisterTechFunc (xieValGeometry, + xieValGeomAntialiasByArea, _XieGeomAntialiasByAreaParam); + _XieRegisterTechFunc (xieValGeometry, + xieValGeomAntialiasByLPF, _XieGeomAntialiasByLowpassParam); + _XieRegisterTechFunc (xieValGeometry, + xieValGeomBilinearInterp, 0); + _XieRegisterTechFunc (xieValGeometry, + xieValGeomGaussian, _XieGeomGaussianParam); + _XieRegisterTechFunc (xieValGeometry, + xieValGeomNearestNeighbor, _XieGeomNearestNeighborParam); + + _XieRegisterTechFunc (xieValHistogram, + xieValHistogramFlat, 0); + _XieRegisterTechFunc (xieValHistogram, + xieValHistogramGaussian, _XieHistogramGaussianParam); + _XieRegisterTechFunc (xieValHistogram, + xieValHistogramHyperbolic, _XieHistogramHyperbolicParam); + + _XieRegisterTechFunc (xieValWhiteAdjust, + xieValWhiteAdjustDefault, 0); + _XieRegisterTechFunc (xieValWhiteAdjust, + xieValWhiteAdjustNone, 0); + _XieRegisterTechFunc (xieValWhiteAdjust, + xieValWhiteAdjustCIELabShift, _XieWhiteAdjustCIELabShiftParam); +} diff --git a/xc/lib/XIE/technique.h b/xc/lib/XIE/technique.h new file mode 100644 index 000000000..163ce6af8 --- /dev/null +++ b/xc/lib/XIE/technique.h @@ -0,0 +1,81 @@ +/* $TOG: technique.h /main/5 1998/02/06 15:13:09 kaleb $ */ + +/* + +Copyright 1993, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifndef WORD64 + +#define BEGIN_TECHNIQUE(_name, _bufDest, _dstParam) \ + _dstParam = (_name *) _bufDest; + +#define END_TECHNIQUE(_name, _bufDest, _dstParam) \ + _bufDest += SIZEOF (_name); + +#else /* WORD64 */ + +#define BEGIN_TECHNIQUE(_name, _bufDest, _dstParam) \ +{ \ + _name tParam; \ + _dstParam = &tParam; + +#define END_TECHNIQUE(_name, _bufDest, _dstParam) \ + memcpy (_bufDest, _dstParam, SIZEOF (_name)); \ + _bufDest += SIZEOF (_name); \ +} + +#endif /* WORD64 */ + + + +#ifndef WORD64 + +#define STORE_CARD32(_val, _pBuf) \ +{ \ + *((CARD32 *) _pBuf) = _val; \ + _pBuf += SIZEOF (CARD32); \ +} + +#else /* WORD64 */ + +typedef struct { + int value :32; +} Long; + +#define STORE_CARD32(_val, _pBuf) \ +{ \ + Long _d; \ + _d.value = _val; \ + memcpy (_pBuf, &_d, SIZEOF (CARD32)); \ + _pBuf += SIZEOF (CARD32); \ +} + +#endif /* WORD64 */ + + +#define _XieRGBToCIEXYZParam _XieRGBToCIELabParam +#define _XieCIEXYZToRGBParam _XieCIELabToRGBParam +#define _XieDecodeG32DParam _XieDecodeG31DParam +#define _XieDecodeG42DParam _XieDecodeG31DParam +#define _XieDecodeTIFF2Param _XieDecodeG31DParam +#define _XieDecodeJPEGLosslessParam _XieDecodeJPEGBaselineParam diff --git a/xc/lib/XIE/utils.c b/xc/lib/XIE/utils.c new file mode 100644 index 000000000..dfd24be10 --- /dev/null +++ b/xc/lib/XIE/utils.c @@ -0,0 +1,105 @@ +/* $TOG: utils.c /main/4 1998/04/30 14:40:10 kaleb $ */ + +/* + +Copyright 1993, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/lib/XIE/utils.c,v 1.3 1999/06/13 16:18:12 dawes Exp $ */ + +#include "XIElibint.h" + + +Status +_XieRegisterTechFunc (int group, int technique, XieTechFuncPtr techfunc) +{ + XieTechFuncRec *ptr = _XieTechFuncs[group - 1]; + XieTechFuncRec *prev = NULL, *newrec; + int status = 1; + + newrec = (XieTechFuncRec *) Xmalloc (sizeof (XieTechFuncRec)); + newrec->technique = technique; + newrec->techfunc = techfunc; + + if (ptr == NULL) + { + _XieTechFuncs[group - 1] = newrec; + newrec->next = NULL; + } + else + { + while (ptr && ptr->technique < technique) + { + prev = ptr; + ptr = ptr->next; + } + + if (ptr == NULL) + { + prev->next = newrec; + newrec->next = NULL; + } + else + { + if (ptr->technique == technique) + { + Xfree ((char *) newrec); + status = 0; + } + else if (prev == NULL) + { + newrec->next = _XieTechFuncs[group - 1]; + _XieTechFuncs[group - 1] = newrec; + } + else + { + newrec->next = prev->next; + prev->next = newrec; + } + } + } + + return (status); +} + + + +XieTechFuncPtr +_XieLookupTechFunc (int group, int technique) +{ + XieTechFuncRec *ptr = _XieTechFuncs[group - 1]; + int found = 0; + + while (ptr && !found) + { + if (ptr->technique == technique) + found = 1; + else + ptr = ptr->next; + } + + if (found) + return (ptr->techfunc); + else + return (NULL); +} + + |