Remove unused and obsolete JPEG image demo.

Fix GLUT include in fracviewer.cxx.

Add explicit dependencies on .o files for each demo program; this allows
FLTK to be compiled with older (broken) make programs that don't support
multi-step dependencies.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1928 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2002-01-13 18:38:24 +00:00
parent c874ba21a9
commit a33a9e34d4
3 changed files with 124 additions and 233 deletions

View File

@ -1,5 +1,5 @@
#
# "$Id: Makefile,v 1.19.2.7.2.27 2002/01/03 14:08:08 easysw Exp $"
# "$Id: Makefile,v 1.19.2.7.2.28 2002/01/13 18:38:24 easysw Exp $"
#
# Test/example program makefile for the Fast Light Tool Kit (FLTK).
#
@ -150,49 +150,167 @@ GLALL = \
gl_overlay$(EXEEXT) \
glpuzzle$(EXEEXT) \
shape$(EXEEXT) \
shiny$(EXEEXT) \
shiny$(EXEEXT)
all: $(ALL) $(GLDEMOS)
gldemos: $(GLALL)
depend: $(CPPFILES)
makedepend -Y -I.. -f makedepend $(CPPFILES)
clean:
-@ rm -f $(ALL) $(GLALL) *.o core *~
install:
@echo Nothing to install in test directory.
uninstall:
@echo Nothing to uninstall in test directory.
# FLUID file rules
.fl.cxx .fl.h:
echo Generating $<...
../fluid/fluid -c $<
$(ALL): ../lib/$(LIBNAME)
# All demos depend on the FLTK library...
$(ALL): ../lib/$(LIBNAME)
# General demos...
adjuster$(EXEEXT): adjuster.o
arc$(EXEEXT): arc.o
ask$(EXEEXT): ask.o
bitmap$(EXEEXT): bitmap.o
boxtype$(EXEEXT): boxtype.o
browser$(EXEEXT): browser.o
button$(EXEEXT): button.o
buttons$(EXEEXT): buttons.o
checkers$(EXEEXT): checkers.o
clock$(EXEEXT): clock.o
colbrowser$(EXEEXT): colbrowser.o
color_chooser$(EXEEXT): color_chooser.o
cursor$(EXEEXT): cursor.o
curve$(EXEEXT): curve.o
demo$(EXEEXT): demo.o
doublebuffer$(EXEEXT): doublebuffer.o
# Programs needing special instructions...
editor$(EXEEXT): editor.o
echo Linking $@...
$(CXX) -I.. $(CXXFLAGS) editor.o -o $@ $(LINKFLTK) $(LDLIBS) $(IMAGELIBS)
$(POSTBUILD) $@ ../FL/mac.r
fast_slow$(EXEEXT): fast_slow.o
fast_slow.cxx: ../fluid/fluid
file_chooser$(EXEEXT): file_chooser.o
echo Linking $@...
$(CXX) -I.. $(CXXFLAGS) file_chooser.o -o $@ $(LINKFLTK) $(LDLIBS) $(IMAGELIBS)
$(POSTBUILD) $@ ../FL/mac.r
fonts$(EXEEXT): fonts.o
forms$(EXEEXT): forms.o
hello$(EXEEXT): hello.o
help$(EXEEXT): help.o
echo Linking $@...
$(CXX) -I.. $(CXXFLAGS) help.o -o $@ $(LINKFLTK) $(LDLIBS) $(IMAGELIBS)
$(POSTBUILD) $@ ../FL/mac.r
iconize$(EXEEXT): iconize.o
image$(EXEEXT): image.o
inactive$(EXEEXT): inactive.o
inactive.cxx: ../fluid/fluid
input$(EXEEXT): input.o
keyboard$(EXEEXT): keyboard_ui.o keyboard.o
echo Linking $@...
$(CXX) -I.. $(CXXFLAGS) keyboard.o keyboard_ui.o $(LINKFLTK) $(LDLIBS) -o $@
$(POSTBUILD) $@ ../FL/mac.r
keyboard_ui.o: keyboard_ui.h ../fluid/fluid
label$(EXEEXT): label.o
line_style$(EXEEXT): line_style.o
list_visuals$(EXEEXT): list_visuals.o
mandelbrot$(EXEEXT): mandelbrot_ui.o mandelbrot.o
echo Linking $@...
$(CXX) -I.. $(CXXFLAGS) mandelbrot.o mandelbrot_ui.o $(LINKFLTK) $(LDLIBS) -o $@
$(POSTBUILD) $@ ../FL/mac.r
mandelbrot_ui.o: mandelbrot_ui.h ../fluid/fluid
menubar$(EXEEXT): menubar.o
message$(EXEEXT): message.o
minimum$(EXEEXT): minimum.o
navigation$(EXEEXT): navigation.o
output$(EXEEXT): output.o
overlay$(EXEEXT): overlay.o
pack$(EXEEXT): pack.o
pixmap$(EXEEXT): pixmap.o
pixmap_browser$(EXEEXT): pixmap_browser.o
echo Linking $@...
$(CXX) -I.. $(CXXFLAGS) pixmap_browser.o -o $@ $(LINKFLTK) $(LDLIBS) $(IMAGELIBS)
$(POSTBUILD) $@ ../FL/mac.r
radio$(EXEEXT): radio.o
radio.cxx: ../fluid/fluid
resize$(EXEEXT): resize.o
resize.cxx: ../fluid/fluid
resizebox$(EXEEXT): resizebox.o
scroll$(EXEEXT): scroll.o
subwindow$(EXEEXT): subwindow.o
symbols$(EXEEXT): symbols.o
tabs$(EXEEXT): tabs.o
tabs.cxx: ../fluid/fluid
threads$(EXEEXT): threads.o
tile$(EXEEXT): tile.o
tiled_image$(EXEEXT): tiled_image.o
valuators$(EXEEXT): valuators.o
valuators.cxx: ../fluid/fluid
# All OpenGL demos depend on the FLTK and FLTK_GL libraries...
$(GLALL): ../lib/$(LIBNAME) ../lib/$(GLLIBNAME)
# OpenGL demos...
CubeView$(EXEEXT): CubeMain.o CubeView.o CubeViewUI.o
echo Linking $@...
@ -234,32 +352,7 @@ shape$(EXEEXT): shape.o
$(CXX) -I.. $(CXXFLAGS) shape.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS) -o $@
$(POSTBUILD) $@ ../FL/mac.r
fast_slow.cxx: ../fluid/fluid
inactive.cxx: ../fluid/fluid
radio.cxx: ../fluid/fluid
resize.cxx: ../fluid/fluid
tabs.cxx: ../fluid/fluid
valuators.cxx: ../fluid/fluid
# If you have libjpeg installed, you might want to try this test program:
jpeg_image$(EXEEXT): jpeg_image.o
echo Linking $@...
$(CXX) -I.. $(CXXFLAGS) jpeg_image.o $(LINKFLTK) $(LDLIBS) -ljpeg -lXext -o $@
$(POSTBUILD) $@ ../FL/mac.r
depend: $(CPPFILES)
makedepend -Y -I.. -f makedepend $(CPPFILES)
clean:
-@ rm -f $(ALL) $(GLALL) jpeg_image *.o core *~
install:
@echo Nothing to install in test directory.
uninstall:
@echo Nothing to uninstall in test directory.
#
# End of "$Id: Makefile,v 1.19.2.7.2.27 2002/01/03 14:08:08 easysw Exp $".
# End of "$Id: Makefile,v 1.19.2.7.2.28 2002/01/13 18:38:24 easysw Exp $".
#

