mirror of https://github.com/GNOME/gimp.git
plug-ins/depthmerge.c plug-ins/fli.[ch] updates from the registry
* plug-ins/depthmerge.c * plug-ins/fli.[ch] * plug-ins/gfli.c: updates from the registry * plug-ins/pnm/pnm.c: fix for non-interactive mode * plug-ins/fractaltrace/fractaltrace.c: minor code cleanups -Yosh
This commit is contained in:
parent
72848df01f
commit
2ada61e007
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
|||
Mon Aug 24 09:34:37 PDT 1998 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* plug-ins/depthmerge.c
|
||||
* plug-ins/fli.[ch]
|
||||
* plug-ins/gfli.c: updates from the registry
|
||||
|
||||
* plug-ins/pnm/pnm.c: fix for non-interactive mode
|
||||
|
||||
* plug-ins/fractaltrace/fractaltrace.c: minor code cleanups
|
||||
|
||||
Mon Aug 24 09:20:38 PDT 1998 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* configure.in: make xdelta not built by default, so poor users
|
||||
aren't confused
|
||||
|
||||
* libgimp/gimp.c
|
||||
* app/blob.c
|
||||
* app/errors.c
|
||||
* plug-ins/script-fu/script-fu-server.c: fixes for glib changes with
|
||||
s/g_debug/g_on_error_debug/ and s/g_vsprintf/g_strdup_vprintf/
|
||||
|
||||
Fri Aug 21 17:25:34 CDT 1998 Larry Ewing <lewing@gimp.org>
|
||||
|
||||
* app/fileops.c: fixed a lingering bug that occured from the
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
/* TODO:
|
||||
* - Debug
|
||||
* - Clean up source
|
||||
* - Package, distribute
|
||||
*/
|
||||
|
||||
/* Depth Merge -- Combine two image layers via corresponding depth maps
|
||||
* Copyright (C) 1997 Sean Cier (scier@cmu.edu)
|
||||
* Copyright (C) 1997, 1998 Sean Cier (scier@PostHorizon.com)
|
||||
*
|
||||
* A plug-in for The GIMP
|
||||
* The GIMP is Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
|
@ -21,13 +15,16 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
/* Version 0.1: (6 July 1997)
|
||||
/* Version 1.0.0: (14 August 1998)
|
||||
* Math optimizations, miscellaneous speedups
|
||||
*
|
||||
* Version 0.1: (6 July 1997)
|
||||
* Initial Release
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "gtk/gtk.h"
|
||||
#include "libgimp/gimp.h"
|
||||
#include "libgimp/gimpui.h"
|
||||
|
@ -39,10 +36,12 @@
|
|||
#define LERP(frac,a,b) ((frac)*(b) + (1-(frac))*(a))
|
||||
#endif
|
||||
|
||||
#define MUL255(i) ((i)*256 - (i))
|
||||
#define DIV255(i) (((i) + (i)/256 + 1) / 256)
|
||||
|
||||
#define PLUG_IN_NAME "plug_in_depth_merge"
|
||||
#define PLUG_IN_TITLE "Depth Merge"
|
||||
#define PLUG_IN_VERSION "0.1; 6 July 1997"
|
||||
#define PLUG_IN_VERSION "1.0.0; 14 August 1998"
|
||||
|
||||
#define PREVIEW_SIZE 256
|
||||
#define SCALE_WIDTH 200
|
||||
|
@ -493,22 +492,22 @@ void DepthMerge_executeRegion(DepthMerge *dm,
|
|||
guchar *source1Row, guchar *source2Row,
|
||||
guchar *depthMap1Row, guchar *depthMap2Row,
|
||||
guchar *resultRow, gint length) {
|
||||
float scale1, scale2, offset, invOverlap;
|
||||
float scale1, scale2, offset255, invOverlap255;
|
||||
float frac, depth1, depth2;
|
||||
unsigned short c1[4], c2[4], cR1[4], cR2[4], cR[4], temp;
|
||||
int i, tempInt;
|
||||
|
||||
invOverlap = 1.0 / MAX(dm->params.overlap, 0.001);
|
||||
offset = dm->params.offset;
|
||||
scale1 = dm->params.scale1;
|
||||
scale2 = dm->params.scale2;
|
||||
invOverlap255 = 1.0 / (MAX(dm->params.overlap, 0.001)*255);
|
||||
offset255 = dm->params.offset * 255;
|
||||
scale1 = dm->params.scale1;
|
||||
scale2 = dm->params.scale2;
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
depth1 = depthMap1Row[i] * (1.0/255.0);
|
||||
depth2 = depthMap2Row[i] * (1.0/255.0);
|
||||
depth1 = (float)depthMap1Row[i];
|
||||
depth2 = (float)depthMap2Row[i];
|
||||
|
||||
frac = (depth2*scale2 - (depth1*scale1 + offset)) * invOverlap;
|
||||
frac = (frac+1.0)/2.0;
|
||||
frac = (depth2*scale2 - (depth1*scale1 + offset255)) * invOverlap255;
|
||||
frac = 0.5 * (frac+1.0);
|
||||
frac = CLAMP(frac, 0.0, 1.0);
|
||||
|
||||
/* c1 -> color corresponding to source1 */
|
||||
|
@ -525,18 +524,18 @@ void DepthMerge_executeRegion(DepthMerge *dm,
|
|||
|
||||
if (frac != 0) {
|
||||
/* cR1 -> result if c1 is completely on top */
|
||||
cR1[0] = c1[3]*c1[0] + (255-c1[3])*c2[0];
|
||||
cR1[1] = c1[3]*c1[1] + (255-c1[3])*c2[1];
|
||||
cR1[2] = c1[3]*c1[2] + (255-c1[3])*c2[2];
|
||||
cR1[3] = 255 *c1[3] + (255-c1[3])*c2[3];
|
||||
cR1[0] = c1[3]*c1[0] + (255-c1[3])*c2[0];
|
||||
cR1[1] = c1[3]*c1[1] + (255-c1[3])*c2[1];
|
||||
cR1[2] = c1[3]*c1[2] + (255-c1[3])*c2[2];
|
||||
cR1[3] = MUL255(c1[3]) + (255-c1[3])*c2[3];
|
||||
}
|
||||
|
||||
if (frac != 1) {
|
||||
/* cR2 -> result if c2 is completely on top */
|
||||
cR2[0] = c2[3]*c2[0] + (255-c2[3])*c1[0];
|
||||
cR2[1] = c2[3]*c2[1] + (255-c2[3])*c1[1];
|
||||
cR2[2] = c2[3]*c2[2] + (255-c2[3])*c1[2];
|
||||
cR2[3] = 255 *c2[3] + (255-c2[3])*c1[3];
|
||||
cR2[0] = c2[3]*c2[0] + (255-c2[3])*c1[0];
|
||||
cR2[1] = c2[3]*c2[1] + (255-c2[3])*c1[1];
|
||||
cR2[2] = c2[3]*c2[2] + (255-c2[3])*c1[2];
|
||||
cR2[3] = MUL255(c2[3]) + (255-c2[3])*c1[3];
|
||||
}
|
||||
|
||||
if (frac == 1) {
|
||||
|
@ -556,10 +555,10 @@ void DepthMerge_executeRegion(DepthMerge *dm,
|
|||
tempInt = LERP(frac, cR2[3], cR1[3]); cR[3] = CLAMP(tempInt,0,255*255);
|
||||
}
|
||||
|
||||
temp = cR[0]/255; resultRow[4*i ] = CLAMP(temp, 0, 255);
|
||||
temp = cR[1]/255; resultRow[4*i+1] = CLAMP(temp, 0, 255);
|
||||
temp = cR[2]/255; resultRow[4*i+2] = CLAMP(temp, 0, 255);
|
||||
temp = cR[3]/255; resultRow[4*i+3] = CLAMP(temp, 0, 255);
|
||||
temp = DIV255(cR[0]); resultRow[4*i ] = MIN(temp, 255);
|
||||
temp = DIV255(cR[1]); resultRow[4*i+1] = MIN(temp, 255);
|
||||
temp = DIV255(cR[2]); resultRow[4*i+2] = MIN(temp, 255);
|
||||
temp = DIV255(cR[3]); resultRow[4*i+3] = MIN(temp, 255);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -892,7 +891,7 @@ void DepthMerge_buildPreviewSourceImage(DepthMerge *dm) {
|
|||
}
|
||||
|
||||
void DepthMerge_updatePreview(DepthMerge *dm) {
|
||||
int x, y;
|
||||
int x, y, i;
|
||||
guchar *source1Row, *source2Row, *depthMap1Row, *depthMap2Row,
|
||||
*resultRowRGBA, *resultRow,
|
||||
*checkRow;
|
||||
|
@ -921,15 +920,15 @@ void DepthMerge_updatePreview(DepthMerge *dm) {
|
|||
resultRowRGBA,
|
||||
dm->interface->previewWidth);
|
||||
for (x = 0; x < dm->interface->previewWidth; x++) {
|
||||
resultRow[x*3 ] =
|
||||
((int)( resultRowRGBA[x*4+3])*(int)resultRowRGBA[x*4 ] +
|
||||
(int)(255 - resultRowRGBA[x*4+3])*(int)checkRow[x] ) / 255;
|
||||
resultRow[x*3+1] =
|
||||
((int)( resultRowRGBA[x*4+3])*(int)resultRowRGBA[x*4+1] +
|
||||
(int)(255 - resultRowRGBA[x*4+3])*(int)checkRow[x] ) / 255;
|
||||
resultRow[x*3+2] =
|
||||
((int)( resultRowRGBA[x*4+3])*(int)resultRowRGBA[x*4+2] +
|
||||
(int)(255 - resultRowRGBA[x*4+3])*(int)checkRow[x] ) / 255;
|
||||
i = ((int)( resultRowRGBA[x*4+3])*(int)resultRowRGBA[x*4 ] +
|
||||
(int)(255 - resultRowRGBA[x*4+3])*(int)checkRow[x] );
|
||||
resultRow[x*3 ] = DIV255(i);
|
||||
i = ((int)( resultRowRGBA[x*4+3])*(int)resultRowRGBA[x*4+1] +
|
||||
(int)(255 - resultRowRGBA[x*4+3])*(int)checkRow[x] );
|
||||
resultRow[x*3+1] = DIV255(i);
|
||||
i = ((int)( resultRowRGBA[x*4+3])*(int)resultRowRGBA[x*4+2] +
|
||||
(int)(255 - resultRowRGBA[x*4+3])*(int)checkRow[x] );
|
||||
resultRow[x*3+2] = DIV255(i);
|
||||
}
|
||||
gtk_preview_draw_row(GTK_PREVIEW(dm->interface->preview), resultRow, 0, y,
|
||||
dm->interface->previewWidth);
|
||||
|
@ -1110,8 +1109,10 @@ void util_fillReducedBuffer(guchar *dest, gint destWidth, gint destHeight,
|
|||
gint x0, gint y0,
|
||||
gint sourceWidth, gint sourceHeight) {
|
||||
GPixelRgn rgn;
|
||||
guchar *rowBuffer, *reducedRowBuffer;
|
||||
int x, y, xPrime, yPrime, sourceHasAlpha;
|
||||
guchar *sourceBuffer, *reducedRowBuffer,
|
||||
*sourceBufferRow, *sourceBufferPos, *reducedRowBufferPos;
|
||||
int x, y, i, yPrime, sourceHasAlpha, sourceBpp;
|
||||
int *sourceRowOffsetLookup;
|
||||
|
||||
if ((sourceDrawable == NULL) || (sourceWidth == 0) || (sourceHeight == 0)) {
|
||||
for (x = 0; x < destWidth*destHeight*destBPP; x++)
|
||||
|
@ -1119,29 +1120,41 @@ void util_fillReducedBuffer(guchar *dest, gint destWidth, gint destHeight,
|
|||
return;
|
||||
}
|
||||
|
||||
rowBuffer = (guchar *)g_malloc(sourceWidth * sourceDrawable->bpp);
|
||||
reducedRowBuffer = (guchar *)g_malloc(destWidth * sourceDrawable->bpp);
|
||||
sourceBpp = sourceDrawable->bpp;
|
||||
|
||||
sourceBuffer = (guchar *)g_malloc(sourceWidth * sourceHeight *
|
||||
sourceBpp);
|
||||
reducedRowBuffer = (guchar *)g_malloc(destWidth * sourceBpp);
|
||||
sourceRowOffsetLookup = (int *)g_malloc(destWidth * sizeof(int));
|
||||
gimp_pixel_rgn_init(&rgn, sourceDrawable, x0, y0, sourceWidth, sourceHeight,
|
||||
FALSE, FALSE);
|
||||
sourceHasAlpha = gimp_drawable_has_alpha(sourceDrawable->id);
|
||||
|
||||
for (x = 0; x < destWidth; x++)
|
||||
sourceRowOffsetLookup[x] = (x*(sourceWidth-1)/(destWidth-1))*sourceBpp;
|
||||
|
||||
gimp_pixel_rgn_get_rect(&rgn, sourceBuffer,
|
||||
x0, y0, sourceWidth, sourceHeight);
|
||||
|
||||
for (y = 0; y < destHeight; y++) {
|
||||
yPrime = y*(sourceHeight-1)/(destHeight-1);
|
||||
gimp_pixel_rgn_get_row(&rgn, rowBuffer, x0, yPrime+y0,
|
||||
sourceWidth);
|
||||
sourceBufferRow = &(sourceBuffer[yPrime * sourceWidth * sourceBpp]);
|
||||
sourceBufferPos = sourceBufferRow;
|
||||
reducedRowBufferPos = reducedRowBuffer;
|
||||
for (x = 0; x < destWidth; x++) {
|
||||
xPrime = x*(sourceWidth-1)/(destWidth-1);
|
||||
memcpy(&(reducedRowBuffer[x *sourceDrawable->bpp]),
|
||||
&(rowBuffer[ xPrime*sourceDrawable->bpp]),
|
||||
sourceDrawable->bpp);
|
||||
sourceBufferPos = sourceBufferRow + sourceRowOffsetLookup[x];
|
||||
for (i = 0; i < sourceBpp; i++)
|
||||
reducedRowBufferPos[i] = sourceBufferPos[i];
|
||||
reducedRowBufferPos += sourceBpp;
|
||||
}
|
||||
util_convertColorspace(&(dest[y*destWidth*destBPP]), destBPP, destHasAlpha,
|
||||
reducedRowBuffer, sourceDrawable->bpp, sourceHasAlpha,
|
||||
destWidth);
|
||||
}
|
||||
|
||||
g_free(rowBuffer);
|
||||
g_free(sourceBuffer);
|
||||
g_free(reducedRowBuffer);
|
||||
g_free(sourceRowOffsetLookup);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1153,7 +1166,7 @@ void util_convertColorspace(guchar *dest,
|
|||
guchar *source,
|
||||
gint sourceBPP, gint sourceHasAlpha,
|
||||
gint length) {
|
||||
int i, j, accum;
|
||||
int i, j, sourcePos, destPos, accum;
|
||||
int sourceColorBPP = sourceHasAlpha ? (sourceBPP-1) : sourceBPP;
|
||||
int destColorBPP = destHasAlpha ? (destBPP -1) : destBPP;
|
||||
|
||||
|
@ -1163,48 +1176,63 @@ void util_convertColorspace(guchar *dest,
|
|||
|
||||
if ((sourceColorBPP == destColorBPP) &&
|
||||
(sourceBPP == destBPP )) {
|
||||
memcpy(dest, source, length*sourceBPP);
|
||||
j = length*sourceBPP;
|
||||
for (i = 0; i < j; i++) dest[i] = source[i];
|
||||
return;
|
||||
}
|
||||
|
||||
if (sourceColorBPP == 1) {
|
||||
/* Duplicate single "gray" source byte across all dest bytes */
|
||||
for (i = 0; i < length; i++) {
|
||||
if (sourceColorBPP == destColorBPP) {
|
||||
for (i = destPos = sourcePos = 0; i < length;
|
||||
i++, destPos += destBPP, sourcePos += sourceBPP) {
|
||||
for (j = 0; j < destColorBPP; j++)
|
||||
dest[i*destBPP + j] = source[i*sourceBPP];
|
||||
dest[destPos + j] = source[sourcePos + j];
|
||||
}
|
||||
} else if (sourceColorBPP == 1) {
|
||||
/* Duplicate single "gray" source byte across all dest bytes */
|
||||
for (i = destPos = sourcePos = 0; i < length;
|
||||
i++, destPos += destBPP, sourcePos += sourceBPP) {
|
||||
for (j = 0; j < destColorBPP; j++)
|
||||
dest[destPos + j] = source[sourcePos];
|
||||
}
|
||||
} else if (destColorBPP == 1) {
|
||||
/* Average all source bytes into single "gray" dest byte */
|
||||
for (i = 0; i < length; i++) {
|
||||
for (i = destPos = sourcePos = 0; i < length;
|
||||
i++, destPos += destBPP, sourcePos += sourceBPP) {
|
||||
accum = 0;
|
||||
for (j = 0; j < sourceColorBPP; j++)
|
||||
accum += source[i*sourceBPP + j];
|
||||
dest[i*destBPP] = accum/sourceColorBPP;
|
||||
accum += source[sourcePos + j];
|
||||
dest[destPos] = accum/sourceColorBPP;
|
||||
}
|
||||
} else if (destColorBPP < sourceColorBPP) {
|
||||
/* Copy as many corresponding bytes from source to dest as will fit */
|
||||
for (i = 0; i < length; i++) {
|
||||
for (i = destPos = sourcePos = 0; i < length;
|
||||
i++, destPos += destBPP, sourcePos += sourceBPP) {
|
||||
for (j = 0; j < destColorBPP; j++)
|
||||
dest[i*destBPP + j] = source[i*sourceBPP + j];
|
||||
dest[destPos + j] = source[sourcePos + j];
|
||||
}
|
||||
} else /* destColorBPP > sourceColorBPP */ {
|
||||
/* Fill extra dest bytes with zero */
|
||||
for (i = 0; i < length; i++) {
|
||||
for (i = destPos = sourcePos = 0; i < length;
|
||||
i++, destPos += destBPP, sourcePos += sourceBPP) {
|
||||
for (j = 0; j < sourceColorBPP; j++)
|
||||
dest[i*destBPP + j] = source[i*sourceBPP + j];
|
||||
dest[destPos + j] = source[destPos + j];
|
||||
for ( ; j < destColorBPP; j++)
|
||||
dest[i*destBPP + j] = 0;
|
||||
dest[destPos + j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (destHasAlpha) {
|
||||
if (sourceHasAlpha)
|
||||
for (i = 0; i < length; i++)
|
||||
dest[i*destBPP + destColorBPP] =
|
||||
source[i*sourceBPP + sourceColorBPP];
|
||||
else
|
||||
for (i = 0; i < length; i++)
|
||||
dest[i*destBPP + destColorBPP] =
|
||||
255;
|
||||
if (sourceHasAlpha) {
|
||||
for (i = 0, destPos = destColorBPP, sourcePos = sourceColorBPP;
|
||||
i < length;
|
||||
i++, destPos += destBPP, sourcePos += sourceBPP) {
|
||||
for (i = 0; i < length; i++)
|
||||
dest[destPos] = source[sourcePos];
|
||||
}
|
||||
} else {
|
||||
for (i = 0, destPos = destColorBPP; i < length; i++, destPos += destBPP) {
|
||||
dest[destPos] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -676,17 +676,6 @@ static void dialog_preview_init( void )
|
|||
}
|
||||
}
|
||||
|
||||
static void dialog_preview_free( void )
|
||||
{
|
||||
gint y;
|
||||
for( y = 0; y < preview.height; y++ ){
|
||||
free( preview.source[y] );
|
||||
free( preview.pixels[y] );
|
||||
}
|
||||
free( preview.source );
|
||||
free( preview.pixels );
|
||||
}
|
||||
|
||||
static void dialog_preview_draw( void )
|
||||
{
|
||||
gint x, y;
|
||||
|
|
|
@ -297,7 +297,7 @@ run (char *name,
|
|||
|
||||
case RUN_NONINTERACTIVE:
|
||||
/* Make sure all the arguments are there! */
|
||||
if (nparams != 5)
|
||||
if (nparams != 6)
|
||||
status = STATUS_CALLING_ERROR;
|
||||
if (status == STATUS_SUCCESS)
|
||||
{
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
/* TODO:
|
||||
* - Debug
|
||||
* - Clean up source
|
||||
* - Package, distribute
|
||||
*/
|
||||
|
||||
/* Depth Merge -- Combine two image layers via corresponding depth maps
|
||||
* Copyright (C) 1997 Sean Cier (scier@cmu.edu)
|
||||
* Copyright (C) 1997, 1998 Sean Cier (scier@PostHorizon.com)
|
||||
*
|
||||
* A plug-in for The GIMP
|
||||
* The GIMP is Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
|
@ -21,13 +15,16 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
/* Version 0.1: (6 July 1997)
|
||||
/* Version 1.0.0: (14 August 1998)
|
||||
* Math optimizations, miscellaneous speedups
|
||||
*
|
||||
* Version 0.1: (6 July 1997)
|
||||
* Initial Release
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "gtk/gtk.h"
|
||||
#include "libgimp/gimp.h"
|
||||
#include "libgimp/gimpui.h"
|
||||
|
@ -39,10 +36,12 @@
|
|||
#define LERP(frac,a,b) ((frac)*(b) + (1-(frac))*(a))
|
||||
#endif
|
||||
|
||||
#define MUL255(i) ((i)*256 - (i))
|
||||
#define DIV255(i) (((i) + (i)/256 + 1) / 256)
|
||||
|
||||
#define PLUG_IN_NAME "plug_in_depth_merge"
|
||||
#define PLUG_IN_TITLE "Depth Merge"
|
||||
#define PLUG_IN_VERSION "0.1; 6 July 1997"
|
||||
#define PLUG_IN_VERSION "1.0.0; 14 August 1998"
|
||||
|
||||
#define PREVIEW_SIZE 256
|
||||
#define SCALE_WIDTH 200
|
||||
|
@ -493,22 +492,22 @@ void DepthMerge_executeRegion(DepthMerge *dm,
|
|||
guchar *source1Row, guchar *source2Row,
|
||||
guchar *depthMap1Row, guchar *depthMap2Row,
|
||||
guchar *resultRow, gint length) {
|
||||
float scale1, scale2, offset, invOverlap;
|
||||
float scale1, scale2, offset255, invOverlap255;
|
||||
float frac, depth1, depth2;
|
||||
unsigned short c1[4], c2[4], cR1[4], cR2[4], cR[4], temp;
|
||||
int i, tempInt;
|
||||
|
||||
invOverlap = 1.0 / MAX(dm->params.overlap, 0.001);
|
||||
offset = dm->params.offset;
|
||||
scale1 = dm->params.scale1;
|
||||
scale2 = dm->params.scale2;
|
||||
invOverlap255 = 1.0 / (MAX(dm->params.overlap, 0.001)*255);
|
||||
offset255 = dm->params.offset * 255;
|
||||
scale1 = dm->params.scale1;
|
||||
scale2 = dm->params.scale2;
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
depth1 = depthMap1Row[i] * (1.0/255.0);
|
||||
depth2 = depthMap2Row[i] * (1.0/255.0);
|
||||
depth1 = (float)depthMap1Row[i];
|
||||
depth2 = (float)depthMap2Row[i];
|
||||
|
||||
frac = (depth2*scale2 - (depth1*scale1 + offset)) * invOverlap;
|
||||
frac = (frac+1.0)/2.0;
|
||||
frac = (depth2*scale2 - (depth1*scale1 + offset255)) * invOverlap255;
|
||||
frac = 0.5 * (frac+1.0);
|
||||
frac = CLAMP(frac, 0.0, 1.0);
|
||||
|
||||
/* c1 -> color corresponding to source1 */
|
||||
|
@ -525,18 +524,18 @@ void DepthMerge_executeRegion(DepthMerge *dm,
|
|||
|
||||
if (frac != 0) {
|
||||
/* cR1 -> result if c1 is completely on top */
|
||||
cR1[0] = c1[3]*c1[0] + (255-c1[3])*c2[0];
|
||||
cR1[1] = c1[3]*c1[1] + (255-c1[3])*c2[1];
|
||||
cR1[2] = c1[3]*c1[2] + (255-c1[3])*c2[2];
|
||||
cR1[3] = 255 *c1[3] + (255-c1[3])*c2[3];
|
||||
cR1[0] = c1[3]*c1[0] + (255-c1[3])*c2[0];
|
||||
cR1[1] = c1[3]*c1[1] + (255-c1[3])*c2[1];
|
||||
cR1[2] = c1[3]*c1[2] + (255-c1[3])*c2[2];
|
||||
cR1[3] = MUL255(c1[3]) + (255-c1[3])*c2[3];
|
||||
}
|
||||
|
||||
if (frac != 1) {
|
||||
/* cR2 -> result if c2 is completely on top */
|
||||
cR2[0] = c2[3]*c2[0] + (255-c2[3])*c1[0];
|
||||
cR2[1] = c2[3]*c2[1] + (255-c2[3])*c1[1];
|
||||
cR2[2] = c2[3]*c2[2] + (255-c2[3])*c1[2];
|
||||
cR2[3] = 255 *c2[3] + (255-c2[3])*c1[3];
|
||||
cR2[0] = c2[3]*c2[0] + (255-c2[3])*c1[0];
|
||||
cR2[1] = c2[3]*c2[1] + (255-c2[3])*c1[1];
|
||||
cR2[2] = c2[3]*c2[2] + (255-c2[3])*c1[2];
|
||||
cR2[3] = MUL255(c2[3]) + (255-c2[3])*c1[3];
|
||||
}
|
||||
|
||||
if (frac == 1) {
|
||||
|
@ -556,10 +555,10 @@ void DepthMerge_executeRegion(DepthMerge *dm,
|
|||
tempInt = LERP(frac, cR2[3], cR1[3]); cR[3] = CLAMP(tempInt,0,255*255);
|
||||
}
|
||||
|
||||
temp = cR[0]/255; resultRow[4*i ] = CLAMP(temp, 0, 255);
|
||||
temp = cR[1]/255; resultRow[4*i+1] = CLAMP(temp, 0, 255);
|
||||
temp = cR[2]/255; resultRow[4*i+2] = CLAMP(temp, 0, 255);
|
||||
temp = cR[3]/255; resultRow[4*i+3] = CLAMP(temp, 0, 255);
|
||||
temp = DIV255(cR[0]); resultRow[4*i ] = MIN(temp, 255);
|
||||
temp = DIV255(cR[1]); resultRow[4*i+1] = MIN(temp, 255);
|
||||
temp = DIV255(cR[2]); resultRow[4*i+2] = MIN(temp, 255);
|
||||
temp = DIV255(cR[3]); resultRow[4*i+3] = MIN(temp, 255);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -892,7 +891,7 @@ void DepthMerge_buildPreviewSourceImage(DepthMerge *dm) {
|
|||
}
|
||||
|
||||
void DepthMerge_updatePreview(DepthMerge *dm) {
|
||||
int x, y;
|
||||
int x, y, i;
|
||||
guchar *source1Row, *source2Row, *depthMap1Row, *depthMap2Row,
|
||||
*resultRowRGBA, *resultRow,
|
||||
*checkRow;
|
||||
|
@ -921,15 +920,15 @@ void DepthMerge_updatePreview(DepthMerge *dm) {
|
|||
resultRowRGBA,
|
||||
dm->interface->previewWidth);
|
||||
for (x = 0; x < dm->interface->previewWidth; x++) {
|
||||
resultRow[x*3 ] =
|
||||
((int)( resultRowRGBA[x*4+3])*(int)resultRowRGBA[x*4 ] +
|
||||
(int)(255 - resultRowRGBA[x*4+3])*(int)checkRow[x] ) / 255;
|
||||
resultRow[x*3+1] =
|
||||
((int)( resultRowRGBA[x*4+3])*(int)resultRowRGBA[x*4+1] +
|
||||
(int)(255 - resultRowRGBA[x*4+3])*(int)checkRow[x] ) / 255;
|
||||
resultRow[x*3+2] =
|
||||
((int)( resultRowRGBA[x*4+3])*(int)resultRowRGBA[x*4+2] +
|
||||
(int)(255 - resultRowRGBA[x*4+3])*(int)checkRow[x] ) / 255;
|
||||
i = ((int)( resultRowRGBA[x*4+3])*(int)resultRowRGBA[x*4 ] +
|
||||
(int)(255 - resultRowRGBA[x*4+3])*(int)checkRow[x] );
|
||||
resultRow[x*3 ] = DIV255(i);
|
||||
i = ((int)( resultRowRGBA[x*4+3])*(int)resultRowRGBA[x*4+1] +
|
||||
(int)(255 - resultRowRGBA[x*4+3])*(int)checkRow[x] );
|
||||
resultRow[x*3+1] = DIV255(i);
|
||||
i = ((int)( resultRowRGBA[x*4+3])*(int)resultRowRGBA[x*4+2] +
|
||||
(int)(255 - resultRowRGBA[x*4+3])*(int)checkRow[x] );
|
||||
resultRow[x*3+2] = DIV255(i);
|
||||
}
|
||||
gtk_preview_draw_row(GTK_PREVIEW(dm->interface->preview), resultRow, 0, y,
|
||||
dm->interface->previewWidth);
|
||||
|
@ -1110,8 +1109,10 @@ void util_fillReducedBuffer(guchar *dest, gint destWidth, gint destHeight,
|
|||
gint x0, gint y0,
|
||||
gint sourceWidth, gint sourceHeight) {
|
||||
GPixelRgn rgn;
|
||||
guchar *rowBuffer, *reducedRowBuffer;
|
||||
int x, y, xPrime, yPrime, sourceHasAlpha;
|
||||
guchar *sourceBuffer, *reducedRowBuffer,
|
||||
*sourceBufferRow, *sourceBufferPos, *reducedRowBufferPos;
|
||||
int x, y, i, yPrime, sourceHasAlpha, sourceBpp;
|
||||
int *sourceRowOffsetLookup;
|
||||
|
||||
if ((sourceDrawable == NULL) || (sourceWidth == 0) || (sourceHeight == 0)) {
|
||||
for (x = 0; x < destWidth*destHeight*destBPP; x++)
|
||||
|
@ -1119,29 +1120,41 @@ void util_fillReducedBuffer(guchar *dest, gint destWidth, gint destHeight,
|
|||
return;
|
||||
}
|
||||
|
||||
rowBuffer = (guchar *)g_malloc(sourceWidth * sourceDrawable->bpp);
|
||||
reducedRowBuffer = (guchar *)g_malloc(destWidth * sourceDrawable->bpp);
|
||||
sourceBpp = sourceDrawable->bpp;
|
||||
|
||||
sourceBuffer = (guchar *)g_malloc(sourceWidth * sourceHeight *
|
||||
sourceBpp);
|
||||
reducedRowBuffer = (guchar *)g_malloc(destWidth * sourceBpp);
|
||||
sourceRowOffsetLookup = (int *)g_malloc(destWidth * sizeof(int));
|
||||
gimp_pixel_rgn_init(&rgn, sourceDrawable, x0, y0, sourceWidth, sourceHeight,
|
||||
FALSE, FALSE);
|
||||
sourceHasAlpha = gimp_drawable_has_alpha(sourceDrawable->id);
|
||||
|
||||
for (x = 0; x < destWidth; x++)
|
||||
sourceRowOffsetLookup[x] = (x*(sourceWidth-1)/(destWidth-1))*sourceBpp;
|
||||
|
||||
gimp_pixel_rgn_get_rect(&rgn, sourceBuffer,
|
||||
x0, y0, sourceWidth, sourceHeight);
|
||||
|
||||
for (y = 0; y < destHeight; y++) {
|
||||
yPrime = y*(sourceHeight-1)/(destHeight-1);
|
||||
gimp_pixel_rgn_get_row(&rgn, rowBuffer, x0, yPrime+y0,
|
||||
sourceWidth);
|
||||
sourceBufferRow = &(sourceBuffer[yPrime * sourceWidth * sourceBpp]);
|
||||
sourceBufferPos = sourceBufferRow;
|
||||
reducedRowBufferPos = reducedRowBuffer;
|
||||
for (x = 0; x < destWidth; x++) {
|
||||
xPrime = x*(sourceWidth-1)/(destWidth-1);
|
||||
memcpy(&(reducedRowBuffer[x *sourceDrawable->bpp]),
|
||||
&(rowBuffer[ xPrime*sourceDrawable->bpp]),
|
||||
sourceDrawable->bpp);
|
||||
sourceBufferPos = sourceBufferRow + sourceRowOffsetLookup[x];
|
||||
for (i = 0; i < sourceBpp; i++)
|
||||
reducedRowBufferPos[i] = sourceBufferPos[i];
|
||||
reducedRowBufferPos += sourceBpp;
|
||||
}
|
||||
util_convertColorspace(&(dest[y*destWidth*destBPP]), destBPP, destHasAlpha,
|
||||
reducedRowBuffer, sourceDrawable->bpp, sourceHasAlpha,
|
||||
destWidth);
|
||||
}
|
||||
|
||||
g_free(rowBuffer);
|
||||
g_free(sourceBuffer);
|
||||
g_free(reducedRowBuffer);
|
||||
g_free(sourceRowOffsetLookup);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1153,7 +1166,7 @@ void util_convertColorspace(guchar *dest,
|
|||
guchar *source,
|
||||
gint sourceBPP, gint sourceHasAlpha,
|
||||
gint length) {
|
||||
int i, j, accum;
|
||||
int i, j, sourcePos, destPos, accum;
|
||||
int sourceColorBPP = sourceHasAlpha ? (sourceBPP-1) : sourceBPP;
|
||||
int destColorBPP = destHasAlpha ? (destBPP -1) : destBPP;
|
||||
|
||||
|
@ -1163,48 +1176,63 @@ void util_convertColorspace(guchar *dest,
|
|||
|
||||
if ((sourceColorBPP == destColorBPP) &&
|
||||
(sourceBPP == destBPP )) {
|
||||
memcpy(dest, source, length*sourceBPP);
|
||||
j = length*sourceBPP;
|
||||
for (i = 0; i < j; i++) dest[i] = source[i];
|
||||
return;
|
||||
}
|
||||
|
||||
if (sourceColorBPP == 1) {
|
||||
/* Duplicate single "gray" source byte across all dest bytes */
|
||||
for (i = 0; i < length; i++) {
|
||||
if (sourceColorBPP == destColorBPP) {
|
||||
for (i = destPos = sourcePos = 0; i < length;
|
||||
i++, destPos += destBPP, sourcePos += sourceBPP) {
|
||||
for (j = 0; j < destColorBPP; j++)
|
||||
dest[i*destBPP + j] = source[i*sourceBPP];
|
||||
dest[destPos + j] = source[sourcePos + j];
|
||||
}
|
||||
} else if (sourceColorBPP == 1) {
|
||||
/* Duplicate single "gray" source byte across all dest bytes */
|
||||
for (i = destPos = sourcePos = 0; i < length;
|
||||
i++, destPos += destBPP, sourcePos += sourceBPP) {
|
||||
for (j = 0; j < destColorBPP; j++)
|
||||
dest[destPos + j] = source[sourcePos];
|
||||
}
|
||||
} else if (destColorBPP == 1) {
|
||||
/* Average all source bytes into single "gray" dest byte */
|
||||
for (i = 0; i < length; i++) {
|
||||
for (i = destPos = sourcePos = 0; i < length;
|
||||
i++, destPos += destBPP, sourcePos += sourceBPP) {
|
||||
accum = 0;
|
||||
for (j = 0; j < sourceColorBPP; j++)
|
||||
accum += source[i*sourceBPP + j];
|
||||
dest[i*destBPP] = accum/sourceColorBPP;
|
||||
accum += source[sourcePos + j];
|
||||
dest[destPos] = accum/sourceColorBPP;
|
||||
}
|
||||
} else if (destColorBPP < sourceColorBPP) {
|
||||
/* Copy as many corresponding bytes from source to dest as will fit */
|
||||
for (i = 0; i < length; i++) {
|
||||
for (i = destPos = sourcePos = 0; i < length;
|
||||
i++, destPos += destBPP, sourcePos += sourceBPP) {
|
||||
for (j = 0; j < destColorBPP; j++)
|
||||
dest[i*destBPP + j] = source[i*sourceBPP + j];
|
||||
dest[destPos + j] = source[sourcePos + j];
|
||||
}
|
||||
} else /* destColorBPP > sourceColorBPP */ {
|
||||
/* Fill extra dest bytes with zero */
|
||||
for (i = 0; i < length; i++) {
|
||||
for (i = destPos = sourcePos = 0; i < length;
|
||||
i++, destPos += destBPP, sourcePos += sourceBPP) {
|
||||
for (j = 0; j < sourceColorBPP; j++)
|
||||
dest[i*destBPP + j] = source[i*sourceBPP + j];
|
||||
dest[destPos + j] = source[destPos + j];
|
||||
for ( ; j < destColorBPP; j++)
|
||||
dest[i*destBPP + j] = 0;
|
||||
dest[destPos + j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (destHasAlpha) {
|
||||
if (sourceHasAlpha)
|
||||
for (i = 0; i < length; i++)
|
||||
dest[i*destBPP + destColorBPP] =
|
||||
source[i*sourceBPP + sourceColorBPP];
|
||||
else
|
||||
for (i = 0; i < length; i++)
|
||||
dest[i*destBPP + destColorBPP] =
|
||||
255;
|
||||
if (sourceHasAlpha) {
|
||||
for (i = 0, destPos = destColorBPP, sourcePos = sourceColorBPP;
|
||||
i < length;
|
||||
i++, destPos += destBPP, sourcePos += sourceBPP) {
|
||||
for (i = 0; i < length; i++)
|
||||
dest[destPos] = source[sourcePos];
|
||||
}
|
||||
} else {
|
||||
for (i = 0, destPos = destColorBPP; i < length; i++, destPos += destBPP) {
|
||||
dest[destPos] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -676,17 +676,6 @@ static void dialog_preview_init( void )
|
|||
}
|
||||
}
|
||||
|
||||
static void dialog_preview_free( void )
|
||||
{
|
||||
gint y;
|
||||
for( y = 0; y < preview.height; y++ ){
|
||||
free( preview.source[y] );
|
||||
free( preview.pixels[y] );
|
||||
}
|
||||
free( preview.source );
|
||||
free( preview.pixels );
|
||||
}
|
||||
|
||||
static void dialog_preview_draw( void )
|
||||
{
|
||||
gint x, y;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/*
|
||||
* Written 1998 Jens Ch. Restemeier <jchrr@hrz.uni-bielefeld.de>
|
||||
*
|
||||
|
@ -26,40 +27,39 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "fli.h"
|
||||
|
||||
/*
|
||||
* To avoid endian-problems I wrote these functions:
|
||||
*/
|
||||
static inline unsigned char fli_read_char(FILE *f)
|
||||
static unsigned char fli_read_char(FILE *f)
|
||||
{
|
||||
unsigned char b;
|
||||
fread(&b,1,1,f);
|
||||
return b;
|
||||
}
|
||||
|
||||
static inline unsigned short fli_read_short(FILE *f)
|
||||
static unsigned short fli_read_short(FILE *f)
|
||||
{
|
||||
unsigned char b[2];
|
||||
fread(&b,1,2,f);
|
||||
return (unsigned short)(b[1]<<8) | b[0];
|
||||
}
|
||||
|
||||
static inline unsigned long fli_read_long(FILE *f)
|
||||
static unsigned long fli_read_long(FILE *f)
|
||||
{
|
||||
unsigned char b[4];
|
||||
fread(&b,1,4,f);
|
||||
return (unsigned long)(b[3]<<24) | (b[2]<<16) | (b[1]<<8) | b[0];
|
||||
}
|
||||
|
||||
static inline void fli_write_char(FILE *f, unsigned char b)
|
||||
static void fli_write_char(FILE *f, unsigned char b)
|
||||
{
|
||||
fwrite(&b,1,1,f);
|
||||
}
|
||||
|
||||
static inline void fli_write_short(FILE *f, unsigned short w)
|
||||
static void fli_write_short(FILE *f, unsigned short w)
|
||||
{
|
||||
unsigned char b[2];
|
||||
b[0]=w&255;
|
||||
|
@ -67,7 +67,7 @@ static inline void fli_write_short(FILE *f, unsigned short w)
|
|||
fwrite(&b,1,2,f);
|
||||
}
|
||||
|
||||
static inline void fli_write_long(FILE *f, unsigned long l)
|
||||
static void fli_write_long(FILE *f, unsigned long l)
|
||||
{
|
||||
unsigned char b[4];
|
||||
b[0]=l&255;
|
||||
|
@ -117,13 +117,16 @@ void fli_write_header(FILE *f, s_fli_header *fli_header)
|
|||
if (fli_header->magic == HEADER_FLC) {
|
||||
/* FLC saves speed in 1/1000s */
|
||||
fli_write_long(f, fli_header->speed); /* 16 */
|
||||
fseek(f, 80, SEEK_SET);
|
||||
fli_write_long(f, fli_header->oframe1); /* 80 */
|
||||
fli_write_long(f, fli_header->oframe2); /* 84 */
|
||||
} else {
|
||||
fprintf(stderr, "error: magic number in header is wrong !\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void fli_read_frame(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, char *old_cmap, unsigned char *framebuf, char *cmap)
|
||||
void fli_read_frame(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, unsigned char *old_cmap, unsigned char *framebuf, unsigned char *cmap)
|
||||
{
|
||||
s_fli_frame fli_frame;
|
||||
unsigned long framepos;
|
||||
|
@ -160,13 +163,18 @@ void fli_read_frame(FILE *f, s_fli_header *fli_header, unsigned char *old_frameb
|
|||
fseek(f, framepos+fli_frame.size, SEEK_SET);
|
||||
}
|
||||
|
||||
void fli_write_frame(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, char *old_cmap, unsigned char *framebuf, char *cmap, unsigned short codec_mask)
|
||||
void fli_write_frame(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, unsigned char *old_cmap, unsigned char *framebuf, unsigned char *cmap, unsigned short codec_mask)
|
||||
{
|
||||
s_fli_frame fli_frame;
|
||||
unsigned long framepos, frameend;
|
||||
framepos=ftell(f);
|
||||
fseek(f, framepos+16, SEEK_SET);
|
||||
|
||||
switch (fli_header->frames) {
|
||||
case 0: fli_header->oframe1=framepos; break;
|
||||
case 1: fli_header->oframe2=framepos; break;
|
||||
}
|
||||
|
||||
fli_frame.size=0;
|
||||
fli_frame.magic=FRAME;
|
||||
fli_frame.chunks=0;
|
||||
|
@ -175,11 +183,9 @@ void fli_write_frame(FILE *f, s_fli_header *fli_header, unsigned char *old_frame
|
|||
* create color chunk
|
||||
*/
|
||||
if (fli_header->magic == HEADER_FLI) {
|
||||
fprintf(stderr, "fli_color\n");
|
||||
if (fli_write_color(f, fli_header, old_cmap, cmap)) fli_frame.chunks++;
|
||||
} else {
|
||||
if (fli_header->magic == HEADER_FLC) {
|
||||
fprintf(stderr, "fli_color_2\n");
|
||||
if (fli_write_color_2(f, fli_header, old_cmap, cmap)) fli_frame.chunks++;
|
||||
} else {
|
||||
fprintf(stderr, "error: magic number in header is wrong !\n");
|
||||
|
@ -215,7 +221,7 @@ void fli_write_frame(FILE *f, s_fli_header *fli_header, unsigned char *old_frame
|
|||
/*
|
||||
* palette chunks from the classical Autodesk Animator.
|
||||
*/
|
||||
void fli_read_color(FILE *f, s_fli_header *fli_header, char *old_cmap, char *cmap)
|
||||
void fli_read_color(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap, unsigned char *cmap)
|
||||
{
|
||||
unsigned short num_packets, cnt_packets, col_pos;
|
||||
col_pos=0;
|
||||
|
@ -228,22 +234,22 @@ void fli_read_color(FILE *f, s_fli_header *fli_header, char *old_cmap, char *cma
|
|||
for (col_pos=0; col_pos<768; col_pos++) {
|
||||
cmap[col_pos]=fli_read_char(f)<<2;
|
||||
}
|
||||
} else {
|
||||
for (col_cnt=skip_col; (col_cnt>0) && (col_pos<768); col_cnt--) {
|
||||
cmap[col_pos]=old_cmap[col_pos];col_pos++;
|
||||
cmap[col_pos]=old_cmap[col_pos];col_pos++;
|
||||
cmap[col_pos]=old_cmap[col_pos];col_pos++;
|
||||
}
|
||||
for (col_cnt=num_col; (col_cnt>0) && (col_pos<768); col_cnt--) {
|
||||
cmap[col_pos++]=fli_read_char(f)<<2;
|
||||
cmap[col_pos++]=fli_read_char(f)<<2;
|
||||
cmap[col_pos++]=fli_read_char(f)<<2;
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (col_cnt=skip_col; (col_cnt>0) && (col_pos<768); col_cnt--) {
|
||||
cmap[col_pos]=old_cmap[col_pos];col_pos++;
|
||||
cmap[col_pos]=old_cmap[col_pos];col_pos++;
|
||||
cmap[col_pos]=old_cmap[col_pos];col_pos++;
|
||||
}
|
||||
for (col_cnt=num_col; (col_cnt>0) && (col_pos<768); col_cnt--) {
|
||||
cmap[col_pos++]=fli_read_char(f)<<2;
|
||||
cmap[col_pos++]=fli_read_char(f)<<2;
|
||||
cmap[col_pos++]=fli_read_char(f)<<2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int fli_write_color(FILE *f, s_fli_header *fli_header, char *old_cmap, char *cmap)
|
||||
int fli_write_color(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap, unsigned char *cmap)
|
||||
{
|
||||
unsigned long chunkpos;
|
||||
unsigned short num_packets;
|
||||
|
@ -276,10 +282,11 @@ int fli_write_color(FILE *f, s_fli_header *fli_header, char *old_cmap, char *cma
|
|||
num_packets++;
|
||||
fli_write_char(f, cnt_skip & 255);
|
||||
fli_write_char(f, cnt_col & 255);
|
||||
for (; cnt_col>0; cnt_col--) {
|
||||
while (cnt_col>0) {
|
||||
fli_write_char(f, cmap[col_start++]>>2);
|
||||
fli_write_char(f, cmap[col_start++]>>2);
|
||||
fli_write_char(f, cmap[col_start++]>>2);
|
||||
cnt_col--;
|
||||
}
|
||||
}
|
||||
} while (col_pos<256);
|
||||
|
@ -305,7 +312,7 @@ int fli_write_color(FILE *f, s_fli_header *fli_header, char *old_cmap, char *cma
|
|||
/*
|
||||
* palette chunks from Autodesk Animator pro
|
||||
*/
|
||||
void fli_read_color_2(FILE *f, s_fli_header *fli_header, char *old_cmap, char *cmap)
|
||||
void fli_read_color_2(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap, unsigned char *cmap)
|
||||
{
|
||||
unsigned short num_packets, cnt_packets, col_pos;
|
||||
num_packets=fli_read_short(f);
|
||||
|
@ -318,21 +325,22 @@ void fli_read_color_2(FILE *f, s_fli_header *fli_header, char *old_cmap, char *c
|
|||
for (col_pos=0; col_pos<768; col_pos++) {
|
||||
cmap[col_pos]=fli_read_char(f);
|
||||
}
|
||||
} else {
|
||||
for (col_cnt=skip_col; (col_cnt>0) && (col_pos<768); col_cnt--) {
|
||||
cmap[col_pos]=old_cmap[col_pos];col_pos++;
|
||||
cmap[col_pos]=old_cmap[col_pos];col_pos++;
|
||||
cmap[col_pos]=old_cmap[col_pos];col_pos++;
|
||||
}
|
||||
for (col_cnt=num_col; (col_cnt>0) && (col_pos<768); col_cnt--) {
|
||||
cmap[col_pos++]=fli_read_char(f); cmap[col_pos++]=fli_read_char(f);
|
||||
cmap[col_pos++]=fli_read_char(f);
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (col_cnt=skip_col; (col_cnt>0) && (col_pos<768); col_cnt--) {
|
||||
cmap[col_pos]=old_cmap[col_pos];col_pos++;
|
||||
cmap[col_pos]=old_cmap[col_pos];col_pos++;
|
||||
cmap[col_pos]=old_cmap[col_pos];col_pos++;
|
||||
}
|
||||
for (col_cnt=num_col; (col_cnt>0) && (col_pos<768); col_cnt--) {
|
||||
cmap[col_pos++]=fli_read_char(f);
|
||||
cmap[col_pos++]=fli_read_char(f);
|
||||
cmap[col_pos++]=fli_read_char(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int fli_write_color_2(FILE *f, s_fli_header *fli_header, char *old_cmap, char *cmap)
|
||||
int fli_write_color_2(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap, unsigned char *cmap)
|
||||
{
|
||||
unsigned long chunkpos;
|
||||
unsigned short num_packets;
|
||||
|
@ -396,7 +404,6 @@ int fli_write_color_2(FILE *f, s_fli_header *fli_header, char *old_cmap, char *c
|
|||
*/
|
||||
void fli_read_black(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
|
||||
{
|
||||
/* Wow, this is heavy stuff. */
|
||||
memset(framebuf, 0, fli_header->width * fli_header->height);
|
||||
}
|
||||
|
||||
|
@ -444,7 +451,7 @@ void fli_write_copy(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
|
|||
void fli_read_brun(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
|
||||
{
|
||||
unsigned short yc;
|
||||
char *pos;
|
||||
unsigned char *pos;
|
||||
for (yc=0; yc < fli_header->height; yc++) {
|
||||
unsigned short xc, pc, pcnt;
|
||||
pc=fli_read_char(f);
|
||||
|
@ -455,9 +462,7 @@ void fli_read_brun(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
|
|||
ps=fli_read_char(f);
|
||||
if (ps & 0x80) {
|
||||
unsigned short len;
|
||||
ps^=0xFF;
|
||||
ps+=1;
|
||||
for (len=ps; len>0; len--) {
|
||||
for (len=-(signed char)ps; len>0; len--) {
|
||||
pos[xc++]=fli_read_char(f);
|
||||
}
|
||||
} else {
|
||||
|
@ -547,7 +552,7 @@ void fli_write_brun(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
|
|||
void fli_read_lc(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, unsigned char *framebuf)
|
||||
{
|
||||
unsigned short yc, firstline, numline;
|
||||
char *pos;
|
||||
unsigned char *pos;
|
||||
memcpy(framebuf, old_framebuf, fli_header->width * fli_header->height);
|
||||
firstline = fli_read_short(f);
|
||||
numline = fli_read_short(f);
|
||||
|
@ -563,8 +568,7 @@ void fli_read_lc(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf,
|
|||
xc+=skip;
|
||||
if (ps & 0x80) {
|
||||
unsigned char val;
|
||||
ps^=0xFF;
|
||||
ps+=1;
|
||||
ps=-(signed char)ps;
|
||||
val=fli_read_char(f);
|
||||
memset(&(pos[xc]), val, ps);
|
||||
xc+=ps;
|
||||
|
@ -672,7 +676,7 @@ void fli_write_lc(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf
|
|||
void fli_read_lc_2(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, unsigned char *framebuf)
|
||||
{
|
||||
unsigned short yc, lc, numline;
|
||||
char *pos;
|
||||
unsigned char *pos;
|
||||
memcpy(framebuf, old_framebuf, fli_header->width * fli_header->height);
|
||||
yc=0;
|
||||
numline = fli_read_short(f);
|
||||
|
@ -682,8 +686,7 @@ void fli_read_lc_2(FILE *f, s_fli_header *fli_header, unsigned char *old_framebu
|
|||
lpf=0; lpn=0;
|
||||
while (pc & 0x8000) {
|
||||
if (pc & 0x4000) {
|
||||
/* yc+=pc & 0x3FFF; */ /* BANG! */
|
||||
yc+=0x10000-pc; /* better */
|
||||
yc+=-(signed short)pc;
|
||||
} else {
|
||||
lpf=1;lpn=pc&0xFF;
|
||||
}
|
||||
|
@ -698,8 +701,7 @@ void fli_read_lc_2(FILE *f, s_fli_header *fli_header, unsigned char *old_framebu
|
|||
xc+=skip;
|
||||
if (ps & 0x80) {
|
||||
unsigned char v1,v2;
|
||||
ps^=0xFF;
|
||||
ps++;
|
||||
ps=-(signed char)ps;
|
||||
v1=fli_read_char(f);
|
||||
v2=fli_read_char(f);
|
||||
while (ps>0) {
|
||||
|
|
|
@ -34,6 +34,7 @@ typedef struct _fli_header {
|
|||
unsigned long creator;
|
||||
unsigned long updated;
|
||||
unsigned short aspect_x, aspect_y;
|
||||
unsigned long oframe1, oframe2;
|
||||
} s_fli_header;
|
||||
|
||||
typedef struct _fli_frame {
|
||||
|
@ -60,7 +61,7 @@ typedef struct _fli_chunk {
|
|||
#define FLI_COPY 16
|
||||
#define FLI_LC 12
|
||||
#define FLI_LC_2 7
|
||||
#define FLI_COLOR_2 2
|
||||
#define FLI_COLOR_2 4
|
||||
#define FLI_MINI 18
|
||||
|
||||
/** codec masks */
|
||||
|
@ -76,10 +77,10 @@ typedef struct _fli_chunk {
|
|||
|
||||
/** functions */
|
||||
void fli_read_header(FILE *f, s_fli_header *fli_header);
|
||||
void fli_read_frame(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, char *old_cmap, unsigned char *framebuf, char *cmap);
|
||||
void fli_read_frame(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, unsigned char *old_cmap, unsigned char *framebuf, unsigned char *cmap);
|
||||
|
||||
void fli_read_color(FILE *f, s_fli_header *fli_header, char *old_cmap, char *cmap);
|
||||
void fli_read_color_2(FILE *f, s_fli_header *fli_header, char *old_cmap, char *cmap);
|
||||
void fli_read_color(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap, unsigned char *cmap);
|
||||
void fli_read_color_2(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap, unsigned char *cmap);
|
||||
void fli_read_black(FILE *f, s_fli_header *fli_header, unsigned char *framebuf);
|
||||
void fli_read_brun(FILE *f, s_fli_header *fli_header, unsigned char *framebuf);
|
||||
void fli_read_copy(FILE *f, s_fli_header *fli_header, unsigned char *framebuf);
|
||||
|
@ -87,10 +88,10 @@ void fli_read_lc(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf,
|
|||
void fli_read_lc_2(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, unsigned char *framebuf);
|
||||
|
||||
void fli_write_header(FILE *f, s_fli_header *fli_header);
|
||||
void fli_write_frame(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, char *old_cmap, unsigned char *framebuf, char *cmap, unsigned short codec_mask);
|
||||
void fli_write_frame(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, unsigned char *old_cmap, unsigned char *framebuf, unsigned char *cmap, unsigned short codec_mask);
|
||||
|
||||
int fli_write_color(FILE *f, s_fli_header *fli_header, char *old_cmap, char *cmap);
|
||||
int fli_write_color_2(FILE *f, s_fli_header *fli_header, char *old_cmap, char *cmap);
|
||||
int fli_write_color(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap, unsigned char *cmap);
|
||||
int fli_write_color_2(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap, unsigned char *cmap);
|
||||
void fli_write_black(FILE *f, s_fli_header *fli_header, unsigned char *framebuf);
|
||||
void fli_write_brun(FILE *f, s_fli_header *fli_header, unsigned char *framebuf);
|
||||
void fli_write_copy(FILE *f, s_fli_header *fli_header, unsigned char *framebuf);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* GFLI 1.0
|
||||
* GFLI 1.2
|
||||
*
|
||||
* A gimp plug-in to read and write FLI and FLC movies.
|
||||
*
|
||||
|
@ -30,18 +30,24 @@
|
|||
*
|
||||
* Wish-List:
|
||||
* - I'd like to have a different format for storing animations, so I can use
|
||||
* Layers and Alpha-Channels for effects. I'm working on another movie-loader
|
||||
* that _requires_ layers (Gold Disk moviesetter). An older version of
|
||||
* Layers and Alpha-Channels for effects. An older version of
|
||||
* this plug-in created one image per frame, and went real soon out of
|
||||
* memory.
|
||||
* - I'd like a method that requests unmodified frames from the original
|
||||
* image, and stores modified frames compressed (suggestion: libpng).
|
||||
* image, and stores modified without destroying the original file.
|
||||
* - I'd like a way to store additional information about a image to it, for
|
||||
* example copyright stuff or a timecode.
|
||||
* - I've thought about a small utility to mix MIDI events as custom chunks
|
||||
* between the FLI chunks. Anyone interested in implementing this ?
|
||||
*/
|
||||
|
||||
/*
|
||||
* History:
|
||||
* 1.0 first release
|
||||
* 1.1 first support for FLI saving (BRUN and LC chunks)
|
||||
* 1.2 support for load/save ranges, fixed SGI & SUN problems (I hope...), fixed FLC
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -50,16 +56,24 @@
|
|||
|
||||
#include "fli.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
static void query (void);
|
||||
static void run (gchar *name, gint nparams, GParam *param, gint *nreturn_vals, GParam **return_vals);
|
||||
|
||||
static gint32 load_image (gchar *filename);
|
||||
static void save_image (gchar *filename, gint32 image);
|
||||
/* return the image-ID of the new image, or -1 in case of an error */
|
||||
gint32 load_image (gchar *filename, gint32 from_frame, gint32 to_frame);
|
||||
gint32 interactive_load_image(gchar *name);
|
||||
|
||||
/* return TRUE or FALSE */
|
||||
int save_image(gchar *filename, gint32 image_id, gint32 from_frame, gint32 to_frame);
|
||||
int interactive_save_image(gchar *name, gint32 image_id);
|
||||
|
||||
/* return TRUE or FALSE */
|
||||
int get_info(gchar *filename, gint32 *width, gint32 *height, gint32 *frames);
|
||||
|
||||
|
||||
/*
|
||||
* GIMP interface
|
||||
*/
|
||||
GPlugInInfo PLUG_IN_INFO = {
|
||||
NULL, /* init_proc */
|
||||
NULL, /* quit_proc */
|
||||
|
@ -71,6 +85,8 @@ GParamDef load_args[] = {
|
|||
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
||||
{ PARAM_STRING, "filename", "The name of the file to load" },
|
||||
{ PARAM_STRING, "raw_filename", "The name entered" },
|
||||
{ PARAM_INT32, "from_frame", "Load beginning from this frame" },
|
||||
{ PARAM_INT32, "to_frame", "End loading with this frame" },
|
||||
};
|
||||
GParamDef load_return_vals[] = {
|
||||
{ PARAM_IMAGE, "image", "Output image" },
|
||||
|
@ -80,21 +96,37 @@ gint nload_return_vals = sizeof (load_return_vals) / sizeof (load_return_vals[0]
|
|||
|
||||
GParamDef save_args[] = {
|
||||
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
||||
{ PARAM_IMAGE, "image", "Input image (unused)" },
|
||||
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
|
||||
{ PARAM_IMAGE, "image", "Input image" },
|
||||
{ PARAM_DRAWABLE, "drawable", "Input drawable (unused)" },
|
||||
{ PARAM_STRING, "filename", "The name of the file to save" },
|
||||
{ PARAM_STRING, "raw_filename", "The name entered" },
|
||||
{ PARAM_INT32, "from_frame", "Save beginning from this frame" },
|
||||
{ PARAM_INT32, "to_frame", "End saveing with this frame" },
|
||||
};
|
||||
gint nsave_args = sizeof (save_args) / sizeof (save_args[0]);
|
||||
|
||||
GParamDef info_args[] = {
|
||||
{ PARAM_STRING, "filename", "The name of the file to get info" },
|
||||
};
|
||||
GParamDef info_return_vals[] = {
|
||||
{ PARAM_INT32, "width", "Width of one frame" },
|
||||
{ PARAM_INT32, "height", "Height of one frame" },
|
||||
{ PARAM_INT32, "frames", "Number of Frames" },
|
||||
};
|
||||
gint ninfo_args = sizeof (info_args) / sizeof (info_args[0]);
|
||||
gint ninfo_return_vals = sizeof (info_return_vals) / sizeof (info_return_vals[0]);
|
||||
|
||||
MAIN ()
|
||||
|
||||
static void query ()
|
||||
{
|
||||
/*
|
||||
* Load/save procedures
|
||||
*/
|
||||
gimp_install_procedure (
|
||||
"file_fli_load",
|
||||
"load FLI-movies",
|
||||
"This is a experimantal plug-in to handle FLI movies",
|
||||
"This is an experimantal plug-in to handle FLI movies",
|
||||
"Jens Ch. Restemeier",
|
||||
"Jens Ch. Restemeier",
|
||||
"1997",
|
||||
|
@ -108,7 +140,7 @@ static void query ()
|
|||
gimp_install_procedure (
|
||||
"file_fli_save",
|
||||
"save FLI-movies",
|
||||
"This is a experimantal plug-in to handle FLI movies",
|
||||
"This is an experimantal plug-in to handle FLI movies",
|
||||
"Jens Ch. Restemeier",
|
||||
"Jens Ch. Restemeier",
|
||||
"1997",
|
||||
|
@ -118,14 +150,29 @@ static void query ()
|
|||
nsave_args, 0,
|
||||
save_args, NULL);
|
||||
gimp_register_save_handler ("file_fli_save", "fli", "");
|
||||
|
||||
/*
|
||||
* Utility functions:
|
||||
*/
|
||||
gimp_install_procedure (
|
||||
"file_fli_info",
|
||||
"Get info about a Fli movie",
|
||||
"This is a experimantal plug-in to handle FLI movies",
|
||||
"Jens Ch. Restemeier",
|
||||
"Jens Ch. Restemeier",
|
||||
"1997",
|
||||
NULL,
|
||||
NULL,
|
||||
PROC_EXTENSION,
|
||||
ninfo_args, ninfo_return_vals,
|
||||
info_args, info_return_vals);
|
||||
}
|
||||
|
||||
GParam values[2];
|
||||
GParam values[5];
|
||||
|
||||
void run (gchar *name, gint nparams, GParam *param, gint *nreturn_vals, GParam **return_vals)
|
||||
static void run (gchar *name, gint nparams, GParam *param, gint *nreturn_vals, GParam **return_vals)
|
||||
{
|
||||
GRunModeType run_mode;
|
||||
gint32 image_ID;
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
|
||||
|
@ -135,75 +182,253 @@ void run (gchar *name, gint nparams, GParam *param, gint *nreturn_vals, GParam *
|
|||
values[0].data.d_status = STATUS_CALLING_ERROR;
|
||||
|
||||
if (strcmp (name, "file_fli_load") == 0) {
|
||||
image_ID = load_image (param[1].data.d_string);
|
||||
switch (run_mode) {
|
||||
case RUN_NONINTERACTIVE: {
|
||||
gint32 image_id;
|
||||
gint32 pc;
|
||||
/*
|
||||
* check for valid parameters:
|
||||
* (Or can I trust GIMP ?)
|
||||
*/
|
||||
if (nparams!=nload_args) {
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_CALLING_ERROR;
|
||||
return;
|
||||
}
|
||||
for (pc=0; pc<nload_args; pc++) {
|
||||
if (load_args[pc].type!=param[pc].type) {
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_CALLING_ERROR;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
image_id = load_image (param[1].data.d_string, param[2].data.d_int32, param[3].data.d_int32);
|
||||
|
||||
if (image_id != -1) {
|
||||
*nreturn_vals = 2;
|
||||
values[0].data.d_status = STATUS_SUCCESS;
|
||||
values[1].type = PARAM_IMAGE;
|
||||
values[1].data.d_image = image_id;
|
||||
} else {
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
}
|
||||
return;
|
||||
}
|
||||
case RUN_INTERACTIVE: {
|
||||
gint32 image_id;
|
||||
|
||||
if (image_ID != -1) {
|
||||
*nreturn_vals = 2;
|
||||
values[0].data.d_status = STATUS_SUCCESS;
|
||||
values[1].type = PARAM_IMAGE;
|
||||
values[1].data.d_image = image_ID;
|
||||
} else {
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
image_id = interactive_load_image(param[1].data.d_string);
|
||||
|
||||
if (image_id != -1) {
|
||||
*nreturn_vals = 2;
|
||||
values[0].data.d_status = STATUS_SUCCESS;
|
||||
values[1].type = PARAM_IMAGE;
|
||||
values[1].data.d_image = image_id;
|
||||
} else {
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
}
|
||||
return;
|
||||
}
|
||||
case RUN_WITH_LAST_VALS: {
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_CALLING_ERROR;
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (strcmp (name, "file_fli_save") == 0) {
|
||||
if (param[1].type == PARAM_IMAGE) {
|
||||
save_image (param[3].data.d_string, param[1].data.d_image);
|
||||
if (strcmp(name, "file_fli_save") == 0) {
|
||||
switch (run_mode) {
|
||||
case RUN_NONINTERACTIVE: {
|
||||
gint32 pc;
|
||||
/*
|
||||
* check for valid parameters;
|
||||
*/
|
||||
if (nparams!=nsave_args) {
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_CALLING_ERROR;
|
||||
return;
|
||||
}
|
||||
for (pc=0; pc<nsave_args; pc++) {
|
||||
if (save_args[pc].type!=param[pc].type) {
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_CALLING_ERROR;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (save_image (param[3].data.d_string, param[1].data.d_image, param[5].data.d_int32, param[6].data.d_int32)) {
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_SUCCESS;
|
||||
} else {
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
}
|
||||
return;
|
||||
}
|
||||
case RUN_INTERACTIVE: {
|
||||
if (interactive_save_image(param[3].data.d_string, param[1].data.d_image)) {
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_SUCCESS;
|
||||
} else {
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
}
|
||||
return;
|
||||
}
|
||||
case RUN_WITH_LAST_VALS: {
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_CALLING_ERROR;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (strcmp (name, "file_fli_info") == 0) {
|
||||
gint32 pc;
|
||||
gint32 width, height, frames;
|
||||
/*
|
||||
* check for valid parameters;
|
||||
*/
|
||||
if (nparams!=ninfo_args) {
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_SUCCESS;
|
||||
} else {
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
values[0].data.d_status = STATUS_CALLING_ERROR;
|
||||
return;
|
||||
}
|
||||
for (pc=0; pc<nsave_args; pc++) {
|
||||
if (info_args[pc].type!=param[pc].type) {
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_CALLING_ERROR;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (get_info(param[0].data.d_string, &width, &height, &frames)) {
|
||||
*nreturn_vals = 4;
|
||||
values[0].data.d_status = STATUS_SUCCESS;
|
||||
values[1].type = PARAM_INT32;
|
||||
values[1].data.d_int32 = width;
|
||||
values[2].type = PARAM_INT32;
|
||||
values[2].data.d_int32 = height;
|
||||
values[3].type = PARAM_INT32;
|
||||
values[3].data.d_int32 = frames;
|
||||
return;
|
||||
} else {
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* If we reach this point, something went wrong. */
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_CALLING_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Open FLI animation and return header-info
|
||||
*/
|
||||
gint get_info(gchar *filename, gint32 *width, gint32 *height, gint32 *frames)
|
||||
{
|
||||
FILE *f;
|
||||
s_fli_header fli_header;
|
||||
*width=0; *height=0; *frames=0;
|
||||
f=fopen(filename ,"rb");
|
||||
if (!f) {
|
||||
g_error ("FLI: can't open \"%s\"\n", filename);
|
||||
return 0;
|
||||
}
|
||||
fli_read_header(f, &fli_header);
|
||||
fclose(f);
|
||||
*width=fli_header.width;
|
||||
*height=fli_header.height;
|
||||
*frames=fli_header.frames;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* load fli animation and store as framestack
|
||||
*/
|
||||
gint32 load_image (gchar *filename)
|
||||
gint32 load_image (gchar *filename, gint32 from_frame, gint32 to_frame)
|
||||
{
|
||||
FILE *f;
|
||||
gchar *name_buf;
|
||||
GDrawable *drawable;
|
||||
gint32 image_ID, layer_ID;
|
||||
gint32 image_id, layer_ID;
|
||||
|
||||
gchar *fb, *ofb, *fb_x;
|
||||
gchar cm[768], ocm[768];
|
||||
guchar *fb, *ofb, *fb_x;
|
||||
guchar cm[768], ocm[768];
|
||||
GPixelRgn pixel_rgn;
|
||||
s_fli_header fli_header;
|
||||
|
||||
gint cnt;
|
||||
|
||||
name_buf = g_malloc (64);
|
||||
|
||||
name_buf = g_malloc (64 + strlen(filename));
|
||||
sprintf (name_buf, "Loading %s:", filename);
|
||||
gimp_progress_init (name_buf);
|
||||
g_free(name_buf);
|
||||
|
||||
f=fopen(filename ,"r");
|
||||
f=fopen(filename ,"rb");
|
||||
if (!f) {
|
||||
fprintf (stderr, "FLI: can't open \"%s\"\n", filename);
|
||||
g_error("FLI: can't open \"%s\"\n", filename);
|
||||
return -1;
|
||||
}
|
||||
fli_read_header(f, &fli_header);
|
||||
fseek(f,128,SEEK_SET);
|
||||
|
||||
image_ID = gimp_image_new (fli_header.width, fli_header.height, INDEXED);
|
||||
gimp_image_set_filename (image_ID, filename);
|
||||
/*
|
||||
* Fix parameters
|
||||
*/
|
||||
if ((from_frame==-1) && (to_frame==-1)) {
|
||||
/* to make scripting easier: */
|
||||
from_frame=1; to_frame=fli_header.frames;
|
||||
}
|
||||
if (to_frame<from_frame) {
|
||||
to_frame=fli_header.frames;
|
||||
}
|
||||
if (from_frame<1) {
|
||||
from_frame=1;
|
||||
}
|
||||
if (to_frame<1) {
|
||||
/* nothing to do ... */
|
||||
return -1;
|
||||
}
|
||||
if (from_frame>=fli_header.frames) {
|
||||
/* nothing to do ... */
|
||||
return -1;
|
||||
}
|
||||
if (to_frame>fli_header.frames) {
|
||||
to_frame=fli_header.frames;
|
||||
}
|
||||
|
||||
image_id = gimp_image_new (fli_header.width, fli_header.height, INDEXED);
|
||||
gimp_image_set_filename (image_id, filename);
|
||||
|
||||
fb=g_malloc(fli_header.width * fli_header.height);
|
||||
ofb=g_malloc(fli_header.width * fli_header.height);
|
||||
for (cnt=0; cnt < fli_header.frames; cnt++) {
|
||||
sprintf(name_buf, "Frame (%i)",cnt+1);
|
||||
|
||||
/*
|
||||
* Skip to the beginning of requested frames:
|
||||
*/
|
||||
for (cnt=1; cnt < from_frame; cnt++) {
|
||||
fli_read_frame(f, &fli_header, ofb, ocm, fb, cm);
|
||||
memcpy(ocm, cm, 768);
|
||||
fb_x=fb; fb=ofb; ofb=fb_x;
|
||||
}
|
||||
/*
|
||||
* Load range
|
||||
*/
|
||||
for (cnt=from_frame; cnt<=to_frame; cnt++) {
|
||||
gchar layername[64];
|
||||
sprintf(layername, "Frame (%i)",cnt);
|
||||
layer_ID = gimp_layer_new (
|
||||
image_ID, name_buf,
|
||||
image_id, layername,
|
||||
fli_header.width, fli_header.height,
|
||||
INDEXED_IMAGE, 100, NORMAL_MODE);
|
||||
gimp_image_add_layer (image_ID, layer_ID, cnt);
|
||||
gimp_image_add_layer (image_id, layer_ID, 0);
|
||||
|
||||
drawable = gimp_drawable_get (layer_ID);
|
||||
gimp_progress_update ((double) cnt / (double)fli_header.frames);
|
||||
gimp_progress_update ((double) cnt / (double)(to_frame-from_frame));
|
||||
|
||||
fli_read_frame(f, &fli_header, ofb, ocm, fb, cm);
|
||||
|
||||
|
@ -215,20 +440,19 @@ gint32 load_image (gchar *filename)
|
|||
memcpy(ocm, cm, 768);
|
||||
fb_x=fb; fb=ofb; ofb=fb_x;
|
||||
}
|
||||
gimp_image_set_cmap (image_ID, cm, 256);
|
||||
gimp_image_set_cmap (image_id, cm, 256);
|
||||
fclose(f);
|
||||
|
||||
g_free(name_buf);
|
||||
g_free(fb);
|
||||
g_free(ofb);
|
||||
return image_ID;
|
||||
return image_id;
|
||||
}
|
||||
|
||||
/*
|
||||
* get framestack and store as fli animation
|
||||
* (some code was taken from the GIF plugin.)
|
||||
*/
|
||||
void save_image(gchar *filename, gint32 image_ID)
|
||||
int save_image(gchar *filename, gint32 image_id, gint32 from_frame, gint32 to_frame)
|
||||
{
|
||||
FILE *f;
|
||||
gchar *name_buf;
|
||||
|
@ -237,8 +461,8 @@ void save_image(gchar *filename, gint32 image_ID)
|
|||
gint32 *framelist;
|
||||
gint nframes;
|
||||
|
||||
gchar *fb, *ofb;
|
||||
gchar cm[768];
|
||||
guchar *fb, *ofb;
|
||||
guchar cm[768];
|
||||
GPixelRgn pixel_rgn;
|
||||
s_fli_header fli_header;
|
||||
|
||||
|
@ -247,15 +471,39 @@ void save_image(gchar *filename, gint32 image_ID)
|
|||
/*
|
||||
* prepare header and check information
|
||||
*/
|
||||
framelist = gimp_image_get_layers(image_ID, &nframes);
|
||||
framelist = gimp_image_get_layers(image_id, &nframes);
|
||||
|
||||
/*
|
||||
* Fix parameters
|
||||
*/
|
||||
if ((from_frame==-1) && (to_frame==-1)) {
|
||||
/* to make scripting easier: */
|
||||
from_frame=0; to_frame=nframes;
|
||||
}
|
||||
if (to_frame<from_frame) {
|
||||
to_frame=nframes;
|
||||
}
|
||||
if (from_frame<1) {
|
||||
from_frame=1;
|
||||
}
|
||||
if (to_frame<1) {
|
||||
/* nothing to do ... */
|
||||
return FALSE;
|
||||
}
|
||||
if (from_frame>nframes) {
|
||||
/* nothing to do ... */
|
||||
return FALSE;
|
||||
}
|
||||
if (to_frame>nframes) {
|
||||
to_frame=nframes;
|
||||
}
|
||||
|
||||
drawable_type = gimp_drawable_type(framelist[0]);
|
||||
switch (drawable_type) {
|
||||
case INDEXEDA_IMAGE:
|
||||
case GRAYA_IMAGE:
|
||||
/* FIXME: should be a popup */
|
||||
fprintf (stderr, "FLI: Sorry, can't save images with Alpha.\n");
|
||||
return;
|
||||
break;
|
||||
g_error( "FLI: Sorry, can't save images with Alpha.\n");
|
||||
return FALSE;
|
||||
case GRAY_IMAGE: {
|
||||
/* build grayscale palette */
|
||||
int i;
|
||||
|
@ -266,8 +514,8 @@ void save_image(gchar *filename, gint32 image_ID)
|
|||
}
|
||||
case INDEXED_IMAGE: {
|
||||
gint colors, i;
|
||||
gchar *cmap;
|
||||
cmap=gimp_image_get_cmap(image_ID, &colors);
|
||||
guchar *cmap;
|
||||
cmap=gimp_image_get_cmap(image_id, &colors);
|
||||
for (i=0; i<colors; i++) {
|
||||
cm[i*3+0]=cmap[i*3+0];
|
||||
cm[i*3+1]=cmap[i*3+1];
|
||||
|
@ -279,25 +527,23 @@ void save_image(gchar *filename, gint32 image_ID)
|
|||
break;
|
||||
}
|
||||
default:
|
||||
/* FIXME: should be a popup */
|
||||
fprintf (stderr, "FLI: Sorry, I can save only INDEXED and GRAY images.\n");
|
||||
return;
|
||||
break;
|
||||
g_error("FLI: Sorry, I can save only INDEXED and GRAY images.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
name_buf = g_malloc (64);
|
||||
|
||||
name_buf = g_malloc (64+strlen(filename));
|
||||
sprintf (name_buf, "Saving %s:", filename);
|
||||
gimp_progress_init (name_buf);
|
||||
g_free(name_buf);
|
||||
|
||||
/*
|
||||
* First build the fli header.
|
||||
*/
|
||||
fli_header.filesize=0; /* will be fixed when writing the header */
|
||||
fli_header.frames=0; /* will be fixed during the write */
|
||||
fli_header.width=gimp_image_width(image_ID);
|
||||
fli_header.height=gimp_image_height(image_ID);
|
||||
fli_header.width=gimp_image_width(image_id);
|
||||
fli_header.height=gimp_image_height(image_id);
|
||||
|
||||
if ((fli_header.width==320) && (fli_header.height=200)) {
|
||||
fli_header.magic=HEADER_FLI;
|
||||
|
@ -311,28 +557,31 @@ void save_image(gchar *filename, gint32 image_ID)
|
|||
fli_header.updated=0; /* date in MS-DOS format. ignore...*/
|
||||
fli_header.aspect_x=1; /* aspect ratio. Will be added as soon.. */
|
||||
fli_header.aspect_y=1; /* ... as GIMP supports it. */
|
||||
fli_header.oframe1=fli_header.oframe2=0; /* will be fixed during the write */
|
||||
|
||||
f=fopen(filename ,"w");
|
||||
f=fopen(filename ,"wb");
|
||||
if (!f) {
|
||||
fprintf (stderr, "FLI: can't open \"%s\"\n", filename);
|
||||
g_error ("FLI: can't open \"%s\"\n", filename);
|
||||
return FALSE;
|
||||
}
|
||||
fseek(f,128,SEEK_SET);
|
||||
|
||||
fb=g_malloc(fli_header.width * fli_header.height);
|
||||
ofb=g_malloc(fli_header.width * fli_header.height);
|
||||
|
||||
/*
|
||||
* Now write all frames
|
||||
*/
|
||||
for (cnt=0; cnt<nframes; cnt++) {
|
||||
for (cnt=from_frame; cnt<=to_frame; cnt++) {
|
||||
gint offset_x, offset_y, xc, yc;
|
||||
guint rows, cols, rowstride;
|
||||
gchar *tmp;
|
||||
guchar *tmp;
|
||||
|
||||
gimp_progress_update ((double) cnt / (double)nframes);
|
||||
gimp_progress_update ((double) cnt / (double)(to_frame-from_frame));
|
||||
|
||||
/* get layer data from GIMP */
|
||||
drawable = gimp_drawable_get (framelist[cnt]);
|
||||
gimp_drawable_offsets (framelist[cnt], &offset_x, &offset_y);
|
||||
drawable = gimp_drawable_get (framelist[nframes-cnt]);
|
||||
gimp_drawable_offsets (framelist[cnt-1], &offset_x, &offset_y);
|
||||
cols = drawable->width;
|
||||
rows = drawable->height;
|
||||
rowstride = drawable->width;
|
||||
|
@ -357,7 +606,7 @@ void save_image(gchar *filename, gint32 image_ID)
|
|||
free(tmp);
|
||||
|
||||
/* save the frame */
|
||||
if (cnt>0) {
|
||||
if (cnt>from_frame) {
|
||||
/* save frame, allow all codecs */
|
||||
fli_write_frame(f, &fli_header, ofb, cm, fb, cm, W_ALL);
|
||||
} else {
|
||||
|
@ -373,8 +622,232 @@ void save_image(gchar *filename, gint32 image_ID)
|
|||
fli_write_header(f, &fli_header);
|
||||
fclose(f);
|
||||
|
||||
g_free(name_buf);
|
||||
g_free(fb);
|
||||
g_free(ofb);
|
||||
g_free(framelist);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Dialogs for interactive usage
|
||||
*/
|
||||
gint result;
|
||||
|
||||
static void cb_cancel(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
result=FALSE;
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
static void cb_ok(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
result=TRUE;
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
static void cb_change(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
*((gint32 *)data)=atoi(gtk_entry_get_text(GTK_ENTRY(widget)));
|
||||
}
|
||||
|
||||
void init_gui()
|
||||
{
|
||||
guchar *color_cube;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
|
||||
argc = 1;
|
||||
argv = g_new (gchar *, 1);
|
||||
argv[0] = g_strdup ("gfli");
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
gtk_rc_parse (gimp_gtkrc());
|
||||
|
||||
gdk_set_use_xshm (gimp_use_xshm ());
|
||||
gtk_preview_set_gamma (gimp_gamma ());
|
||||
gtk_preview_set_install_cmap (gimp_install_cmap ());
|
||||
color_cube = gimp_color_cube ();
|
||||
gtk_preview_set_color_cube (color_cube[0], color_cube[1],
|
||||
color_cube[2], color_cube[3]);
|
||||
gtk_widget_set_default_visual (gtk_preview_get_visual ());
|
||||
gtk_widget_set_default_colormap (gtk_preview_get_cmap ());
|
||||
}
|
||||
|
||||
gint32 interactive_load_image(gchar *name)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *label;
|
||||
GtkWidget *table;
|
||||
GtkWidget *button;
|
||||
char buffer[32];
|
||||
|
||||
gint32 from_frame, to_frame, width, height, nframes;
|
||||
get_info(name, &width, &height, &nframes);
|
||||
|
||||
from_frame=1; to_frame=nframes;
|
||||
|
||||
init_gui();
|
||||
|
||||
dialog=gtk_dialog_new ();
|
||||
gtk_window_set_title (GTK_WINDOW(dialog), "GFLI 1.2 - Load framestack");
|
||||
gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
|
||||
(GtkSignalFunc)cb_cancel,
|
||||
NULL);
|
||||
|
||||
table=gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_row_spacings(GTK_TABLE(table), 5);
|
||||
gtk_table_set_col_spacings(GTK_TABLE(table), 5);
|
||||
gtk_container_border_width (GTK_CONTAINER (table), 5);
|
||||
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), table, TRUE, TRUE, 0);
|
||||
gtk_widget_show(table);
|
||||
|
||||
/*
|
||||
* Maybe I add on-the-fly RGB conversion, to keep palettechanges...
|
||||
* But for now you can set a start- and a end-frame:
|
||||
*/
|
||||
label = gtk_label_new ("From:");
|
||||
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show(label);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_entry_set_text(GTK_ENTRY(entry), "1");
|
||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
||||
(GtkSignalFunc)cb_change,
|
||||
(gpointer)&from_frame);
|
||||
gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show(entry);
|
||||
|
||||
label = gtk_label_new ("To:");
|
||||
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show(label);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
sprintf(buffer, "%i", to_frame);
|
||||
gtk_entry_set_text(GTK_ENTRY(entry), buffer);
|
||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
||||
(GtkSignalFunc)cb_change,
|
||||
(gpointer)&to_frame);
|
||||
gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show(entry);
|
||||
|
||||
button = gtk_button_new_with_label ("OK");
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) cb_ok,
|
||||
(gpointer) NULL);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog)->action_area), button, TRUE, TRUE, 0);
|
||||
gtk_widget_show (button);
|
||||
button = gtk_button_new_with_label ("Cancel");
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) cb_cancel,
|
||||
(gpointer) NULL);
|
||||
gtk_box_pack_end (GTK_BOX (GTK_DIALOG(dialog)->action_area), button, TRUE, TRUE, 0);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_widget_show(dialog);
|
||||
|
||||
result=FALSE;
|
||||
|
||||
gtk_main();
|
||||
gdk_flush();
|
||||
|
||||
if (result) {
|
||||
return load_image (name, from_frame, to_frame);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int interactive_save_image(gchar *name, gint32 image_id)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *label;
|
||||
GtkWidget *table;
|
||||
GtkWidget *button;
|
||||
char buffer[32];
|
||||
gint32 from_frame, to_frame;
|
||||
gint nframes;
|
||||
|
||||
g_free( gimp_image_get_layers(image_id, &nframes) );
|
||||
|
||||
from_frame=1; to_frame=nframes;
|
||||
|
||||
init_gui();
|
||||
|
||||
dialog=gtk_dialog_new ();
|
||||
gtk_window_set_title (GTK_WINDOW(dialog), "GFLI 1.2 - Save framestack");
|
||||
gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
|
||||
(GtkSignalFunc)cb_cancel,
|
||||
NULL);
|
||||
|
||||
table=gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_row_spacings(GTK_TABLE(table), 5);
|
||||
gtk_table_set_col_spacings(GTK_TABLE(table), 5);
|
||||
gtk_container_border_width (GTK_CONTAINER (table), 5);
|
||||
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), table, TRUE, TRUE, 0);
|
||||
gtk_widget_show(table);
|
||||
|
||||
/*
|
||||
* Maybe I'll add some functions to influence compression
|
||||
* or FLI version. But for now you can set a start- and a end-frame:
|
||||
*/
|
||||
|
||||
label = gtk_label_new ("From:");
|
||||
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show(label);
|
||||
|
||||
entry = gtk_entry_new();
|
||||
gtk_entry_set_text(GTK_ENTRY(entry), "1");
|
||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
||||
(GtkSignalFunc)cb_change,
|
||||
(gpointer)&from_frame);
|
||||
gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show(entry);
|
||||
|
||||
label = gtk_label_new ("To:");
|
||||
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show(label);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
sprintf(buffer, "%i", to_frame);
|
||||
gtk_entry_set_text(GTK_ENTRY(entry), buffer);
|
||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
||||
(GtkSignalFunc)cb_change,
|
||||
(gpointer)&to_frame);
|
||||
gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show(entry);
|
||||
|
||||
button = gtk_button_new_with_label ("OK");
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) cb_ok,
|
||||
(gpointer) NULL);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog)->action_area), button, TRUE, TRUE, 0);
|
||||
gtk_widget_show (button);
|
||||
button = gtk_button_new_with_label ("Cancel");
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) cb_cancel,
|
||||
(gpointer) NULL);
|
||||
gtk_box_pack_end (GTK_BOX (GTK_DIALOG(dialog)->action_area), button, TRUE, TRUE, 0);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_widget_show(dialog);
|
||||
|
||||
result=FALSE;
|
||||
|
||||
gtk_main();
|
||||
gdk_flush();
|
||||
|
||||
if (result) {
|
||||
return save_image(name, image_id, from_frame, to_frame);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -297,7 +297,7 @@ run (char *name,
|
|||
|
||||
case RUN_NONINTERACTIVE:
|
||||
/* Make sure all the arguments are there! */
|
||||
if (nparams != 5)
|
||||
if (nparams != 6)
|
||||
status = STATUS_CALLING_ERROR;
|
||||
if (status == STATUS_SUCCESS)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue