Skip to content
Snippets Groups Projects
Commit 7ab3262a authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

*** empty log message ***

parent bfdeda18
No related branches found
No related tags found
No related merge requests found
#include "Gmsh.h"
#include "GmshUI.h"
#include "Context.h"
#include "jpeglib.h"
#include "jerror.h"
extern Context_T CTX ;
void my_output_message (j_common_ptr cinfo){
char buffer[JMSG_LENGTH_MAX];
/* Create the message */
(*cinfo->err->format_message) (cinfo, buffer);
Msg(DEBUG, "%s", buffer);
}
void create_jpeg(FILE *outfile, int width, int height){
int i;
unsigned char *pixels;
struct jpeg_compress_struct cinfo;
struct jpeg_error_mgr jerr;
JSAMPROW row_pointer[1]; /* pointer to JSAMPLE row[s] */
int row_stride; /* physical row width in image buffer */
cinfo.err = jpeg_std_error(&jerr);
cinfo.err->output_message = my_output_message;
jpeg_create_compress(&cinfo);
jpeg_stdio_dest(&cinfo, outfile);
cinfo.image_width = width; /* image width and height, in pixels */
cinfo.image_height = height;
cinfo.input_components = 3; /* # of color components per pixel */
cinfo.in_color_space = JCS_RGB; /* colorspace of input image */
jpeg_set_defaults(&cinfo);
jpeg_set_quality(&cinfo, CTX.print.jpeg_quality, TRUE /* limit to baseline-JPEG values */);
jpeg_start_compress(&cinfo, TRUE);
pixels=(unsigned char *)Malloc(height*width*3);
glReadPixels(0,0,width,height,GL_RGB,GL_UNSIGNED_BYTE,pixels);
row_stride = width * 3;
i=cinfo.image_height-1;
while (i >= 0) {
/* jpeg_write_scanlines expects an array of pointers to scanlines.
* Here the array is only one element long, but you could pass
* more than one scanline at a time if that's more convenient.
*/
row_pointer[0] = &pixels[i * row_stride];
(void) jpeg_write_scanlines(&cinfo, row_pointer, 1);
i--;
}
jpeg_finish_compress(&cinfo);
jpeg_destroy_compress(&cinfo);
Free(pixels);
}
#ifndef _GL2JPEG_H_
#define _GL2JPEG_H_
void create_jpeg(FILE *outfile, int width, int height);
#endif
# $Id: Makefile,v 1.26 2000-12-18 14:54:46 geuzaine Exp $ # $Id: Makefile,v 1.27 2000-12-20 10:40:28 geuzaine Exp $
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Makefile for Gmsh # Makefile for Gmsh
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
...@@ -25,8 +25,9 @@ ...@@ -25,8 +25,9 @@
MOTIF_LIB = -L/usr/local/lib -L/usr/X11R6/LessTif/Motif1.2/lib -lXm MOTIF_LIB = -L/usr/local/lib -L/usr/X11R6/LessTif/Motif1.2/lib -lXm
X_LIB = -L/usr/X11R6/lib -lXt -lX11 -lXext X_LIB = -L/usr/X11R6/lib -lXt -lX11 -lXext
THREAD_LIB = -L/usr/lib -lpthread THREAD_LIB = -L/usr/lib -lpthread
JPEG_LIB = jpeg/libjpeg.a
GMSH_DIR = Adapt Common DataStr Geo Graphics Mesh Parser Unix GMSH_DIR = Adapt Common DataStr Geo Graphics Mesh Parser Unix jpeg
GMSH_DISTRIB_DIR = $(GMSH_DIR) utils GMSH_DISTRIB_DIR = $(GMSH_DIR) utils
GMSH_BOX_DIR = Adapt Box Common DataStr Geo Mesh Parser GMSH_BOX_DIR = Adapt Box Common DataStr Geo Mesh Parser
GMSH_BIN_DIR = bin GMSH_BIN_DIR = bin
...@@ -36,7 +37,7 @@ GMSH_DISTRIB_DIR = $(GMSH_DIR) utils ...@@ -36,7 +37,7 @@ GMSH_DISTRIB_DIR = $(GMSH_DIR) utils
GMSH_TUTOR_DIR = tutorial GMSH_TUTOR_DIR = tutorial
GMSH_ARCHIVE_DIR = archives GMSH_ARCHIVE_DIR = archives
GMSH_LIB = -L$(GMSH_LIB_DIR) -lUnix -lGraphics -lParser -lMesh -lGeo\ GMSH_LIB = -L$(GMSH_LIB_DIR) -lUnix -lGraphics -lParser -lMesh -lGeo\
-lAdapt -lCommon -lDataStr -lAdapt -lCommon -lDataStr $(JPEG_LIB)
GMSH_BOX_LIB = -L$(GMSH_LIB_DIR) -lBox -lParser -lMesh -lGeo\ GMSH_BOX_LIB = -L$(GMSH_LIB_DIR) -lBox -lParser -lMesh -lGeo\
-lAdapt -lCommon -lDataStr -lAdapt -lCommon -lDataStr
GMSH_ARCHIVE = $(GMSH_ARCHIVE_DIR)/gmsh-`date "+%Y.%m.%d"` GMSH_ARCHIVE = $(GMSH_ARCHIVE_DIR)/gmsh-`date "+%Y.%m.%d"`
......
# Generated automatically from Makefile.auto by configure.
# Makefile for Independent JPEG Group's software
# makefile.auto is edited by configure to produce a custom Makefile.
# Read installation instructions before saying "make" !!
# For compiling with source and object files in different directories.
srcdir = .
VPATH = .
# Where to install the programs and man pages.
prefix = /usr/cluster
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
includedir = $(prefix)/include
mandir = $(prefix)/man/man1
binprefix =
manprefix =
manext = 1
# The name of your C compiler:
CC= gcc
# You may need to adjust these cc options:
CFLAGS= -O -I$(srcdir)
# Generally, we recommend defining any configuration symbols in jconfig.h,
# NOT via -D switches here.
# However, any special defines for ansi2knr.c may be included here:
ANSI2KNRFLAGS=
# Link-time cc options:
LDFLAGS=
# To link any special libraries, add the necessary -l commands here.
LDLIBS=
# Put here the object file name for the correct system-dependent memory
# manager file. For Unix this is usually jmemnobs.o, but you may want
# to use jmemansi.o or jmemname.o if you have limited swap space.
SYSDEPMEM= jmemnobs.o
# miscellaneous OS-dependent stuff
SHELL= /bin/sh
# linker
LN= $(CC)
# file deletion command
RM= rm -f
# file rename command
MV= mv
# library (.a) file creation command
AR= ar rc
# second step in .a creation (use "touch" if not needed)
AR2= ranlib
# installation program
INSTALL= /bin/install -c
INSTALL_PROGRAM= $(INSTALL)
INSTALL_DATA= $(INSTALL) -m 644
# End of configurable options.
# source files: JPEG library proper
LIBSOURCES= jcapi.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c jcmainct.c \
jcmarker.c jcmaster.c jcomapi.c jcparam.c jcprepct.c jcsample.c \
jdapi.c jdatasrc.c jdatadst.c jdcoefct.c jdcolor.c jddctmgr.c \
jdhuff.c jdmainct.c jdmarker.c jdmaster.c jdpostct.c jdsample.c \
jerror.c jutils.c jfdctfst.c jfdctflt.c jfdctint.c jidctfst.c \
jidctflt.c jidctint.c jidctred.c jquant1.c jquant2.c jdmerge.c \
jmemmgr.c jmemansi.c jmemname.c jmemnobs.c jmemdos.c
# source files: cjpeg/djpeg applications, also rdjpgcom/wrjpgcom
APPSOURCES= cjpeg.c djpeg.c rdcolmap.c rdppm.c wrppm.c rdgif.c wrgif.c \
rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c rdjpgcom.c \
wrjpgcom.c
SOURCES= $(LIBSOURCES) $(APPSOURCES)
# files included by source files
INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h \
jpeglib.h jversion.h cdjpeg.h cderror.h
# documentation, test, and support files
DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 rdjpgcom.1 wrjpgcom.1 \
example.c libjpeg.doc structure.doc coderules.doc filelist.doc \
change.log
MKFILES= configure makefile.auto makefile.ansi makefile.unix makefile.manx \
makefile.sas makcjpeg.st makdjpeg.st makljpeg.st makefile.bcc \
makefile.mc6 makefile.dj makefile.mms makefile.vms makvms.opt
CONFIGFILES= jconfig.auto jconfig.manx jconfig.sas jconfig.st jconfig.bcc \
jconfig.mc6 jconfig.dj jconfig.vms
OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm
TESTFILES= testorig.jpg testimg.ppm testimg.gif testimg.jpg
DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \
$(OTHERFILES) $(TESTFILES)
# library object files common to compression and decompression
COMOBJECTS= jcomapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM)
# compression library object files
CLIBOBJECTS= jcapi.o jcparam.o jdatadst.o jcmaster.o jcmarker.o jcmainct.o \
jcprepct.o jccoefct.o jccolor.o jcsample.o jchuff.o jcdctmgr.o \
jfdctfst.o jfdctflt.o jfdctint.o
# decompression library object files
DLIBOBJECTS= jdapi.o jdatasrc.o jdmaster.o jdmarker.o jdmainct.o jdcoefct.o \
jdpostct.o jddctmgr.o jidctfst.o jidctflt.o jidctint.o jidctred.o \
jdhuff.o jdsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o
# These objectfiles are included in libjpeg.a
LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
# object files for cjpeg and djpeg applications (excluding library files)
COBJECTS= cjpeg.o rdppm.o rdgif.o rdtarga.o rdrle.o rdbmp.o
DOBJECTS= djpeg.o wrppm.o wrgif.o wrtarga.o wrrle.o wrbmp.o rdcolmap.o
#all: libjpeg.a cjpeg djpeg rdjpgcom wrjpgcom
all: libjpeg.a
# This rule causes ansi2knr to be invoked.
# .c.o:
# ./ansi2knr $(srcdir)/$*.c T$*.c
# $(CC) $(CFLAGS) -c T$*.c
# $(RM) T$*.c $*.o
# $(MV) T$*.o $*.o
ansi2knr: ansi2knr.c
$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
libjpeg.a: $(LIBOBJECTS)
$(RM) libjpeg.a
$(AR) libjpeg.a $(LIBOBJECTS)
$(AR2) libjpeg.a
cjpeg: $(COBJECTS) libjpeg.a
$(LN) $(LDFLAGS) -o cjpeg $(COBJECTS) libjpeg.a $(LDLIBS)
djpeg: $(DOBJECTS) libjpeg.a
$(LN) $(LDFLAGS) -o djpeg $(DOBJECTS) libjpeg.a $(LDLIBS)
rdjpgcom: rdjpgcom.o
$(LN) $(LDFLAGS) -o rdjpgcom rdjpgcom.o $(LDLIBS)
wrjpgcom: wrjpgcom.o
$(LN) $(LDFLAGS) -o wrjpgcom wrjpgcom.o $(LDLIBS)
jconfig.h: jconfig.doc
echo You must prepare a system-dependent jconfig.h file.
echo Please read the installation directions in install.doc.
exit 1
install: cjpeg djpeg rdjpgcom wrjpgcom
$(INSTALL_PROGRAM) cjpeg $(bindir)/$(binprefix)cjpeg
$(INSTALL_PROGRAM) djpeg $(bindir)/$(binprefix)djpeg
$(INSTALL_PROGRAM) rdjpgcom $(bindir)/$(binprefix)rdjpgcom
$(INSTALL_PROGRAM) wrjpgcom $(bindir)/$(binprefix)wrjpgcom
$(INSTALL_DATA) $(srcdir)/cjpeg.1 $(mandir)/$(manprefix)cjpeg.$(manext)
$(INSTALL_DATA) $(srcdir)/djpeg.1 $(mandir)/$(manprefix)djpeg.$(manext)
$(INSTALL_DATA) $(srcdir)/rdjpgcom.1 $(mandir)/$(manprefix)rdjpgcom.$(manext)
$(INSTALL_DATA) $(srcdir)/wrjpgcom.1 $(mandir)/$(manprefix)wrjpgcom.$(manext)
install-lib: libjpeg.a jconfig.h
$(INSTALL_DATA) libjpeg.a $(libdir)/$(binprefix)libjpeg.a
$(INSTALL_DATA) jconfig.h $(includedir)/jconfig.h
$(INSTALL_DATA) $(srcdir)/jpeglib.h $(includedir)/jpeglib.h
$(INSTALL_DATA) $(srcdir)/jmorecfg.h $(includedir)/jmorecfg.h
$(INSTALL_DATA) $(srcdir)/jerror.h $(includedir)/jerror.h
clean:
$(RM) *.o cjpeg djpeg libjpeg.a rdjpgcom wrjpgcom ansi2knr core testout.*
distribute:
$(RM) jpegsrc.tar*
tar cvf jpegsrc.tar $(DISTFILES)
compress -v jpegsrc.tar
test: cjpeg djpeg
$(RM) testout.ppm testout.gif testout.jpg
./djpeg -dct int -ppm -outfile testout.ppm testorig.jpg
./djpeg -dct int -gif -outfile testout.gif testorig.jpg
./cjpeg -dct int -outfile testout.jpg testimg.ppm
cmp testimg.ppm testout.ppm
cmp testimg.gif testout.gif
cmp testimg.jpg testout.jpg
check: test
# GNU Make likes to know which target names are not really files to be made:
.PHONY: all install install-lib clean distribute test check
jcapi.o : jcapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jccoefct.o : jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jccolor.o : jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcdctmgr.o : jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jchuff.o : jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcmainct.o : jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcmarker.o : jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcmaster.o : jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcomapi.o : jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcparam.o : jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcprepct.o : jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcsample.o : jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdapi.o : jdapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdatasrc.o : jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
jdatadst.o : jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
jdcoefct.o : jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdcolor.o : jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jddctmgr.o : jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jdhuff.o : jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdmainct.o : jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdmarker.o : jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdmaster.o : jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdpostct.o : jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdsample.o : jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jerror.o : jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h
jutils.o : jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jfdctfst.o : jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jfdctflt.o : jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jfdctint.o : jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jidctfst.o : jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jidctflt.o : jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jidctint.o : jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jidctred.o : jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jquant1.o : jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jquant2.o : jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdmerge.o : jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jmemmgr.o : jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
jmemansi.o : jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
jmemname.o : jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
jmemnobs.o : jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
jmemdos.o : jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
cjpeg.o : cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
djpeg.o : djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
rdcolmap.o : rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdppm.o : rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
wrppm.o : wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdgif.o : rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
wrgif.o : wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdtarga.o : rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
wrtarga.o : wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdbmp.o : rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
wrbmp.o : wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdrle.o : rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
wrrle.o : wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdjpgcom.o : rdjpgcom.c jinclude.h jconfig.h
wrjpgcom.o : wrjpgcom.c jinclude.h jconfig.h
...@@ -87,11 +87,12 @@ EndFor ...@@ -87,11 +87,12 @@ EndFor
// Here is the list of available scripting commands: // Here is the list of available scripting commands:
// //
// Merge string; (to merge a file) // Merge string; (to merge a file)
// Draw; (to draw the scene) // Draw; (to draw the scene)
// Mesh int; (to perform the mesh generation; 'int' = 0, 1, 2 or 3) // Mesh int; (to perform the mesh generation; 'int' = 0, 1, 2 or 3)
// Save string; (to save the mesh) // Save string; (to save the mesh)
// Print string; (to print the graphic window) // Print string; (to print the graphic window)
// Sleep expr; (to sleep during expr seconds) // Sleep expr; (to sleep during expr seconds)
// Delete View[int] (to free the view int) // Delete View[int]; (to free the view int)
// Delete Meshes (to free all meshes) // Delete Meshes; (to free all meshes)
// System string; (to execute a system call)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment