Initial
This commit is contained in:
226
java/ANIMATE/ANIMATE.MAK
Normal file
226
java/ANIMATE/ANIMATE.MAK
Normal file
@@ -0,0 +1,226 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Java Virtual Machine Java Workspace" 0x0809
|
||||
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=animate - Java Virtual Machine Debug
|
||||
!MESSAGE No configuration specified. Defaulting to animate - Java Virtual\
|
||||
Machine Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "animate - Java Virtual Machine Release" && "$(CFG)" !=\
|
||||
"animate - Java Virtual Machine Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!MESSAGE You can specify a configuration when running NMAKE on this makefile
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "animate.mak" CFG="animate - Java Virtual Machine Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "animate - Java Virtual Machine Release" (based on\
|
||||
"Java Virtual Machine Java Workspace")
|
||||
!MESSAGE "animate - Java Virtual Machine Debug" (based on\
|
||||
"Java Virtual Machine Java Workspace")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
################################################################################
|
||||
# Begin Project
|
||||
# PROP Target_Last_Scanned "animate - Java Virtual Machine Debug"
|
||||
JAVA=jvc.exe
|
||||
|
||||
!IF "$(CFG)" == "animate - Java Virtual Machine Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir ""
|
||||
# PROP BASE Intermediate_Dir ""
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir ""
|
||||
# PROP Target_Dir ""
|
||||
OUTDIR=.
|
||||
INTDIR=.
|
||||
|
||||
ALL : "$(OUTDIR)\Animation.class" "$(OUTDIR)\BlackModel.class"\
|
||||
"$(OUTDIR)\BlackFilter.class" "$(OUTDIR)\GrayModel.class"\
|
||||
"$(OUTDIR)\GrayFilter.class"
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\Animation.class"
|
||||
-@erase "$(INTDIR)\BlackFilter.class"
|
||||
-@erase "$(INTDIR)\BlackModel.class"
|
||||
-@erase "$(INTDIR)\GrayFilter.class"
|
||||
-@erase "$(INTDIR)\GrayModel.class"
|
||||
|
||||
# ADD BASE JAVA /O
|
||||
# ADD JAVA /O
|
||||
|
||||
!ELSEIF "$(CFG)" == "animate - Java Virtual Machine Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir ""
|
||||
# PROP BASE Intermediate_Dir ""
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir ""
|
||||
# PROP Target_Dir ""
|
||||
OUTDIR=.
|
||||
INTDIR=.
|
||||
|
||||
ALL : "$(OUTDIR)\Animation.class" "$(OUTDIR)\BlackModel.class"\
|
||||
"$(OUTDIR)\BlackFilter.class" "$(OUTDIR)\GrayModel.class"\
|
||||
"$(OUTDIR)\GrayFilter.class"
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\Animation.class"
|
||||
-@erase "$(INTDIR)\BlackFilter.class"
|
||||
-@erase "$(INTDIR)\BlackModel.class"
|
||||
-@erase "$(INTDIR)\GrayFilter.class"
|
||||
-@erase "$(INTDIR)\GrayModel.class"
|
||||
|
||||
# ADD BASE JAVA /g
|
||||
# ADD JAVA /g
|
||||
|
||||
!ENDIF
|
||||
|
||||
################################################################################
|
||||
# Begin Target
|
||||
|
||||
# Name "animate - Java Virtual Machine Release"
|
||||
# Name "animate - Java Virtual Machine Debug"
|
||||
|
||||
!IF "$(CFG)" == "animate - Java Virtual Machine Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "animate - Java Virtual Machine Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Animation.java
|
||||
|
||||
!IF "$(CFG)" == "animate - Java Virtual Machine Release"
|
||||
|
||||
|
||||
"$(INTDIR)\Animation.class" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "animate - Java Virtual Machine Debug"
|
||||
|
||||
|
||||
"$(INTDIR)\Animation.class" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\index.html
|
||||
|
||||
!IF "$(CFG)" == "animate - Java Virtual Machine Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "animate - Java Virtual Machine Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\BlackModel.java
|
||||
|
||||
!IF "$(CFG)" == "animate - Java Virtual Machine Release"
|
||||
|
||||
|
||||
"$(INTDIR)\BlackModel.class" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "animate - Java Virtual Machine Debug"
|
||||
|
||||
|
||||
"$(INTDIR)\BlackModel.class" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\BlackFilter.java
|
||||
|
||||
!IF "$(CFG)" == "animate - Java Virtual Machine Release"
|
||||
|
||||
|
||||
"$(INTDIR)\BlackFilter.class" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "animate - Java Virtual Machine Debug"
|
||||
|
||||
|
||||
"$(INTDIR)\BlackFilter.class" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\GrayModel.java
|
||||
|
||||
!IF "$(CFG)" == "animate - Java Virtual Machine Release"
|
||||
|
||||
|
||||
"$(INTDIR)\GrayModel.class" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "animate - Java Virtual Machine Debug"
|
||||
|
||||
|
||||
"$(INTDIR)\GrayModel.class" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\GrayFilter.java
|
||||
|
||||
!IF "$(CFG)" == "animate - Java Virtual Machine Release"
|
||||
|
||||
|
||||
"$(INTDIR)\GrayFilter.class" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "animate - Java Virtual Machine Debug"
|
||||
|
||||
|
||||
"$(INTDIR)\GrayFilter.class" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
################################################################################
|
||||
BIN
java/ANIMATE/ANIMATE.MDP
Normal file
BIN
java/ANIMATE/ANIMATE.MDP
Normal file
Binary file not shown.
43
java/ANIMATE/Animation.java
Normal file
43
java/ANIMATE/Animation.java
Normal file
@@ -0,0 +1,43 @@
|
||||
import java.awt.*;
|
||||
import java.applet.Applet;
|
||||
import java.awt.image.*;
|
||||
|
||||
public class Animation extends java.applet.Applet // implements Runnable
|
||||
{
|
||||
private Image mImage;
|
||||
private Image mTransImage;
|
||||
// private GrayFilter mCropFilter;
|
||||
private CropImageFilter mCropFilter;
|
||||
|
||||
|
||||
public Animation()
|
||||
{
|
||||
}
|
||||
public void init()
|
||||
{
|
||||
mImage=getImage(getCodeBase(),"ball.jpg");
|
||||
// mBlackFilter=new BlackFilter();
|
||||
mCropFilter=new CropImageFilter(25,30,75,75);
|
||||
// mCropFilter=new GrayFilter();
|
||||
|
||||
// mTransImage=createImage(new FilteredImageSource(mImage.getSource(),mCropFilter));
|
||||
|
||||
MediaTracker mediaTracker=new MediaTracker(this);
|
||||
mediaTracker.addImage(mImage,0);
|
||||
// mediaTracker.addImage(mImage,0);
|
||||
try{mediaTracker.waitForAll();}
|
||||
catch(Exception ignore){;}
|
||||
mTransImage=createImage(new FilteredImageSource(mImage.getSource(),mCropFilter));
|
||||
repaint();
|
||||
}
|
||||
public void update(Graphics graphics)
|
||||
{
|
||||
paint(graphics);
|
||||
}
|
||||
public synchronized void paint(Graphics graphics)
|
||||
{
|
||||
if(null!=mTransImage)graphics.drawImage(mTransImage,0,0,this);
|
||||
graphics.drawImage(mImage,60,60,this);
|
||||
// graphics.drawImage(mImage,0,0,this);
|
||||
}
|
||||
}
|
||||
BIN
java/ANIMATE/BALL.BMP
Normal file
BIN
java/ANIMATE/BALL.BMP
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
BIN
java/ANIMATE/BALL.JPG
Normal file
BIN
java/ANIMATE/BALL.JPG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
17
java/ANIMATE/BlackFilter.java
Normal file
17
java/ANIMATE/BlackFilter.java
Normal file
@@ -0,0 +1,17 @@
|
||||
import java.awt.image.*;
|
||||
|
||||
public class BlackFilter extends RGBImageFilter
|
||||
{
|
||||
public BlackFilter()
|
||||
{
|
||||
canFilterIndexColorModel=false;
|
||||
}
|
||||
public void setColorModel(ColorModel colorModel)
|
||||
{
|
||||
substituteColorModel(colorModel,new BlackModel(colorModel));
|
||||
}
|
||||
public int filterRGB(int x,int y,int pixel)
|
||||
{ // must be present, will not get called
|
||||
return pixel;
|
||||
}
|
||||
};
|
||||
32
java/ANIMATE/BlackModel.java
Normal file
32
java/ANIMATE/BlackModel.java
Normal file
@@ -0,0 +1,32 @@
|
||||
import java.awt.image.*;
|
||||
|
||||
public class BlackModel extends ColorModel
|
||||
{
|
||||
ColorModel originalModel;
|
||||
|
||||
public BlackModel(ColorModel colorModel)
|
||||
{
|
||||
super(colorModel.getPixelSize());
|
||||
originalModel=colorModel;
|
||||
}
|
||||
public int getAlpha(int pixel)
|
||||
{
|
||||
return originalModel.getAlpha(pixel);
|
||||
}
|
||||
public int getRed(int pixel)
|
||||
{
|
||||
return originalModel.getRed(pixel);
|
||||
}
|
||||
public int getGreen(int pixel)
|
||||
{
|
||||
return originalModel.getGreen(pixel);
|
||||
}
|
||||
public int getBlue(int pixel)
|
||||
{
|
||||
return originalModel.getBlue(pixel);
|
||||
}
|
||||
public int getRGB(int pixel)
|
||||
{
|
||||
return originalModel.getRGB(pixel);
|
||||
}
|
||||
};
|
||||
29
java/ANIMATE/GrayFilter.java
Normal file
29
java/ANIMATE/GrayFilter.java
Normal file
@@ -0,0 +1,29 @@
|
||||
import java.awt.image.*;
|
||||
|
||||
// This class sets up a very simple image graying
|
||||
// filter. It takes the original color model and
|
||||
// sets up a substutition to a GrayModel.
|
||||
public class GrayFilter extends RGBImageFilter
|
||||
{
|
||||
public GrayFilter()
|
||||
{
|
||||
canFilterIndexColorModel = true;
|
||||
}
|
||||
|
||||
// When the color model is first set, create a gray
|
||||
// model based on the original model and set it up as
|
||||
// the substitute color model.
|
||||
|
||||
public void setColorModel(ColorModel cm)
|
||||
{
|
||||
substituteColorModel(cm, new GrayModel(cm));
|
||||
}
|
||||
|
||||
// This method has to be present, but it will never be called
|
||||
// because we are doing a color model substitution.
|
||||
|
||||
public int filterRGB(int x, int y, int pixel)
|
||||
{
|
||||
return pixel;
|
||||
}
|
||||
}
|
||||
64
java/ANIMATE/GrayModel.java
Normal file
64
java/ANIMATE/GrayModel.java
Normal file
@@ -0,0 +1,64 @@
|
||||
import java.awt.image.*;
|
||||
|
||||
// This class implements a gray color model
|
||||
// scheme based on another color model. It acts
|
||||
// like a gray filter. To compute the amount of
|
||||
// gray for a pixel, it takes the max of the red,
|
||||
// green, and blue components and uses that value
|
||||
// for all three color components.
|
||||
|
||||
public class GrayModel extends ColorModel
|
||||
{
|
||||
ColorModel originalModel;
|
||||
|
||||
public GrayModel(ColorModel originalModel)
|
||||
{
|
||||
super(originalModel.getPixelSize());
|
||||
this.originalModel = originalModel;
|
||||
}
|
||||
|
||||
// The amount of gray is the max of the red, green, and blue
|
||||
protected int getGrayLevel(int pixel)
|
||||
{
|
||||
return Math.max(originalModel.getRed(pixel),
|
||||
Math.max(originalModel.getGreen(pixel),
|
||||
originalModel.getBlue(pixel)));
|
||||
}
|
||||
|
||||
// Leave the alpha values untouched
|
||||
public int getAlpha(int pixel)
|
||||
{
|
||||
return originalModel.getAlpha(pixel);
|
||||
}
|
||||
|
||||
// Since gray requires red, green and blue to be the same,
|
||||
// use the same gray level value for red, green, and blue
|
||||
|
||||
public int getRed(int pixel)
|
||||
{
|
||||
return getGrayLevel(pixel);
|
||||
}
|
||||
|
||||
public int getGreen(int pixel)
|
||||
{
|
||||
return getGrayLevel(pixel);
|
||||
}
|
||||
|
||||
public int getBlue(int pixel)
|
||||
{
|
||||
return getGrayLevel(pixel);
|
||||
}
|
||||
|
||||
// Normally, this method queries the red, green, blue and
|
||||
// alpha values and returns them in the form 0xaarrggbb. To
|
||||
// keep from computing the gray level 3 times, we just override
|
||||
// this method, get the gray level once, and return it as the
|
||||
// red, green, and blue, and add in the original alpha value.
|
||||
|
||||
public int getRGB(int pixel)
|
||||
{
|
||||
int gray = getGrayLevel(pixel);
|
||||
return (getAlpha(pixel) << 24) + (gray << 16) +
|
||||
(gray << 8) + gray;
|
||||
}
|
||||
}
|
||||
11
java/ANIMATE/INDEX~1.HTM
Normal file
11
java/ANIMATE/INDEX~1.HTM
Normal file
@@ -0,0 +1,11 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>proto</title>
|
||||
</head>
|
||||
<body>
|
||||
<hr>
|
||||
<applet code=Animation.class id=Animation width=320 height=240 >
|
||||
</applet>
|
||||
<hr>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user