View File

@ -15,7 +15,7 @@
#include <config.h>
#if HAVE_GL && HAVE_GL_GLU_H
# include <FL/glut.h>
# include <FL/glut.H>
# ifdef __APPLE__
# include <OpenGL/glu.h>
# else

View File

@ -1,202 +0,0 @@
//
// "$Id: jpeg_image.cxx,v 1.5.2.3.2.1 2002/01/01 15:11:33 easysw Exp $"
//
// fl_draw_image test program for the Fast Light Tool Kit (FLTK).
//
// Be sure to try every visual with the -v switch and try -m (monochrome)
// on each of them.
//
// This program requires either the libjpeg.a library or an internal DD
// library to read images (this is chosen by the presence of the "DD"
// #define).
//
// To get the jpeg library:
//
// The "official" archive site for this software is ftp.uu.net (Internet
// address 192.48.96.9). The most recent released version can always be
// found there in directory graphics/jpeg. This particular version will
// be archived as graphics/jpeg/jpegsrc.v6a.tar.gz.
//
// The makefile assummes you decompressed and build these in a directory
// called "jpeg-6a" in the same location as the "FL" directory.
//
// Copyright 1998-2002 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems to "fltk-bugs@fltk.org".
//
#include <FL/Fl.H>
#include <FL/fl_draw.H>
#include <stdio.h>
#include <stdlib.h>
void readtheimage(const char *name); // below
int width;
int height;
int depth;
int linedelta;
uchar *ibuffer;
////////////////////////////////////////////////////////////////
#include <FL/Fl_Window.H>
int mono;
class image_window : public Fl_Window {
void draw();
public:
image_window(int w,int h) : Fl_Window(w,h) {box(FL_NO_BOX);}
};
void image_window::draw() {
if (mono)
fl_draw_image_mono(ibuffer+1,0,0,width,height,depth,linedelta);
else
fl_draw_image(ibuffer,0,0,width,height,depth,linedelta);
}
////////////////////////////////////////////////////////////////
#include <FL/x.H>
#include "list_visuals.cxx"
////////////////////////////////////////////////////////////////
int visid = -1;
int arg(int argc, char **argv, int &i) {
if (argv[i][1] == 'm') {mono = 1; i++; return 1;}
if (argv[i][1] == 'v') {
if (i+1 >= argc) return 0;
visid = atoi(argv[i+1]);
i += 2;
return 2;
}
return 0;
}
int main(int argc, char ** argv) {
int i = 1;
if (!Fl::args(argc,argv,i,arg) || i != argc-1) {
fprintf(stderr,"usage: %s <switches> image_file\n"
" -v # : use visual\n"
" -m : monochrome\n"
"%s\n",
argv[0],Fl::help);
exit(1);
}
readtheimage(argv[i]);
image_window *window = new image_window(width,height);
if (visid>=0) {
fl_open_display();
XVisualInfo templt; int num;
templt.visualid = visid;
fl_visual = XGetVisualInfo(fl_display, VisualIDMask, &templt, &num);
if (!fl_visual) {
fprintf(stderr, "No visual with id %d, use one of:\n",visid);
list_visuals();
exit(1);
}
fl_colormap = XCreateColormap(fl_display, RootWindow(fl_display,fl_screen),
fl_visual->visual, AllocNone);
fl_xpixel(FL_BLACK); // make sure black is allocated
}
window->show(argc,argv);
return Fl::run();
}
////////////////////////////////////////////////////////////////
#ifndef DD_LIBRARY
// Read using jpeg library:
extern "C" {
#include "jpeglib.h"
}
void readtheimage(const char *name) {
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
FILE * infile = fopen(name, "rb");
if (!infile) {
fprintf(stderr, "can't open %s\n", name);
exit(1);
}
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo);
jpeg_stdio_src(&cinfo, infile);
jpeg_read_header(&cinfo, TRUE);
jpeg_start_decompress(&cinfo);
width = cinfo.output_width;
height = cinfo.output_height;
depth = cinfo.output_components;
ibuffer = new uchar[width*height*depth];
uchar *rp = ibuffer;
// for (int i=0; i<height; i++) {
for (int i=height; i--; ) {
jpeg_read_scanlines(&cinfo, &rp, 1);
rp += width*depth;
}
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
fclose(infile);
}
////////////////////////////////////////////////////////////////
#else // Digital Domain in-house library
#include "DDNewImage/DDImageOp.H"
#include "DDNewImage/DDImgRead.H"
#include "DDNewImage/DDImgToBuffer.H"
void readtheimage(const char *name) {
DDImgRead reader(name);
width = reader.xsize();
height = reader.ysize();
depth = 4; // reader.zsize();
ibuffer = new uchar[width*height*depth];
DDImgToBuffer b(&reader,depth,ibuffer,0,0,width,height);
b.execute();
if (DDImage::haderror) {
fprintf(stderr,"%s\n",DDImage::errormsg());
exit(1);
}
// swap it around into RGBA order:
for (uchar *p = ibuffer+width*height*4-4; p >= ibuffer; p-=4) {
uchar r = p[3];
uchar g = p[2];
uchar b = p[1];
uchar a = p[0];
p[0] = r;
p[1] = g;
p[2] = b;
p[3] = a;
}
// make it bottom-to-top:
ibuffer = ibuffer + width*(height-1)*depth;
linedelta = -(width*depth);
}
#endif
//
// End of "$Id: jpeg_image.cxx,v 1.5.2.3.2.1 2002/01/01 15:11:33 easysw Exp $".
//