Subversion Repositories PlanixRsrch.SVN

Compare Revisions

Ignore whitespace Rev 1 → Rev 106

/tags/hist-1992-2002/hexenspiel/ellipse2.c
0,0 → 1,53
/* ---------------------------------------------------------------
SETPATT.C
(c) 1992 by Tobias Herre
part of DISPLAY.LIB version 1.0
----------------------------------------------------------------*/
 
#include "display.h"
/*----------------------------------------------------------------------------
Ellipse zeichnen (bei x,y mit Radius a und b)
*/
void Ellipse(int x,int y,int a,int b)
{
int x1,y1;
long ref,xan,yan,xann,yann;
 
x1=0;y1=b;
 
xan=(long)b*(long)b; /* Anstieg fr X berechnen */
xann=2L*(long)b*(long)b; /* Anstieg fr X-Anstieg berechnen */
 
yan=-2L*(long)y1*(long)a*(long)a+(long)a*(long)a; /* Anstieg fr Y */
yann=2L*(long)a*(long)a; /* Anstieg des Y-Anstieges */
 
ref=xan/2;
 
while (y1>=0){
PutPixel(x+x1,y+y1);
PutPixel(x-x1,y+y1);
PutPixel(x+x1,y-y1);
PutPixel(x-x1,y-y1);
 
if(ref+yan<0){
ref+=xan; xan+=xann; x1++;
if(ref+ref+yan>=0){
ref+=yan; yan+=yann; y1--;
}
}
else{
ref+=yan; yan+=yann; y1--;
if (ref+ref+xan<0){
ref+=xan; xan+=xann; x1++;
}
}
}
y1++;
while(x1<=a){
PutPixel(x+x1,y+y1);
PutPixel(x-x1,y+y1);
PutPixel(x+x1,y-y1);
PutPixel(x-x1,y-y1);
x1++;
}
}
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/fillbox.c
===================================================================
--- hist-1992-2002/hexenspiel/fillbox.c (nonexistent)
+++ hist-1992-2002/hexenspiel/fillbox.c (revision 106)
@@ -0,0 +1,25 @@
+/* ---------------------------------------------------------------
+FILLBOX.C
+(c) 1992 by Tobias Herre
+Bestandteil von DISPLAY.LIB Version 1.0
+----------------------------------------------------------------*/
+
+#include "display.h"
+/*---------------------------------------------------------------
+ Zeichnen einer ausgefllten Box (x1,y1,x2,y2)
+*/
+void FillBox(int x1,int y1,int x2,int y2)
+{
+ int dir;
+ if(_GetClippedBox(&x1,&y1,&x2,&y2) == 0) return;
+
+ if(y1<y2) dir=1;
+ else dir=-1;
+
+ /* zeichnen der Box */
+ HLine(x1,x2,y1);
+ while(y1!=y2){
+ y1+=dir;
+ HLine(x1,x2,y1);
+ }
+}
/hist-1992-2002/hexenspiel/fillbox.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/ConvexPolygonShape.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/hist-1992-2002/hexenspiel/ConvexPolygonShape.class
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/elib/line.c
===================================================================
--- hist-1992-2002/hexenspiel/elib/line.c (nonexistent)
+++ hist-1992-2002/hexenspiel/elib/line.c (revision 106)
@@ -0,0 +1,71 @@
+/*----------------------------------------------------------------------
+line.c
+Copyright (c) 1993 by Tobias Herre
+----------------------------------------------------------------------*/
+
+#include "display.h"
+
+/*----------------------------------------------------------------------
+Line
+ Zeichnet eine Linie mit Breasenhams Algorithmus
+Eingabe:
+ (x1,y1): Startpunkt
+ (x2,y2): Endpunkt
+----------------------------------------------------------------------*/
+void Line(int x1,int y1,int x2,int y2)
+{
+ int dx,dy,xdir,ydir,sum;
+
+ if( _GetClippedLine(&x1,&y1,&x2,&y2) == 0 ) return;
+
+ dx=x2-x1;dy=y2-y1;
+
+ /* Schrittrichtungen fuer x und y ermitteln */
+
+ if (dx<0)
+ {
+ xdir=-1; dx=-dx;
+ }
+ else
+ xdir=1;
+
+ if (dy<0)
+ {
+ ydir=-1; dy=-dy;
+ }
+ else
+ ydir=1;
+
+
+ /* Linie Zeichnen */
+
+ PutPixel(x1,y1); /* Erster Punkt ist immer klar */
+
+ if(dx>=dy) /* Linie mit Anstieg kleiner als 1 */
+ {
+ sum=dx>>1;
+ while(x1!=x2)
+ {
+ sum-=dy;x1+=xdir;
+ if (sum<0)
+ {
+ y1+=ydir; sum+=dx;
+ }
+ PutPixel(x1,y1);
+ }
+ }
+ else
+ { /* Linie mit Anstieg groesser als 1 */
+ sum=dy>>1;
+ while( y1!=y2 )
+ {
+ sum-=dx;y1+=ydir;
+ if (sum<0)
+ {
+ x1+=xdir; sum+=dy;
+ }
+ PutPixel(x1,y1);
+ }
+ }
+ /* Linie zeichnen beendet */
+}
/hist-1992-2002/hexenspiel/elib/line.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/elib/putpixel.c
===================================================================
--- hist-1992-2002/hexenspiel/elib/putpixel.c (nonexistent)
+++ hist-1992-2002/hexenspiel/elib/putpixel.c (revision 106)
@@ -0,0 +1,22 @@
+/*----------------------------------------------------------------------
+putpixel.c
+Copyright (c) 1993 by Tobias Herre
+----------------------------------------------------------------------*/
+
+#include "display.h"
+
+/***********************************************************************
+description:
+ the pointer to the active routine for pixel setting
+input:
+ (x,y): screen position
+***********************************************************************/
+
+void (* PutPixel)(int x,int y)=ColorPutPixel;
+
+
+
+void ColorPutPixel(int x,int y)
+{
+ _SYSPutPixel(x,y,color);
+}
/hist-1992-2002/hexenspiel/elib/putpixel.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/elib/sys.h
===================================================================
--- hist-1992-2002/hexenspiel/elib/sys.h (nonexistent)
+++ hist-1992-2002/hexenspiel/elib/sys.h (revision 106)
@@ -0,0 +1,11 @@
+/***********************************************************************
+sys.h
+Copyright (c) 1993 by Tobias Herre
+***********************************************************************/
+
+/***********************************************************************
+Systemabh„ngige Definitionen
+***********************************************************************/
+
+#define int32 long
+
/hist-1992-2002/hexenspiel/elib/sys.h
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/elib/vline.c
===================================================================
--- hist-1992-2002/hexenspiel/elib/vline.c (nonexistent)
+++ hist-1992-2002/hexenspiel/elib/vline.c (revision 106)
@@ -0,0 +1,30 @@
+/***********************************************************************
+vline.c
+Copyright (c) 1993 by Tobias Herre
+part of GRAPHLIB VERSION 1.0
+***********************************************************************/
+
+#include "display.h"
+
+/***********************************************************************
+description:
+ draw a vertical line
+input:
+ y1: start position
+ y2: end position
+ x: x position
+***********************************************************************/
+
+void VLine (int y1,int y2,int x)
+{
+ int dy,ydir;
+
+ /* if the line ist not visible return imediatly */
+ if(_GetClippedLine(&x,&y1,&x,&y2) == 0 ) return;
+
+ dy=y2-y1;if(dy<0) {dy=-dy;ydir=-1;} else ydir=1;
+ dy++;
+ while (dy){
+ PutPixel(x,y1); y1+=ydir; dy--;
+ }
+}
\ No newline at end of file
/hist-1992-2002/hexenspiel/elib/vline.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/getimgsi.c
===================================================================
--- hist-1992-2002/hexenspiel/getimgsi.c (nonexistent)
+++ hist-1992-2002/hexenspiel/getimgsi.c (revision 106)
@@ -0,0 +1,16 @@
+/* ---------------------------------------------------------------
+GETIMGSI.C
+(c) 1992 by Tobias Herre
+Bestandteil von DISPLAY.LIB Version 1.0
+----------------------------------------------------------------*/
+
+#include "display.h"
+
+/* ----------------------------------------------------------------
+ Berechnung des Speicherplatzes, den ein rechteckiger Bildschirm-
+ ausschnitt belegt, wenn man ihn in den Speicher kopiert
+*/
+long GetImageSize(int width, int hight)
+{
+ return sizeof(colortype)*(width*hight)+2*sizeof(int);
+}
/hist-1992-2002/hexenspiel/getimgsi.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/gr.html
===================================================================
--- hist-1992-2002/hexenspiel/gr.html (nonexistent)
+++ hist-1992-2002/hexenspiel/gr.html (revision 106)
@@ -0,0 +1,21 @@
+<html>
+<head>
+<title>Hexenspiel</title>
+</head>
+<body>
+
+
+<applet code="gr.class" width="640" height="95%" alt="jajaja Java-Applets mit">
+<param name="TestText" value="SELFHTML">
+</applet>
+
+
+
+<div id="tube">
+
+
+<p>&nbsp;</p>
+</div>
+
+</body>
+</html>
/hist-1992-2002/hexenspiel/gr.html
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/h.c
===================================================================
--- hist-1992-2002/hexenspiel/h.c (nonexistent)
+++ hist-1992-2002/hexenspiel/h.c (revision 106)
@@ -0,0 +1,4 @@
+/*----------------------------------------------------------------------
+filename
+Copyright (c) 1993 by Tobias Herre
+----------------------------------------------------------------------*/
/hist-1992-2002/hexenspiel/h.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/Hexenspiel.java
===================================================================
--- hist-1992-2002/hexenspiel/Hexenspiel.java (nonexistent)
+++ hist-1992-2002/hexenspiel/Hexenspiel.java (revision 106)
@@ -0,0 +1,1342 @@
+//
+// hexenspiel.java
+// (c) 2002 Tube
+//
+
+
+import java.applet.Applet;
+import java.awt.event.*;
+import java.awt.image.*;
+import java.awt.*;
+import java.net.*;
+
+
+
+
+class LinearStepper
+{
+ interface LStepper
+ {
+ public long step();
+ }
+
+
+
+ static final int F=16;
+
+ private Stepper st;
+
+
+ long pos;
+
+ private class Stepper1 implements Stepper
+ {
+ public long step()
+ {
+ return 1;
+ }
+ }
+
+ public long step()
+ {
+ return st.step();
+ }
+
+
+}
+
+
+
+
+
+interface LinearIterpolationPutter
+{
+ public void pixelputter(int x);
+}
+
+
+class LinearInterpolation
+{
+ static final int F=8;
+ public int[] data;
+ public int len;
+
+
+ LinearInterpolation(int start, int end, int n)
+ {
+ if (n<0) n*=-1;
+ data=new int[n];
+ len = n;
+ l(data,0,start,end,n);
+ }
+
+ static void l(int dest[],int si, int start, int end, int n)
+ {
+ int i;
+ long add,pos,diff;
+ int sum;
+
+ if(start<end){
+ diff=end-start;
+ if(diff>=n){
+ add=( diff << F ) / n;
+ pos=((long)start<<F)+add/2;
+ for(i=0;i<n;i++){
+ dest[i+si] = (int)(pos>>F);
+ pos+=add;
+ }
+ }
+ else{
+ sum=n>>1;
+ for(i=0;i<n;i++){
+ dest[i+si]=start;
+ sum-=(int)diff; if (sum<0) {start++; sum+=n;}
+ }
+ }
+ }
+ else{
+ diff=start-end;
+ if(diff>=n){
+ add=( diff << F ) / n;
+ pos=((long)start<<F)-add/2;
+
+ for(i=0;i<n;i++){
+ dest[i+si] = (int)(pos>>F);
+ pos-=add;
+ }
+
+ }
+ else{
+ sum=n>>1;
+ for(i=0;i<n;i++){
+ dest[i+si]=start;
+ sum-=(int)diff; if (sum<0) {start--; sum+=n;}
+ }
+ }
+ }
+ }
+
+
+}
+
+
+
+
+
+//import LinearInterpolation.*;
+
+
+class ConvexPolygonShape
+{
+ int polbordera[];
+ int polborderb[];
+
+
+
+ int ystart;
+ int yend;
+ int lastcode;
+
+
+
+
+ ConvexPolygonShape(int w, int h)
+ {
+ polbordera = new int[h];
+ polborderb = new int[h];
+
+
+
+ yend=-1;
+ ystart=h+1;
+ lastcode = 5;
+ }
+
+
+ void line(int x1,int y1,int x2,int y2)
+ {
+ int deltax,deltay;
+ int code;
+ int count,countval,xadd;
+
+ deltax=x2-x1; deltay=y2-y1;
+ if(deltay==0)
+ {
+ lastcode=5;return;
+ }
+
+ code=0;
+ if ( deltax<0 )
+ {
+ deltax=-deltax; code |= 1;
+ }
+
+ if ( deltay<0 )
+ {
+ deltay=-deltay; code |= 2;
+ }
+
+ if ( deltay<0 )
+ {
+ if(y1<ystart) ystart=y1;
+ if(y2>yend) yend=y2;
+ }
+ else
+ {
+ if(y2<ystart) ystart=y2;
+ if(y1>yend) yend=y1;
+ }
+
+ switch (code)
+ {
+ case 0: // Linie von links oben nach rechts unten
+
+ if(deltay<deltax)
+ {
+ if(deltay!=0)
+ {
+ xadd=deltax/deltay;
+ countval=deltax%deltay;
+ count= (deltax>>1) % deltay - deltay;
+ x1+=xadd>>1;
+ while(y1<y2)
+ {
+ polborderb[y1]=x1;
+ y1++; x1+=xadd; count+=countval;
+ if(count>=0)
+ {
+ count-=deltay;
+ x1++;
+ }
+ }
+//LinearInterpolation.l( ybpoints,0,w,y1-y2 );
+
+ }
+ polborderb[y2]=x2;
+ }
+ else
+ {
+ count=deltay>>1;
+ polborderb[y1]=x1;
+ while(y1<y2)
+ {
+ count-=deltax; y1++;
+ if(count<0)
+ {
+ x1++; count+=deltay;
+ }
+ polborderb[y1]=x1;
+ }
+ }
+ break;
+
+ case 1: // Linie von rechts oben nach links unten
+ if(deltay<deltax)
+ {
+ if(deltay!=0)
+ {
+ xadd=deltax/deltay;
+ countval=deltax%deltay;
+ count= (deltax>>1)%deltay - deltay;
+ x2+=xadd>>1;
+ while(y2>y1)
+ {
+ polborderb[y2]=x2;
+ y2--; x2+=xadd; count+=countval;
+ if(count>=0)
+ {
+ count-=deltay;
+ x2++;
+ }
+ }
+ }
+ if(lastcode!=1)
+ polborderb[y1]=x1;
+ }
+ else
+ {
+ count=deltay>>1;
+ polborderb[y2]=x2;
+ while(y2>y1)
+ {
+ count-=deltax; y2--;
+ if(count<0)
+ {
+ x2++; count+=deltay;
+ }
+ polborderb[y2]=x2;
+ }
+ }
+ break;
+
+ case 2: /* Linie von links unten nach rechts oben */
+ if(deltay<deltax)
+ {
+ if(deltay!=0)
+ {
+ xadd=deltax/deltay;
+ countval=deltax%deltay;
+ count= (deltax>>1)%deltay - deltay;
+ x2-=xadd>>1;
+ while(y2<y1)
+ {
+ polbordera[y2]=x2;
+ y2++; x2-=xadd; count+=countval;
+ if(count>=0) {count-=deltay; x2--;}
+ }
+ }
+ if(lastcode!=2) polbordera[y1]=x1;
+ }
+ else
+ {
+ count=deltay>>1;
+ polbordera[y2]=x2;
+ while(y2<y1)
+ {
+ count-=deltax; y2++;
+ if(count<0) {x2--; count+=deltay;};
+ polbordera[y2]=x2;
+ }
+ }
+ break;
+
+ case 3: /* Linie von rechts unten nach links oben */
+ if(deltay<deltax){
+ if(deltay!=0){
+ xadd=deltax/deltay;
+ countval=deltax%deltay;
+ count= (deltax>>1)%deltay - deltay;
+ x1-=xadd>>1;
+ while(y1>y2){
+ polbordera[y1]=x1;
+ y1--; x1-=xadd; count+=countval;
+ if(count>=0) {count-=deltay; x1--;}
+ }
+ }
+ polbordera[y2]=x2;
+ }
+ else{
+ count=deltay>>1;
+ polbordera[y1]=x1;
+ while(y1>y2){
+ count-=deltax; y1--; if(count<0) {x1--; count+=deltay;};
+ polbordera[y1]=x1;
+ }
+ }
+ break;
+ } /* switch */
+
+ lastcode = code;
+}
+
+
+
+
+
+}
+
+
+
+
+class MRawGraphics extends Component
+{
+ public int buffer[] = null;
+ public int width=0, height=0;
+ int color=0;
+ int bgcolor=0;
+ int size=0;
+
+
+
+ public void setSize(int w,int h)
+ {
+ int s = w*h;
+ buffer = new int[w*h];
+ size=s;
+ width=w;
+ height=h;
+ }
+
+
+ public void drawPixel(int x,int y)
+ {
+ buffer[x+width*y]=color;
+ }
+
+ public void drawPixel(long x,long y)
+ {
+ buffer[(int)(x+width*y)]=color;
+ }
+
+ public void setColor( int c)
+ {
+ color=c;
+ }
+
+ public void setColor( int r, int g, int b)
+ {
+ color = (255<<24)|(r<<16)|(g<<8)|b;
+ }
+
+
+ void drawEllipse(int x,int y,int a,int b)
+ {
+ long x1,y1;
+ long ref,xan,yan,xann,yann;
+
+ x1=0;y1=b;
+
+ xan=b*b;
+ xann=2*b*b;
+
+ yan=-2*y1*a*a+a*a;
+ yann=2*a*a;
+
+ ref=xan/2;
+
+ while (y1>=0)
+ {
+ drawPixel(x+x1,y+y1);
+ drawPixel(x-x1,y+y1);
+ drawPixel(x+x1,y-y1);
+ drawPixel(x-x1,y-y1);
+
+ if(ref+yan<0)
+ {
+ ref+=xan; xan+=xann; x1++;
+ if(ref+ref+yan>=0)
+ {
+ ref+=yan; yan+=yann; y1--;
+ }
+ }
+ else
+ {
+ ref+=yan; yan+=yann; y1--;
+ if (ref+ref+xan<0)
+ {
+ ref+=xan; xan+=xann; x1++;
+ }
+ }
+ }
+ y1++;
+ while(x1<=a)
+ {
+ drawPixel(x+x1,y+y1);
+ drawPixel(x-x1,y+y1);
+ drawPixel(x+x1,y-y1);
+ drawPixel(x-x1,y-y1);
+ x1++;
+ }
+ }
+
+
+
+int tc = 0;
+
+final int MYF=2;
+
+private void DrawImageLine(int x1,int y1,int x2,int y2,int s_x,int s_y,int s_w,MRawGraphics mg)
+{
+ int deltax,deltay;
+ long sumx,sumy,xadd,yadd;
+ int xdir,ydir,i;
+ int width;
+ int color;
+
+ if (s_w<=0) return;
+
+ deltax=x2-x1; deltay=y2-y1;
+
+
+ if ( deltax<0 ) { deltax=-deltax; xdir=-1; } else xdir=1;
+ if ( deltay<0 ) { deltay=-deltay; ydir=-1; } else ydir=1;
+
+// deltax++;
+// deltay++;
+
+ xadd=((long)(deltax)<<16)/s_w;xadd*=xdir;
+ yadd=((long)(deltay)<<16)/s_w;yadd*=ydir;
+
+
+ sumx=((long)x1<<16)+(xadd)/2;
+ sumy=((long)y1<<16)+(yadd)/2;
+
+
+// xadd=yadd=0;
+
+tc=255-tc;
+
+
+ LinearInterpolation px,py;
+ px = new LinearInterpolation ( x1,x2,s_w);
+ py = new LinearInterpolation ( y1,y2,s_w);
+
+ for (i=0; i<s_w; i++)
+ {
+ int xx,yy;
+ xx=px.data[i];
+ yy=py.data[i];
+ color=mg.buffer[(yy/MYF)*mg.width+(xx/MYF)];
+// color=mg.buffer[(yy)*mg.width+(xx)];
+ setColor(color);
+ drawPixel(s_x+i,s_y);
+
+ }
+
+
+/*
+
+ for(i=0;i<s_w;i++){
+
+ color=mg.buffer[mg.width*(int)(sumy>>16)+(int)(sumx>>16)];
+
+ setColor(color);
+ drawPixel(s_x+i,s_y);
+
+// setColor(tc,0,0);
+ drawPixel((int)sumx>>16,(int)(sumy>>16));
+ sumx+=xadd; sumy+=yadd;
+ }
+
+*/
+
+}
+
+
+
+int bax[],bay[],bbx[],bby[];
+
+void CalcOrgPoints(int y1,int y2,int len,int orgpoints[],int lastcode)
+{
+ int deltay,ydir;
+ long yadd,sumy;
+ int i;
+ int bx[]=null,by[]=null;
+
+ switch(lastcode){
+ case 0:
+ bx=bbx;by=bby;break;
+ case 1:
+ bx=bbx;by=bby;break;
+ case 2:
+ bx=bax;by=bay;break;
+ case 3:
+ bx=bax;by=bay;break;
+ }
+
+ deltay=y2-y1;
+
+ if ( deltay==0)return;
+ if ( deltay<0 ) {
+ deltay=-deltay; ydir=-1;
+ }
+ else
+ ydir=1;
+
+ yadd=((long)len<<16)/(long)deltay;
+ sumy=(yadd)/2;
+
+ for(i=y1; i!=y2; i+=ydir){
+ bx[i]=orgpoints[(int)(sumy>>16)*2];
+ by[i]=orgpoints[(int)(sumy>>16)*2+1];
+ sumy+=yadd;
+ }
+ sumy=((long)len)<<16;
+ sumy=sumy-1-yadd;
+ bx[i]=orgpoints[(int)(sumy>>16)*2];
+ by[i]=orgpoints[(int)(sumy>>16)*2+1];
+ sumy+=yadd;
+}
+
+
+
+
+
+
+
+
+
+
+
+ public void drawImageShaped(int pixlist[], MRawGraphics mg)
+ {
+ ConvexPolygonShape ps = new ConvexPolygonShape(width,height);
+// int width,hight;
+ int orgpoints[];
+ int i;
+
+// b.polbordera=malloc( sizeof(int)*(MAXY-MINY+1) );
+// b.polborderb=malloc( sizeof(int)*(MAXY-MINY+1) );
+
+ bax = new int [height]; // (MAXY-MINY+1));
+ bay = new int [height]; //malloc( sizeof(int)*(MAXY-MINY+1));
+ bbx = new int [height]; // malloc( sizeof(int)*(MAXY-MINY+1));
+ bby = new int [height]; // malloc( sizeof(int)*(MAXY-MINY+1));
+
+
+ orgpoints = new int [2*width+2];
+
+
+ /* H”he und Breite des Originals ermitteln */
+// width=((int *)data)[0];
+// hight=((int *)data)[1];
+
+
+
+
+
+int xbpoints[];
+int ybpoints[];
+int xapoints[];
+int yapoints[];
+
+xbpoints = new int[height];
+ybpoints = new int[height];
+xapoints = new int[height];
+yapoints = new int[height];
+
+ int mgw=mg.width-1;
+ int mgh=mg.height-1;
+
+ mgw=mgw*MYF;
+ mgh=mgh*MYF;
+
+
+ int y1,y2,x1,x2;
+
+ x1=pixlist[0];y1=pixlist[1];x2=pixlist[2];y2=pixlist[3];
+
+ ps.line(x1,y1,x2,y2);
+
+
+ if ( y1 < y2 ){
+ LinearInterpolation.l(xbpoints,y1,0,mgw,y2-y1);
+ LinearInterpolation.l(ybpoints,y1,0,0,y2-y1);
+ }
+ else {
+ LinearInterpolation.l(xapoints,y2,mgw,0,y1-y2);
+ LinearInterpolation.l(yapoints,y2,0,0,y1-y2);
+ }
+
+//---
+
+ x1=pixlist[2];y1=pixlist[3];x2=pixlist[4];y2=pixlist[5];
+ ps.line(x1,y1,x2,y2);
+
+
+ if ( y1 < y2 ){
+ LinearInterpolation.l(xbpoints,y1,mgw,mgw,y2-y1);
+ LinearInterpolation.l(ybpoints,y1,0,mgh,y2-y1);
+ }
+ else {
+ LinearInterpolation.l(xapoints,y2,mgw,mgw,y1-y2);
+ LinearInterpolation.l(yapoints,y2,mgh,0,y1-y2);
+ }
+
+//---
+
+ x1=pixlist[4];y1=pixlist[5];x2=pixlist[6];y2=pixlist[7];
+ ps.line(x1,y1,x2,y2);
+
+ if ( y1 < y2 ){
+ LinearInterpolation.l(xbpoints,y1,mgw,0,y2-y1);
+ LinearInterpolation.l(ybpoints,y1,mgh,mgh,y2-y1);
+ }
+ else {
+ LinearInterpolation.l(xapoints,y2,0,mgw,y1-y2);
+ LinearInterpolation.l(yapoints,y2,mgh,mgh,y1-y2);
+ }
+
+//---
+
+ x1=pixlist[6];y1=pixlist[7];x2=pixlist[0];y2=pixlist[1];
+ ps.line(x1,y1,x2,y2);
+
+ if ( y1 < y2 ){
+ LinearInterpolation.l(xbpoints,y1,0,0,y2-y1);
+ LinearInterpolation.l(ybpoints,y1,mgh,0,y2-y1);
+ }
+ else {
+ LinearInterpolation.l(xapoints,y2,0,0,y1-y2);
+ LinearInterpolation.l(yapoints,y2,0,mgh,y1-y2);
+ }
+
+
+
+ LinearInterpolation lp;
+ lp = new LinearInterpolation(0,mg.width-1,pixlist[3]-pixlist[1]);
+
+
+
+
+for( int z=0; z<lp.len; z++)
+{
+
+setColor( mg.buffer[ lp.data[z] ] );
+drawPixel(z,270);
+
+
+}
+
+/*
+int ii=0;
+for (int hh=ps.ystart; hh<ps.yend; hh++ )
+{
+int c=mg.buffer[xbpoints[hh]+ybpoints[hh]*mg.width];
+setColor(c);
+drawPixel(ii,280);
+
+c=mg.buffer[xapoints[hh]+yapoints[hh]*mg.width];
+setColor(c);
+drawPixel(ii,285);
+
+ii++;
+
+
+}
+*/
+
+
+ for(i=ps.ystart;i<=ps.yend;i++){
+ DrawImageLine(
+ xapoints[i],yapoints[i],
+ xbpoints[i],ybpoints[i],
+ ps.polbordera[i],i,ps.polborderb[i]-ps.polbordera[i]+1,mg);
+ }
+
+
+
+
+
+ }
+}
+
+
+
+
+class MGraphics extends MRawGraphics
+{
+ Image img;
+ public MemoryImageSource ms;
+
+ public Image getImage()
+ {
+ return img;
+ }
+
+ public void setSize( int w,int h)
+ {
+ super.setSize(w,h);
+ ms = new MemoryImageSource(width,height,buffer,0,width);
+ ms.setAnimated(true);
+ img = createImage ( ms );
+ }
+
+
+ public void LoadImage( String name, Applet a)
+ {
+ MediaTracker t = new MediaTracker(this);
+ Image im;
+ im = a.getImage(a.getCodeBase(),name);
+ t.addImage(im,0);
+ try
+ {
+ t.waitForID(0);
+ }
+ catch(InterruptedException e)
+ {
+ return;
+ }
+
+ setSize (im.getWidth(this),im.getHeight(this));
+ PixelGrabber pg = new PixelGrabber(im,0,0,width,height,buffer,0,width);
+ try
+ {
+ pg.grabPixels();
+ }
+ catch (InterruptedException e)
+ {
+ }
+
+
+ }
+
+ public void mgupdate()
+ {
+// ms.newPixels(0,0,width,height);
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+public class Hexenspiel extends Applet
+ implements Runnable
+// implements Runnable,MouseListener,MouseMotionListener
+
+{
+
+ //
+ // our own repaint method
+ // notifies the thread to repaint
+ //
+
+ public synchronized void irepaint()
+ {
+ notify();
+ }
+
+
+ Hexenspiel app=this;
+
+
+ Rectangle updateRgn = new Rectangle(0,0);
+ Rectangle dupdateRgn = new Rectangle(0,0);
+
+
+ private void setUpdateRgn(int x,int y, int w, int h)
+ {
+ if (updateRgn.height==0)
+ {
+ updateRgn.height=h;
+ updateRgn.width=w;
+ updateRgn.x=x;
+ updateRgn.y=y;
+ }
+ else
+ {
+ updateRgn.add(new Rectangle(x,y,w,h));
+ }
+
+ }
+
+
+ Karte klist [];
+
+
+
+private class Karte implements Runnable
+{
+int ddd=0;
+
+ Image im; // the image
+ public MGraphics mg;
+
+ int xpos=110,ypos=110; // the x and y position
+ int rot = 0; // current rotation
+ int w=-1,h=-1; // width and height
+ int maxwh=-1;
+ int drot = 0;
+
+
+ Karte ( int n)
+ {
+
+ String kl = "karte" + Integer.toString(n)+".gif";
+ mg = new MGraphics();
+ mg.LoadImage(kl,app);
+ im = mg.getImage();
+ }
+
+ public void paint ( Graphics g )
+ {
+
+
+ if ( im != null )
+ {
+
+
+ if ( maxwh == -1)
+ {
+ w = im.getWidth(app);
+ h = im.getHeight(app);
+ if ( w==-1 || h==-1)
+ {
+ return;
+ }
+ maxwh = (int)Math.sqrt(w*w+h*h);
+ }
+
+
+/* Graphics2D g2d = (Graphics2D)g;
+ AffineTransform at = new AffineTransform();
+ at.setToTranslation(xpos,ypos);
+ at.rotate(rot * Math.PI/180.0,w/2,h/2);
+ g2d.drawImage (im,at,this);
+ g2d.setTransform(at);
+ g2d.setColor(new Color(200,200,200));
+ g2d.drawRect(0,0,w,h);
+*/
+
+mg.setColor(0,0,0);
+mg.mgupdate();
+
+ g.drawImage(mg.getImage(),xpos,ypos,app);
+ g.drawRect(xpos,ypos,w,h);
+
+
+
+
+
+ }
+
+ }
+
+ private void clearBackGround()
+ {
+ int wwd = (maxwh-w)/2;
+ int hwd = (maxwh-h)/2;
+ setUpdateRgn(xpos-wwd,ypos-hwd,maxwh,maxwh);
+ }
+
+
+ public void Rot ( int angle)
+ {
+ if ( maxwh==-1 )
+ return;
+ clearBackGround();
+ rot = angle;
+ }
+
+ public void Move ( int x, int y)
+ {
+ if (maxwh ==-1)
+ return;
+ clearBackGround();
+ xpos=x;
+ ypos=y;
+ clearBackGround();
+
+ }
+
+ public synchronized void run()
+ {
+ int r=rot;
+
+ while(r<drot)
+ {
+ r+=10;
+ Rot(r);
+ irepaint();
+ mysleep(50);
+
+ }
+ Rot (drot);
+ irepaint();
+ }
+
+ public void start()
+ {
+ Thread t;
+ t= new Thread(this);
+ t.start();
+ }
+
+ public boolean underMouse(int x,int y)
+ {
+ if ( x>xpos && x<xpos+w && y>ypos && y<ypos+h)
+ return true;
+ return false;
+
+ }
+
+}
+
+
+String mpos = new String ("tube");
+MGraphics quad;
+
+ Image backBuffer;
+
+
+ MGraphics bpix;
+
+
+ public void init()
+ {
+
+
+
+ setBackground(new Color(0,0,0));
+ klist = new Karte[9];
+ for ( int i=0; i<9; i++)
+ {
+ klist[i]=new Karte(i+1);
+ }
+
+ updateRgn.x=0;
+ updateRgn.y=0;
+ updateRgn.width=getSize().width;
+ updateRgn.height=getSize().height;
+
+// addMouseListener(this);
+// addMouseMotionListener(this);
+
+ backBuffer = createImage( getSize().width, getSize().height);
+
+
+
+quad = new MGraphics();
+quad.LoadImage("quad1.gif",app);
+ bpix = new MGraphics();
+ bpix.setSize(800,800);
+
+
+
+ irepaint();
+ }
+
+
+//-----------------------------------------------------------------
+
+ public void paint(Graphics g)
+ {
+
+prepareImage(backBuffer,this);
+
+
+ Polygon xp = new Polygon();
+ xp.addPoint(0,0);
+ xp.addPoint(300,300);
+ xp.addPoint(0,300);
+
+
+int w = 100;
+int h = 100;
+int pix[] = new int[w * h];
+int index = 0;
+
+
+Image mimg;
+
+{
+
+/* for (int y = 0; y < h; y++) {
+ int red = (y * 255) / (h - 1);
+ for (int x = 0; x < w; x++) {
+ int blue = (x * 255) / (w - 1);
+ pix[index++] = (255 << 24) | (red << 16) | blue;
+ }
+ }
+ mimg = createImage(new MemoryImageSource(w, h, pix, 0, w));
+*/
+
+
+
+
+
+
+}
+
+
+
+ Graphics bbg = backBuffer.getGraphics();
+ bbg.clearRect(
+ dupdateRgn.x,
+ dupdateRgn.y,
+ dupdateRgn.width,
+ dupdateRgn.height
+ );
+ bbg.setClip(dupdateRgn);
+ for (int i=0; i<9; i++)
+ {
+ if ( klist[i]!=null)
+ {
+ klist[i].paint(backBuffer.getGraphics());
+ }
+ }
+//g.setClip(x);
+ g.drawImage(backBuffer,0,0,this);
+
+g.setClip(null);
+
+/*
+for(int i=0; i<180; i++)
+{
+ g.drawImage(klist[0].im,0,i,180,1,this);
+
+
+}
+*/
+
+
+index = 0;
+for (int y1 = 0; y1 < 50; y1++)
+{
+ for (int x1 = 0; x1 < 50; x1++) {
+ pix[index++] = (255 << 24) | 255<<16;
+ }
+}
+
+
+
+/* index=0;
+ for (int y = 0; y < h; y++) {
+ int red = (y * 0) / (h - 1);
+ for (int x = 0; x < w; x++) {
+ int blue = (x * 255) / (w - 1);
+ pix[index++] = (255 << 24) | (255 << 16) | blue;
+ }
+ }
+*/
+
+//g.drawImage(mimg,0,0,this);
+
+//g.drawPolygon(x);
+
+
+
+
+
+
+
+
+bpix.setColor(0,0,120);
+bpix.drawPixel(10,10);
+bpix.drawPixel(10,11);
+bpix.drawPixel(10,12);
+bpix.drawPixel(10,13);
+
+
+// int pli[] = {100,0,400,100,100,200,0,100};
+// int pli[] = {300,0,600,300,300,600,0,300};
+// int pli[] = {800,0,1600,800,800,1600,0,800};
+//int pli[] = {60,0,120,60,60,120,0,60};
+
+int pli[] = {250 + 0,0,
+ 250 + 106, 106,
+ 250 + 0, 106*2,
+ 250 -106,106};
+
+
+
+bpix.drawImageShaped (pli,quad);
+// bpix.drawEllipse(150,150,100,110);
+
+
+g.drawImage(bpix.getImage(),0,0,this );
+
+
+
+
+
+
+
+ }
+
+//----------------------------------------------------------------------
+ void mysleep(int t)
+ {
+ try
+ {
+ Thread.sleep(t);
+ }
+ catch(InterruptedException e)
+ {
+ }
+ }
+
+ public synchronized void run()
+ {
+
+
+ int r=0;
+ while (true)
+ {
+ Thread.yield();
+ try {wait(); }catch(InterruptedException e){}
+ repaint();
+ }
+ }
+
+ public void start()
+ {
+ Thread t;
+ t= new Thread(this);
+ t.start();
+ }
+
+
+ boolean bringmousecardtoptop(int x,int y)
+ {
+ int k = -1;
+ for ( int i=0; i<9; i++)
+ {
+ if ( klist[i]!=null)
+ {
+ if (klist[i].underMouse(x,y) )
+ {
+ k=i;
+ }
+ }
+ }
+
+
+ if ( k!=-1 )
+ {
+ Karte tkarte = klist[k];
+ for (int i=k; i<8; i++)
+ {
+ klist[i]=klist[i+1];
+ klist[i].clearBackGround();
+ }
+ klist[8]=tkarte;
+ klist[8].clearBackGround();
+ return true;
+
+ }
+ return false;
+ }
+
+
+ int xoff,yoff;
+ boolean pressed = false;
+
+ public boolean mouseDrag(Event e, int x, int y)
+ {
+ mpos = new String ("tabbie");
+ if ( pressed )
+ {
+ klist[8].Move(x+xoff,y+yoff);
+ irepaint();
+ }
+
+
+
+ return super.mouseDrag(e,x,y);
+ }
+
+ public boolean mouseDown(Event e,int x, int y)
+ {
+ pressed = bringmousecardtoptop(x,y);
+ xoff = klist[8].xpos-x;
+ yoff = klist[8].ypos-y;
+ irepaint();
+ return true;
+ }
+
+
+ public synchronized void mouseDragged( MouseEvent e)
+ {
+/*setBackground( new Color(255,0,0));
+Graphics g = null;
+g.drawRect(0,0,100,100);
+*/
+
+ if ( pressed )
+ {
+ klist[8].Move(e.getX()+xoff,e.getY()+yoff);
+ irepaint();
+ }
+ }
+
+
+ public void mousePressed( MouseEvent e)
+ {
+ pressed = bringmousecardtoptop(e.getX(),e.getY());
+ xoff = klist[8].xpos-e.getX();
+ yoff = klist[8].ypos-e.getY();
+ irepaint();
+ }
+
+ public void mouseClicked ( MouseEvent e)
+ {
+ int c = e.getClickCount();
+
+ if ( c==1 )
+ {
+ bringmousecardtoptop(e.getX(),e.getY());
+ irepaint();
+
+ }
+
+ if ( c == 2)
+ {
+ klist[8].drot+=90;
+ klist[8].start();
+ }
+// if ( c == 3)
+// klist[6].start();
+
+ }
+
+ public void mouseReleased ( MouseEvent e)
+ {
+// pressed = false;
+
+ }
+
+ public void mouseEntered ( MouseEvent e)
+ {
+
+ }
+
+ public void mouseExited ( MouseEvent e)
+ {
+
+ }
+
+ public void mouseMoved( MouseEvent e)
+ {
+/* if (pressed)
+ {
+ klist[8].Move(e.getX(),e.getY());
+ irepaint();
+ }
+*/
+mpos = new String ("tabbe");
+irepaint();
+ }
+
+
+ public void update( Graphics g)
+ {
+ if ( updateRgn.height==0)
+ return;
+ dupdateRgn.x = updateRgn.x;
+ dupdateRgn.y = updateRgn.y;
+ dupdateRgn.width = updateRgn.width;
+ dupdateRgn.height = updateRgn.height;
+ updateRgn.height=0;
+ g.setClip(dupdateRgn);
+ paint(g);
+
+ }
+
+ public boolean isDoubleBuffered()
+ {
+ return true;
+ }
+
+
+}
+
+
/hist-1992-2002/hexenspiel/Hexenspiel.java
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/LinearInterpolation.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/hist-1992-2002/hexenspiel/LinearInterpolation.class
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/LinearIterpolationPutter.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/hist-1992-2002/hexenspiel/LinearIterpolationPutter.class
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/MGraphics.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/hist-1992-2002/hexenspiel/MGraphics.class
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/MRawGraphics.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/hist-1992-2002/hexenspiel/MRawGraphics.class
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/WS_FTP.LOG
===================================================================
--- hist-1992-2002/hexenspiel/WS_FTP.LOG (nonexistent)
+++ hist-1992-2002/hexenspiel/WS_FTP.LOG (revision 106)
@@ -0,0 +1,17 @@
+102.11.15 22:06 B E:\java\hexenspiel\Hexenspiel.java --> www.surfpoeten.de /hex Hexenspiel.java
+102.11.15 22:06 B E:\java\hexenspiel\karte1.gif --> www.surfpoeten.de /hex karte1.gif
+102.11.15 22:06 B E:\java\hexenspiel\karte2.gif --> www.surfpoeten.de /hex karte2.gif
+102.11.15 22:06 B E:\java\hexenspiel\karte3.gif --> www.surfpoeten.de /hex karte3.gif
+102.11.15 22:06 B E:\java\hexenspiel\karte4.gif --> www.surfpoeten.de /hex karte4.gif
+102.11.15 22:06 B E:\java\hexenspiel\karte5.gif --> www.surfpoeten.de /hex karte5.gif
+102.11.15 22:06 B E:\java\hexenspiel\karte6.gif --> www.surfpoeten.de /hex karte6.gif
+102.11.15 22:06 B E:\java\hexenspiel\karte7.gif --> www.surfpoeten.de /hex karte7.gif
+102.11.15 22:06 B E:\java\hexenspiel\karte8.gif --> www.surfpoeten.de /hex karte8.gif
+102.11.15 22:06 B E:\java\hexenspiel\karte9.gif --> www.surfpoeten.de /hex karte9.gif
+102.11.15 22:07 B E:\java\hexenspiel\Hexenspiel$Karte.class --> www.surfpoeten.de /hex Hexenspiel$Karte.class
+102.11.15 22:07 B E:\java\hexenspiel\Hexenspiel.class --> www.surfpoeten.de /hex Hexenspiel.class
+102.11.15 22:07 B E:\java\hexenspiel\hexenspiel.html --> www.surfpoeten.de /hex hexenspiel.html
+102.11.16 15:09 B E:\java\hexenspiel\Hexenspiel$Karte.class --> www.surfpoeten.de /hex Hexenspiel$Karte.class
+102.11.16 15:09 B E:\java\hexenspiel\Hexenspiel.class --> www.surfpoeten.de /hex Hexenspiel.class
+102.11.17 01:26 B E:\java\hexenspiel\hexenspiel.html --> www.surfpoeten.de / hexenspiel.html
+102.11.17 01:26 B E:\java\hexenspiel\hexenspiel.html --> www.surfpoeten.de /hex hexenspiel.html
/hist-1992-2002/hexenspiel/WS_FTP.LOG
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/_calclin.c
===================================================================
--- hist-1992-2002/hexenspiel/_calclin.c (nonexistent)
+++ hist-1992-2002/hexenspiel/_calclin.c (revision 106)
@@ -0,0 +1,149 @@
+/* ---------------------------------------------------------------
+CACLINE.C
+(c) 1992 by Tobias Herre
+Bestandteil von GRAPHS.LIB Version 1.0
+----------------------------------------------------------------*/
+
+#include "sysscr.h"
+
+/* ----------------------------------------------------------------
+ Berechnung einer Polygonlinie
+*/
+void __CalcPolygonLine(int x1,int y1, int x2,int y2,type_polborder *b)
+{
+ int deltax,deltay;
+ int code;
+ int count,countval,xadd;
+
+ deltax=x2-x1; deltay=y2-y1;
+ if(deltay==0) {b->lastcode=5;return;}
+
+ code=0;
+ if ( deltax<0 ) { deltax=-deltax; code |= 1; }
+ if ( deltay<0 ) { deltay=-deltay; code |= 2; }
+
+ if ( deltay<0 ){
+ if(y1<b->ystart) b->ystart=y1;
+ if(y2>b->yend) b->yend=y2;
+ }
+ else{
+ if(y2<b->ystart) b->ystart=y2;
+ if(y1>b->yend) b->yend=y1;
+ }
+
+ switch (code){
+ case 0: /* Linie von links oben nach rechts unten */
+ if(deltay<deltax){
+ if(deltay!=0){
+ xadd=deltax/deltay;
+ countval=deltax%deltay;
+ count= (deltax>>1) % deltay - deltay;
+ x1+=xadd>>1;
+ while(y1<y2){
+ b->polborderb[y1]=x1;
+ y1++; x1+=xadd; count+=countval;
+ if(count>=0) {count-=deltay; x1++;}
+ }
+ }
+ b->polborderb[y2]=x2;
+ }
+ else{
+ count=deltay>>1;
+ b->polborderb[y1]=x1;
+ while(y1<y2){
+ count-=deltax; y1++; if(count<0) {x1++; count+=deltay;};
+ b->polborderb[y1]=x1;
+ }
+ }
+ break;
+
+ case 1: /* Linie von rechts oben nach links unten */
+ if(deltay<deltax){
+ if(deltay!=0){
+ xadd=deltax/deltay;
+ countval=deltax%deltay;
+ count= (deltax>>1)%deltay - deltay;
+ x2+=xadd>>1;
+ while(y2>y1){
+ b->polborderb[y2]=x2;
+ y2--; x2+=xadd; count+=countval;
+ if(count>=0) {count-=deltay; x2++;}
+ }
+ }
+ if(b->lastcode!=1)b->polborderb[y1]=x1;
+ }
+ else{
+ count=deltay>>1;
+ b->polborderb[y2]=x2;
+ while(y2>y1){
+ count-=deltax; y2--; if(count<0) {x2++; count+=deltay;};
+ b->polborderb[y2]=x2;
+ }
+ }
+ break;
+
+ case 2: /* Linie von links unten nach rechts oben */
+ if(deltay<deltax){
+ if(deltay!=0){
+ xadd=deltax/deltay;
+ countval=deltax%deltay;
+ count= (deltax>>1)%deltay - deltay;
+ x2-=xadd>>1;
+ while(y2<y1){
+ b->polbordera[y2]=x2;
+ y2++; x2-=xadd; count+=countval;
+ if(count>=0) {count-=deltay; x2--;}
+ }
+ }
+ if(b->lastcode!=2) b->polbordera[y1]=x1;
+ }
+ else{
+ count=deltay>>1;
+ b->polbordera[y2]=x2;
+ while(y2<y1){
+ count-=deltax; y2++; if(count<0) {x2--; count+=deltay;};
+ b->polbordera[y2]=x2;
+ }
+ }
+ break;
+
+ case 3: /* Linie von rechts unten nach links oben */
+ if(deltay<deltax){
+ if(deltay!=0){
+ xadd=deltax/deltay;
+ countval=deltax%deltay;
+ count= (deltax>>1)%deltay - deltay;
+ x1-=xadd>>1;
+ while(y1>y2){
+ b->polbordera[y1]=x1;
+ y1--; x1-=xadd; count+=countval;
+ if(count>=0) {count-=deltay; x1--;}
+ }
+ }
+ b->polbordera[y2]=x2;
+ }
+ else{
+ count=deltay>>1;
+ b->polbordera[y1]=x1;
+ while(y1>y2){
+ count-=deltax; y1--; if(count<0) {x1--; count+=deltay;};
+ b->polbordera[y1]=x1;
+ }
+ }
+ break;
+ } /* switch */
+
+ b->lastcode = code;
+}
+
+
+void __CalcPolygonLines(int len,int *pixlist,type_polborder *b)
+{
+ int i;
+ b->lastcode=5;
+ b->ystart=9999; b->yend=-9999;
+ for(i=0;i<(len*2)-2;i+=2){
+ __CalcPolygonLine(pixlist[i],pixlist[i+1],pixlist[i+2],pixlist[i+3],b);
+ }
+ __CalcPolygonLine(pixlist[len*2-2],pixlist[len*2-1],pixlist[0],pixlist[1],b);
+}
\ No newline at end of file
/hist-1992-2002/hexenspiel/_calclin.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/_getclip.c
===================================================================
--- hist-1992-2002/hexenspiel/_getclip.c (nonexistent)
+++ hist-1992-2002/hexenspiel/_getclip.c (revision 106)
@@ -0,0 +1,92 @@
+/* ---------------------------------------------------------------
+_GETCLIP.C
+(c) 1992 by Tobias Herre
+Bestandteil von DISPLAY.LIB Version 1.0
+----------------------------------------------------------------*/
+
+#include "display.h"
+
+/* ----------------------------------------------------------------
+ Berechnung der Line, wenn sie am Bildschirm geschnitten wird
+*/
+int _GetClippedLine(int *x1,int *y1,int *x2,int *y2)
+{
+ int tb1,tb2;
+
+ /* Funktionen zur Berechnung von Nullstellen */
+ #define XCLIP(pos) (int)(((long)(*x2-*x1)*(long)(pos-*y1))/(*y2-*y1)+*x1)
+ #define YCLIP(pos) (int)(((long)(*y2-*y1)*(long)(pos-*x1))/(*x2-*x1)+*y1)
+
+ tb1=0;tb2=0;
+
+ /* testen, wo die Endpunkte der Linie liegen und die entsprechenden
+ Bits setzten */
+
+ if(*x1<MINX) tb1 |= 8;
+ if(*x1>MAXX) tb1 |= 4;
+ if(*y1<MINY) tb1 |= 2;
+ if(*y1>MAXY) tb1 |= 1;
+ if(*x2<MINX) tb2 |= 8;
+ if(*x2>MAXX) tb2 |= 4;
+ if(*y2<MINY) tb2 |= 2;
+ if(*y2>MAXY) tb2 |= 1;
+
+ /* Die Linie ist total sichtbar */
+ if( (tb1|tb2) == 0) return 1;
+
+ /* Die Linie ist berhaupt nicht zu sehen */
+ if( (tb1 & tb2) != 0 ) return 0;
+
+ if(tb1&8){ /* x1<MINX */
+ *y1=YCLIP(MINX); *x1=MINX;
+ tb1^=8;
+ if(*y1>MAXY) tb1 |= 1;
+ if(*y1<MINY) tb1 |= 2;
+ }
+ if(tb2&8){ /* x2<MINX */
+ *y2=YCLIP(MINX); *x2=MINX;
+ tb2^=8;
+ if(*y2>MAXY) tb2 |= 1;
+ if(*y2<MINY) tb2 |= 2;
+ }
+ if(tb1&4){ /* x1>MAXX */
+ *y1=YCLIP(MAXX); *x1=MAXX;
+ tb1^=4;
+ if(*y1>MAXY) tb1 |= 1;
+ if(*y1<MINY) tb1 |= 2;
+ }
+ if(tb2&4){ /* x2>MAXX */
+ *y2=YCLIP(MAXX); *x2=MAXX;
+ tb2^=4;
+ if(*y2>MAXY) tb2 |= 1;
+ if(*y2<MINY) tb2 |= 2;
+ }
+ if( (tb1 & tb2) != 0 ) return 0;
+
+ if(tb1&2){ /* y1<MINY */
+ *x1=XCLIP(MINY); *y1=MINY;
+ }
+ if(tb2&2){ /* y2<MINY */
+ *x2=XCLIP(MINY); *y2=MINY;
+ }
+ if(tb1&1){ /* y1>MAXY */
+ *x1=XCLIP(MAXY); *y1=MAXY;
+ }
+ if(tb2&1){ /* y2>MAXY */
+ *x2=XCLIP(MAXY); *y2=MAXY;
+ }
+ return 1;
+
+}
+
+
+/* ----------------------------------------------------------------
+ clippen einer Box am Bildschirmrand
+*/
+int _GetClippedBox(int *x1,int *y1,int *x2,int *y2)
+{
+ int x,y;
+ y=MINY; _GetClippedLine(x1,&y,x2,&y);
+ x=MINX; _GetClippedLine(&x,y1,&x,y2);
+ return _GetClippedLine(x1,y1,x2,y2);
+}
/hist-1992-2002/hexenspiel/_getclip.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/box.c
===================================================================
--- hist-1992-2002/hexenspiel/box.c (nonexistent)
+++ hist-1992-2002/hexenspiel/box.c (revision 106)
@@ -0,0 +1,18 @@
+/* ---------------------------------------------------------------
+BOX.C
+(c) 1992 by Tobias Herre
+Bestandteil von DISPLAY.LIB Version 1.0
+----------------------------------------------------------------*/
+
+#include "display.h"
+
+/*---------------------------------------------------------------
+ Zeichnen einer Box (x1,y1,x2,y2)
+*/
+void Box(int x1,int y1,int x2,int y2)
+{
+ HLine(x1,x2,y1);
+ HLine(x1,x2,y2);
+ VLine(y1,y2,x1);
+ VLine(y1,y2,x2);
+}
/hist-1992-2002/hexenspiel/box.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/clrscr.c
===================================================================
--- hist-1992-2002/hexenspiel/clrscr.c (nonexistent)
+++ hist-1992-2002/hexenspiel/clrscr.c (revision 106)
@@ -0,0 +1,16 @@
+/* ---------------------------------------------------------------
+CLRSCR.C
+(c) 1992 by Tobias Herre
+Bestandteil von DISPLAY.LIB Version 1.0
+----------------------------------------------------------------*/
+
+#include "display.h"
+
+/* ----------------------------------------------------------------
+ Bildschirm l”schen
+*/
+void ClearScreen(colortype col)
+{
+ SetColor(col);
+ FillBox(MINX,MINY,MAXX,MAXY);
+}
\ No newline at end of file
/hist-1992-2002/hexenspiel/clrscr.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/diffs.c
===================================================================
--- hist-1992-2002/hexenspiel/diffs.c (nonexistent)
+++ hist-1992-2002/hexenspiel/diffs.c (revision 106)
@@ -0,0 +1,7 @@
+ diff3=0;
+ diff=x3-bx; diff3+=diff*diff;
+ diff=y3-by; diff3+=diff*diff;
+ diff=x3-cx; diff3+=diff*diff;
+ diff=y3-cy; diff3+=diff*diff;
+ diff=x3-ax; diff3+=diff*diff;
+ diff=y3-ay; diff3+=diff*diff;
/hist-1992-2002/hexenspiel/diffs.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/dispdemo.c
===================================================================
--- hist-1992-2002/hexenspiel/dispdemo.c (nonexistent)
+++ hist-1992-2002/hexenspiel/dispdemo.c (revision 106)
@@ -0,0 +1,80 @@
+
+#include <stdio.h>
+#include <conio.h>
+#include <malloc.h>
+#include <process.h>
+
+#include "display.h"
+
+int main(void)
+{
+ int c;
+ void *image;
+ int pixlist1 [8] = {60,60, 280,50, 200,170, 180,170};
+ int pixlist2 [10] = {8,8,12,4,30,90,200,180,15,170};
+ int pixlist3 [10] = {90,13, 120,4, 316,20, 300,190, 80,160};
+ do{
+ printf("display demo (c) 1992 by Tobias Herre\n\n");
+ printf("1 fill \n");
+ printf("2 pattern fill\n");
+ printf("3 Images\n");
+ printf("4 Polygon\n");
+ printf("0 exit\n");
+ c=' ';
+ c=getch();
+ switch(c){
+ case '1':
+ GraphicOn();
+ SetColor(2);
+ Ellipse(MAXX/2,MAXY/2,30,40);
+ SetColor(6);
+ Fill(MAXX/2+60,MAXY/2+60);
+ c=getch();
+ GraphicOff();
+ break;
+ case '2':
+ GraphicOn();
+ SetColor(4);
+ Line(0,0,10,10);
+ image=malloc((int)GetImageSize(11,11));
+ GetImage(0,0,10,10,image);
+ SetColor(2);
+ Ellipse(MAXX/2,MAXY/2,30,40);
+ SetPattern(image);
+ Fill(MAXX/2+60,MAXY/2+60);
+ c=getch();
+ GraphicOff();
+ free(image);
+ break;
+ case '3':
+ GraphicOn();
+ SetColor(7); Box(0,0,20,20);
+ SetColor(15); Box(1,1,19,19);
+ SetColor(4); Ellipse(10,10,6,8);
+
+ image=malloc((int)GetImageSize(21,21));
+ GetImage(0,0,21,21,image);
+ PutImageZoomed(10,10,40,40,image);
+ PutImageZoomed(50,40,100,140,image);
+ PutImageShaped(pixlist1,image);
+ c=getch();
+ free(image);
+ GraphicOff();
+ break;
+
+ case '4':
+ GraphicOn();
+ SetColor(5);
+ FillPolygon(5,pixlist2);
+ SetColor(8);
+ FillPolygon(5,pixlist3);
+ c=getch();
+ GraphicOff();
+ break;
+
+ }
+ }
+ while (c!='0');
+
+ return 0;
+}
/hist-1992-2002/hexenspiel/dispdemo.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/display.h
===================================================================
--- hist-1992-2002/hexenspiel/display.h (nonexistent)
+++ hist-1992-2002/hexenspiel/display.h (revision 106)
@@ -0,0 +1,85 @@
+/* ---------------------------------------------------------------
+DISPLAY.H
+(c) 1992 by Tobias Herre
+Bestandteil von DISPLAY.LIB Version 1.0
+----------------------------------------------------------------*/
+
+typedef unsigned char colortype;
+
+/* Funktionen und Konstanten vom Low-Level-Modul */
+
+extern void _SYSGraphicOn(void); /* Grafik anschalten */
+extern void _SYSGraphicOff(void); /* Grafik ausschalten */
+extern void SetVisualPage(int nr); /* Sichtbare Bildschirmseite */
+extern void SetDrawPage(int nr); /* Bildschirmseite zum zeichnen */
+extern void _SYSPutPixel(int x,int y,colortype color); /* Punkt setzen */
+extern colortype _SYSGetPixel(int x, int y); /* Punkt lesen */
+extern const int MAXX,MAXY,MINX,MINY; /* Bildschirmfenster */
+extern const int PAGES; /* Anzahl der Bildschirmseiten */
+#define MAXASP 10000L
+#define XASP 8000L
+#define YASP 10000L
+
+
+#define GetPixel _SYSGetPixel
+#define GraphicOn _SYSGraphicOn
+#define GraphicOff _SYSGraphicOff
+
+
+enum fillstyles {
+ NO_FILL,
+ COLOR_FILL,
+ PATTERN_FILL
+};
+
+
+extern void _IntQuickSort (int *f,int l,int r);
+
+extern int _GetClippedLine(int *x1,int *y1,int *x2,int *y2);
+extern int _GetClippedBox(int *x1,int *y1,int *x2,int *y2);
+
+
+#define STDCOLOR 1
+#define NOCOLOR -1
+
+extern void (*PutPixel)(int x,int y);
+extern colortype transpcolor,color;
+extern int clipping;
+extern void *pattern;
+extern int pthight,ptwidth;
+
+
+/* Funktionen aus den C-Modulen */
+
+
+extern void PatternPutPixel(int x,int y);
+extern void ColorPutPixel(int x,int y);
+extern void SetPattern (void *setpattern);
+extern void SetColor(colortype color);
+
+
+extern void ClearScreen(colortype col);
+
+extern void Line(int x1,int y1,int x2,int y2);
+extern void HLine (int x1,int x2,int y);
+extern void VLine (int y1,int y2,int x);
+extern void PatternLine(int x1,int y1,int x2,int y2,void *data);
+
+extern void Ellipse(int x,int y,int a,int b);
+#define Circle(x,y,r,col) Ellipse(x,y,(int)((long)r*MAXASP/XASP),(int)((long)r*MAXASP/YASP),col)
+#define FillCircle(x,y,r,col) FillEllipse(x,y,(int)((long)r*MAXASP/XASP),(int)((long)r*MAXASP/YASP),col)
+
+extern void Polygon(int points,int *plist);
+extern void FillPolygon(int points,int *plist);
+
+extern void Box(int x1,int y1,int x2,int y2);
+extern void FillBox(int x1,int y1,int x2,int y2);
+extern void PatternFillBox(int x1,int y1,int x2,int y2,void *data);
+
+extern long GetImageSize(int width, int hight);
+extern void GetImage(int x,int y,int width, int hight, void *data);
+extern void PutImage(int x,int y,void *data);
+extern void PutImageZoomed(int s_x,int s_y,int s_w,int s_h,void *data);
+extern void PutImageShaped(int pixlist[8], void *data);
+
+extern void Fill(int x,int y);
/hist-1992-2002/hexenspiel/display.h
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/dispold.h
===================================================================
--- hist-1992-2002/hexenspiel/dispold.h (nonexistent)
+++ hist-1992-2002/hexenspiel/dispold.h (revision 106)
@@ -0,0 +1,43 @@
+/* ---------------------------------------------------------------
+DISPLAY.H
+(c) 1992 by Tobias Herre
+----------------------------------------------------------------*/
+
+/* Funktionen und Konstanten vom Low-Level-Modul */
+
+extern void GraphicOn(void); /* Grafik anschalten */
+extern void GraphicOff(void); /* Grafik ausschalten */
+extern void ClearScreen(int color); /* Bildschirm l”schen */
+extern void SetVisualPage(int nr); /* Sichtbare Bildschirmseite */
+extern void SetDrawPage(int nr); /* Bildschirmseite zum zeichnen */
+extern void PutPixel(int x,int y,int color); /* Punkt setzen */
+extern int GetPixel(int x, int y); /* Punkt lesen */
+extern void SetPal(int c,int r,int g,int b);
+extern const int MAXX,MAXY,MINX,MINY; /* Bildschirmfenster */
+extern const int PAGES; /* Anzahl der Bildschirmseiten */
+
+/* Funktionen aus den C-Modulen */
+extern void Line(int x1,int y1,int x2,int y2,int color);
+extern void HLine( int x1,int x2,int y,int color);
+extern void VLine( int y1,int y2,int x,int color);
+extern void ClipLine( int x1,int y1,int x2,int y2,int color);
+
+extern void Box( int x1,int y1,int x2,int y2, int color);
+extern void ClipBox( int x1,int y1,int x2,int y2, int color);
+extern void FillBox( int x1,int y1,int x2,int y2, int color);
+extern void ClipFillBox( int x1,int y1,int x2,int y2, int color);
+
+extern void Fill(int x,int y,int color);
+
+extern void Polygon( int len, int *pixlist, int color);
+extern void ClipPolygon( int len, int *pixlist, int color);
+extern void ConvexFillPolygon( int len, int *pixlist, int color);
+
+extern void PutImage(int x,int y, void *data);
+extern void PutImageZoomed(int s_x,int s_y,int s_w,int s_h,void *data);
+extern long GetImageSize(int width,int hight);
+extern void GetImage(int x,int y,int width,int hight, void *data);
+extern void PutImageShaped(int points[8],void *data);
+
+
+extern void Ellipse(int x,int y,int a,int b,int col);
/hist-1992-2002/hexenspiel/dispold.h
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/elib/_getclip.c
===================================================================
--- hist-1992-2002/hexenspiel/elib/_getclip.c (nonexistent)
+++ hist-1992-2002/hexenspiel/elib/_getclip.c (revision 106)
@@ -0,0 +1,98 @@
+/***********************************************************************
+_getclip.c
+Copyright (c) 1993 by Tobias Herre
+part of GRAPHLIB VERSION 1.0
+***********************************************************************/
+
+#include "display.h"
+
+/***********************************************************************
+description:
+ clip a line at a box
+intput:
+ global variables (MINX,MINY): left top corner of clip box
+ global variables (MAXX,MAXY): bottom right corner of clip box
+ (*x1,*y1): start of line
+ (*x2,*y2): end of line
+output:
+ (*x1,*y1): start of clipped line
+ (*x2,*y2): end of clipped line
+***********************************************************************/
+
+int _GetClippedLine(int *x1,int *y1,int *x2,int *y2)
+{
+ int tb1,tb2;
+
+ #define XCLIP(pos) (int)(((long)(*x2-*x1)*(long)(pos-*y1))/(*y2-*y1)+*x1)
+ #define YCLIP(pos) (int)(((long)(*y2-*y1)*(long)(pos-*x1))/(*x2-*x1)+*y1)
+
+ tb1=0;tb2=0;
+
+ if(*x1<MINX) tb1 |= 8;
+ if(*x1>MAXX) tb1 |= 4;
+ if(*y1<MINY) tb1 |= 2;
+ if(*y1>MAXY) tb1 |= 1;
+ if(*x2<MINX) tb2 |= 8;
+ if(*x2>MAXX) tb2 |= 4;
+ if(*y2<MINY) tb2 |= 2;
+ if(*y2>MAXY) tb2 |= 1;
+
+ /* the whole line is visible */
+ if( (tb1|tb2) == 0) return 1;
+
+ /* the line is not visible */
+ if( (tb1 & tb2) != 0 ) return 0;
+
+ if(tb1&8){ /* x1<MINX */
+ *y1=YCLIP(MINX); *x1=MINX;
+ tb1^=8;
+ if(*y1>MAXY) tb1 |= 1;
+ if(*y1<MINY) tb1 |= 2;
+ }
+ if(tb2&8){ /* x2<MINX */
+ *y2=YCLIP(MINX); *x2=MINX;
+ tb2^=8;
+ if(*y2>MAXY) tb2 |= 1;
+ if(*y2<MINY) tb2 |= 2;
+ }
+ if(tb1&4){ /* x1>MAXX */
+ *y1=YCLIP(MAXX); *x1=MAXX;
+ tb1^=4;
+ if(*y1>MAXY) tb1 |= 1;
+ if(*y1<MINY) tb1 |= 2;
+ }
+ if(tb2&4){ /* x2>MAXX */
+ *y2=YCLIP(MAXX); *x2=MAXX;
+ tb2^=4;
+ if(*y2>MAXY) tb2 |= 1;
+ if(*y2<MINY) tb2 |= 2;
+ }
+ if( (tb1 & tb2) != 0 ) return 0;
+
+ if(tb1&2){ /* y1<MINY */
+ *x1=XCLIP(MINY); *y1=MINY;
+ }
+ if(tb2&2){ /* y2<MINY */
+ *x2=XCLIP(MINY); *y2=MINY;
+ }
+ if(tb1&1){ /* y1>MAXY */
+ *x1=XCLIP(MAXY); *y1=MAXY;
+ }
+ if(tb2&1){ /* y2>MAXY */
+ *x2=XCLIP(MAXY); *y2=MAXY;
+ }
+ return 1;
+
+}
+
+
+/* ----------------------------------------------------------------
+ clippen einer Box am Bildschirmrand
+*/
+int _GetClippedBox(int *x1,int *y1,int *x2,int *y2)
+{
+ int x,y;
+ y=MINY; _GetClippedLine(x1,&y,x2,&y);
+ x=MINX; _GetClippedLine(&x,y1,&x,y2);
+ return _GetClippedLine(x1,y1,x2,y2);
+}
/hist-1992-2002/hexenspiel/elib/_getclip.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/elib/box.c
===================================================================
--- hist-1992-2002/hexenspiel/elib/box.c (nonexistent)
+++ hist-1992-2002/hexenspiel/elib/box.c (revision 106)
@@ -0,0 +1,23 @@
+/***********************************************************************
+box.c
+Copyright (c) 1993 by Tobias Herre
+part of GRAPHLIB VERSION 1.0
+***********************************************************************/
+
+#include "display.h"
+
+/***********************************************************************
+description:
+ draw a box
+input:
+ (x1,y1): left top corner
+ (x2,y2): bottom right corner
+***********************************************************************/
+
+void Box(int x1,int y1,int x2,int y2)
+{
+ HLine(x1,x2,y1);
+ HLine(x1,x2,y2);
+ VLine(y1,y2,x1);
+ VLine(y1,y2,x2);
+}
/hist-1992-2002/hexenspiel/elib/box.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/elib/diffs.c
===================================================================
--- hist-1992-2002/hexenspiel/elib/diffs.c (nonexistent)
+++ hist-1992-2002/hexenspiel/elib/diffs.c (revision 106)
@@ -0,0 +1,7 @@
+ diff3=0;
+ diff=x3-bx; diff3+=diff*diff;
+ diff=y3-by; diff3+=diff*diff;
+ diff=x3-cx; diff3+=diff*diff;
+ diff=y3-cy; diff3+=diff*diff;
+ diff=x3-ax; diff3+=diff*diff;
+ diff=y3-ay; diff3+=diff*diff;
/hist-1992-2002/hexenspiel/elib/diffs.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/elib/display.h
===================================================================
--- hist-1992-2002/hexenspiel/elib/display.h (nonexistent)
+++ hist-1992-2002/hexenspiel/elib/display.h (revision 106)
@@ -0,0 +1,98 @@
+/*----------------------------------------------------------------------
+display.h
+Copyright (c) 1993 by Tobias Herre
+----------------------------------------------------------------------*/
+
+typedef unsigned char colortype;
+
+
+extern void _SYSGraphicOn(void); /* turn graphics on */
+extern void _SYSGraphicOff(void); /* turn graphics off */
+extern void SetVisualPage(int nr); /* Sichtbare Bildschirmseite */
+extern void SetDrawPage(int nr); /* Bildschirmseite zum zeichnen */
+extern void _SYSPutPixel(int x,int y,colortype color); /* Punkt setzen */
+extern colortype _SYSGetPixel(int x, int y); /* Punkt lesen */
+extern const int MAXX,MAXY,MINX,MINY; /* Bildschirmfenster */
+extern const int PAGES; /* Anzahl der Bildschirmseiten */
+#define MAXASP 10000L
+#define XASP 8000L
+#define YASP 10000L
+
+
+#define GetPixel _SYSGetPixel
+#define GraphicOn _SYSGraphicOn
+#define GraphicOff _SYSGraphicOff
+
+
+enum fillstyles {
+ NO_FILL,
+ COLOR_FILL,
+ PATTERN_FILL
+};
+
+
+extern void _IntQuickSort (int *f,int l,int r);
+
+extern int _GetClippedLine(int *x1,int *y1,int *x2,int *y2);
+extern int _GetClippedBox(int *x1,int *y1,int *x2,int *y2);
+
+
+#define STDCOLOR 1
+#define NOCOLOR -1
+
+extern colortype transpcolor,color;
+extern int clipping;
+extern void *pattern;
+extern int pthight,ptwidth;
+
+/*---------------------------------------------------------------
+ routines for pixelsetting
+*/
+extern void PushPixelMode(void);
+extern void PopPixelMode(void);
+extern void (*PutPixel)(int x,int y);
+
+
+/***********************************************************************
+ prototypes of draw functions
+***********************************************************************/
+extern void Line(int x1,int y1,int x2,int y2);
+extern void VLine(int y1,int y2,int x);
+extern void HLine(int x1,int x2,int y);
+extern void Ellipse(int x,int y,int a,int b);
+#define Circle(x,y,r) Ellipse(x,y,(int)((long)r*MAXASP/XASP),(int)((long)r*MAXASP/YASP))
+extern void Box(int x1,int y1,int x2,int y2);
+
+
+
+
+
+
+
+
+extern void PatternPutPixel(int x,int y);
+extern void ColorPutPixel(int x,int y);
+extern void SetPattern (void *setpattern);
+extern void SetColor(colortype color);
+
+
+extern void ClearScreen(colortype col);
+
+
+extern void PatternLine(int x1,int y1,int x2,int y2,void *data);
+
+#define FillCircle(x,y,r,col) FillEllipse(x,y,(int)((long)r*MAXASP/XASP),(int)((long)r*MAXASP/YASP),col)
+
+extern void Polygon(int points,int *plist);
+extern void FillPolygon(int points,int *plist);
+
+extern void FillBox(int x1,int y1,int x2,int y2);
+extern void PatternFillBox(int x1,int y1,int x2,int y2,void *data);
+
+extern long GetImageSize(int width, int hight);
+extern void GetImage(int x,int y,int width, int hight, void *data);
+extern void PutImage(int x,int y,void *data);
+extern void PutImageZoomed(int s_x,int s_y,int s_w,int s_h,void *data);
+extern void PutImageShaped(int pixlist[8], void *data);
+
+extern void Fill(int x,int y);
/hist-1992-2002/hexenspiel/elib/display.h
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/elib/ellipse.c
===================================================================
--- hist-1992-2002/hexenspiel/elib/ellipse.c (nonexistent)
+++ hist-1992-2002/hexenspiel/elib/ellipse.c (revision 106)
@@ -0,0 +1,61 @@
+/***********************************************************************
+ellipse.c
+Copyright (c) 1993 by Tobias Herre
+part of GRAPHLIB VERSION 1.0
+***********************************************************************/
+
+#include "display.h"
+#include "sys.h"
+
+/***********************************************************************
+description:
+ draw an ellipse using Breasenhams algorithm
+intput:
+ (x,y): center point
+ a: horizontal radius
+ b: vertical radius
+***********************************************************************/
+
+void Ellipse(int x,int y,int a,int b)
+{
+ int x1,y1;
+ int32 ref,xan,yan,xann,yann;
+
+ x1=0;y1=b;
+
+ xan=(int32)b*(int32)b;
+ xann=2L*(int32)b*(int32)b;
+
+ yan=-2L*(int32)y1*(int32)a*(int32)a+(int32)a*(int32)a;
+ yann=2L*(int32)a*(int32)a;
+
+ ref=xan/2;
+
+ while (y1>=0){
+ PutPixel(x+x1,y+y1);
+ PutPixel(x-x1,y+y1);
+ PutPixel(x+x1,y-y1);
+ PutPixel(x-x1,y-y1);
+
+ if(ref+yan<0){
+ ref+=xan; xan+=xann; x1++;
+ if(ref+ref+yan>=0){
+ ref+=yan; yan+=yann; y1--;
+ }
+ }
+ else{
+ ref+=yan; yan+=yann; y1--;
+ if (ref+ref+xan<0){
+ ref+=xan; xan+=xann; x1++;
+ }
+ }
+ }
+ y1++;
+ while(x1<=a){
+ PutPixel(x+x1,y+y1);
+ PutPixel(x-x1,y+y1);
+ PutPixel(x+x1,y-y1);
+ PutPixel(x-x1,y-y1);
+ x1++;
+ }
+}
/hist-1992-2002/hexenspiel/elib/ellipse.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/elib/ellipse2.c
===================================================================
--- hist-1992-2002/hexenspiel/elib/ellipse2.c (nonexistent)
+++ hist-1992-2002/hexenspiel/elib/ellipse2.c (revision 106)
@@ -0,0 +1,71 @@
+/*----------------------------------------------------------------------
+ellipse2.c
+Copyright (c) 1993 by Tobias Herre
+----------------------------------------------------------------------*/
+
+#include <math.h>
+#include "display.h"
+
+/*----------------------------------------------------------------------
+Ellipse
+ Zeichnet eine Ellipse.
+Eingabe:
+ x,y: Mittelpunkt der Ellipse
+ a,b: Radius a und b der Ellipse
+Bemerkungen:
+ Das Ergebnis ist identisch mit dem, das der Algorithmus in
+ ellipse.c liefert. Dieser Algorithmus ist nicht so optimiert
+ wie in ellipse.c und ist daher leichter nachzuvollziehen.
+----------------------------------------------------------------------*/
+void Ellipse(int x,int y,int a,int b)
+{
+ int x1,y1;
+ long ref,xr,yr,diff1,diff2,diff3,xan,yan,xann,yann;
+
+ x1=0;y1=b;
+
+ ref=(long)a*(long)a*(long)b*(long)b; /* Vergleichsradius berechnen */
+
+ xr=(long)x1*(long)x1*(long)b*(long)b;
+
+ xan=(long)b*(long)b; /* Anstieg fr X berechnen */
+ xann=2L*(long)b*(long)b; /* Anstieg fr X-Anstieg berechnen */
+
+ yr=(long)y1*(long)y1*(long)a*(long)a;
+ yan=-2L*(long)y1*(long)a*(long)a+(long)a*(long)a; /* Anstieg fr Y */
+ yann=2L*(long)a*(long)a; /* Anstieg des Y-Anstieges */
+
+ while (y1>=0 && x1<=a)
+ {
+ PutPixel(x+x1,y+y1);
+ PutPixel(x-x1,y+y1);
+ PutPixel(x+x1,y-y1);
+ PutPixel(x-x1,y-y1);
+
+ diff1=labs(ref-(xr+xan+yr)); /* Differenz fr alle 3 Richtungen */
+ diff2=labs(ref-(xr+yr+yan)); /* labs = absoluter Betrag einer long int */
+ diff3=labs(ref-(xr+xan+yr+yan));
+
+ /* beste Richtung w„hlen */
+ if(diff1<=diff2 && diff1<=diff3)
+ {
+ xr+=xan; xan+=xann; x1++;
+ }
+ else
+ {
+ if(diff2<=diff1 && diff2<=diff3)
+ {
+ yr+=yan; yan+=yann;y1--;
+ }
+ else
+ {
+ if(diff3<=diff1 && diff3<=diff2)
+ {
+ xr+=xan; xan+=xann;x1++;
+ yr+=yan; yan+=yann;y1--;
+ }
+ }
+ }
+ }
+
+}
/hist-1992-2002/hexenspiel/elib/ellipse2.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/elib/globvar.c
===================================================================
--- hist-1992-2002/hexenspiel/elib/globvar.c (nonexistent)
+++ hist-1992-2002/hexenspiel/elib/globvar.c (revision 106)
@@ -0,0 +1,19 @@
+/***********************************************************************
+globvar.c
+Copyright (c) 1993 by Tobias Herre
+part of GRAPHLIB VERSION 1.0
+***********************************************************************/
+
+#include <stdio.h>
+#include "display.h"
+
+/***********************************************************************
+ global variables
+***********************************************************************/
+colortype color=STDCOLOR;
+
+int _clipping=1;
+colortype transpcolor=NOCOLOR;
+void *pattern=NULL;
+int pthight,ptwidth;
+int fillstyle = NO_FILL;
/hist-1992-2002/hexenspiel/elib/globvar.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/elib/h.c
===================================================================
--- hist-1992-2002/hexenspiel/elib/h.c (nonexistent)
+++ hist-1992-2002/hexenspiel/elib/h.c (revision 106)
@@ -0,0 +1,4 @@
+/*----------------------------------------------------------------------
+filename
+Copyright (c) 1993 by Tobias Herre
+----------------------------------------------------------------------*/
/hist-1992-2002/hexenspiel/elib/h.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/elib/hline.c
===================================================================
--- hist-1992-2002/hexenspiel/elib/hline.c (nonexistent)
+++ hist-1992-2002/hexenspiel/elib/hline.c (revision 106)
@@ -0,0 +1,24 @@
+/* ---------------------------------------------------------------
+this is hline.c
+
+Copyright (c) 1992 by Tobias Herre
+part of GRAPHLIB VERSION 1.0
+----------------------------------------------------------------*/
+
+#include "display.h"
+
+/*----------------------------------------------------------------
+ horizontale Linie zeichnen (von x1,x2 iny y mit der Farbe col
+*/
+void HLine (int x1,int x2,int y)
+{
+ int dx,xdir;
+
+ if(_GetClippedLine (&x1,&y,&x2,&y) == 0) return;
+
+ dx=x2-x1;if(dx<0) {dx=-dx;xdir=-1;} else xdir=1;
+ dx++;
+ while (dx){
+ PutPixel(x1,y); x1+=xdir; dx--;
+ }
+}
\ No newline at end of file
/hist-1992-2002/hexenspiel/elib/hline.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/elib/l.c
===================================================================
--- hist-1992-2002/hexenspiel/elib/l.c (nonexistent)
+++ hist-1992-2002/hexenspiel/elib/l.c (revision 106)
@@ -0,0 +1,8 @@
+/*----------------------------------------------------------------------
+funktionsname
+Beschreibung:
+Eingabe:
+Ausgabe:
+ Rueckgabewert:
+Bemerkungen
+----------------------------------------------------------------------*/
/hist-1992-2002/hexenspiel/elib/l.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/elib/putimgs.c
===================================================================
--- hist-1992-2002/hexenspiel/elib/putimgs.c (nonexistent)
+++ hist-1992-2002/hexenspiel/elib/putimgs.c (revision 106)
@@ -0,0 +1,173 @@
+/***********************************************************************
+putimgs.c
+Copyright (c) 1993 by Tobias Herre
+part of GRAPHLIB VERSION 1.0
+***********************************************************************/
+
+#include <malloc.h>
+
+#include "display.h"
+
+/***********************************************************************
+
+***********************************************************************/
+static void DrawImageLine(int x1,int y1,int x2,int y2,int s_x,int s_y,int s_w,void *data)
+{
+ int deltax,deltay;
+ long sumx,sumy,xadd,yadd;
+ int xdir,ydir,i;
+ int width;
+ int color;
+
+ if (s_w<=0) return;
+
+ deltax=x2-x1; deltay=y2-y1;
+
+ width=*((int *)data)++;
+ ((int *)data)++;
+
+ if ( deltax<0 ) { deltax=-deltax; xdir=-1; } else xdir=1;
+ if ( deltay<0 ) { deltay=-deltay; ydir=-1; } else ydir=1;
+
+
+ xadd=((long)(deltax)<<16)/s_w;xadd*=xdir;
+ yadd=((long)(deltay)<<16)/s_w;yadd*=ydir;
+
+ sumx=((long)x1<<16)+(xadd)/2;
+ sumy=((long)y1<<16)+(yadd)/2;
+
+ for(i=0;i<s_w;i++){
+ color=((char *)data)[width*(int)(sumy>>16)+(int)(sumx>>16)];
+ SetColor(color); PutPixel(s_x+i,s_y);
+/* PutPixel((int)(sumx>>16),(int)(sumy>>16),9); */
+ sumx+=xadd; sumy+=yadd;
+ }
+}
+
+/***********************************************************************
+
+***********************************************************************/
+static int *bax,*bay,*bbx,*bby;
+
+static void CalcOrgPoints(int y1,int y2,int len,int *orgpoints,int lastcode)
+{
+ int deltay,ydir;
+ long yadd,sumy;
+ int i;
+ int *bx,*by;
+ switch(lastcode){
+ case 0:
+ bx=bbx;by=bby;break;
+ case 1:
+ bx=bbx;by=bby;break;
+ case 2:
+ bx=bax;by=bay;break;
+ case 3:
+ bx=bax;by=bay;break;
+ };
+
+ deltay=y2-y1;
+
+ if ( deltay==0)return;
+ if ( deltay<0 ) {
+ deltay=-deltay; ydir=-1;
+ }
+ else
+ ydir=1;
+ yadd=((long)len<<16)/(long)deltay;
+ sumy=(yadd)/2;
+
+
+ for(i=y1; i!=y2; i+=ydir){
+ bx[i]=orgpoints[(int)(sumy>>16)*2];
+ by[i]=orgpoints[(int)(sumy>>16)*2+1];
+ sumy+=yadd;
+ }
+ sumy=((long)len)<<16;
+ sumy=sumy-1-yadd;
+ bx[i]=orgpoints[(int)(sumy>>16)*2];
+ by[i]=orgpoints[(int)(sumy>>16)*2+1];
+ sumy+=yadd;
+}
+
+/***********************************************************************
+
+***********************************************************************/
+void PutImageShaped(int pixlist[8], void *data)
+{
+ type_polborder b;
+ int width,hight;
+ int *orgpoints;
+ int i;
+/*
+Line (0,0,0,157,7);
+DrawImageLine(0,0,0,157,0,200,19,data);
+getch();
+exit(0);
+*/
+ b.polbordera=malloc( sizeof(int)*(MAXY-MINY+1) );
+ b.polborderb=malloc( sizeof(int)*(MAXY-MINY+1) );
+ bax = malloc( sizeof(int)*(MAXY-MINY+1));
+ bay = malloc( sizeof(int)*(MAXY-MINY+1));
+ bbx = malloc( sizeof(int)*(MAXY-MINY+1));
+ bby = malloc( sizeof(int)*(MAXY-MINY+1));
+ orgpoints = malloc( 2*sizeof(int)*(MAXX-MINX+2));
+ if( b.polbordera==NULL) goto end;
+ if( b.polborderb==NULL) goto end;
+ if(bax==NULL || bay==NULL || bbx==NULL || bby==NULL) goto end;
+ if(orgpoints==NULL) goto end;
+
+ /* H”he und Breite des Originals ermitteln */
+ width=((int *)data)[0];
+ hight=((int *)data)[1];
+
+ b.lastcode=5;
+ b.ystart=9999; b.yend=-9999;
+
+
+ __CalcPolygonLine(pixlist[0],pixlist[1],pixlist[2],pixlist[3],&b);
+ for(i=0;i<width;i++){
+ orgpoints[i<<1]=i;
+ orgpoints[(i<<1)+1]=0;
+ }
+ CalcOrgPoints(pixlist[1],pixlist[3],width,orgpoints,b.lastcode);
+
+ __CalcPolygonLine(pixlist[2],pixlist[3],pixlist[4],pixlist[5],&b);
+ for(i=0;i<hight;i++){
+ orgpoints[i<<1]=width-1;
+ orgpoints[(i<<1)+1]=i;
+ }
+ CalcOrgPoints(pixlist[3],pixlist[5],hight,orgpoints,b.lastcode);
+
+ __CalcPolygonLine(pixlist[4],pixlist[5],pixlist[6],pixlist[7],&b);
+ for(i=0;i<width;i++){
+ orgpoints[i<<1]=width-1-i;
+ orgpoints[(i<<1)+1]=hight-1;
+ }
+ CalcOrgPoints(pixlist[5],pixlist[7],width,orgpoints,b.lastcode);
+
+ __CalcPolygonLine(pixlist[6],pixlist[7],pixlist[0],pixlist[1],&b);
+ for(i=0;i<hight;i++){
+ orgpoints[i<<1]=0;
+ orgpoints[(i<<1)+1]=hight-1-i;
+ }
+ CalcOrgPoints(pixlist[7],pixlist[1],hight,orgpoints,b.lastcode);
+
+
+ for(i=b.ystart;i<=b.yend;i++){
+ DrawImageLine(bax[i],bay[i],bbx[i],bby[i],b.polbordera[i],i,b.polborderb[i]-b.polbordera[i]+1,data);
+ }
+
+ end:
+ if(b.polbordera!=NULL) free(b.polbordera);
+ if(b.polborderb!=NULL) free(b.polborderb);
+ if(bax!=NULL) free(bax);
+ if(bay!=NULL) free(bay);
+ if(bbx!=NULL) free(bbx);
+ if(bby!=NULL) free(bby);
+}
+
+
+
+
+
/hist-1992-2002/hexenspiel/elib/putimgs.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/elib/spline.c
===================================================================
--- hist-1992-2002/hexenspiel/elib/spline.c (nonexistent)
+++ hist-1992-2002/hexenspiel/elib/spline.c (revision 106)
@@ -0,0 +1,77 @@
+/*----------------------------------------------------------------------
+spline.c
+Copyright (c) 1993 by Tobias Herre
+----------------------------------------------------------------------*/
+#include <math.h>
+#include "display.h"
+
+
+/*----------------------------------------------------------------------
+Spline
+ Zeichnet eine Spline
+Eingabe:
+----------------------------------------------------------------------*/
+void Spline(int ax,int ay,int bx,int by,int cx,int cy)
+{
+ int i=0;
+ long diff1,diff2,diff3;
+ long diff;
+ int x,y;
+ int x1,x2,x3,y1,y2,y3;
+
+ int xdir,ydir;
+
+ if( cy>ay ) /* Y-Schrittrichtung bestimmen */
+ ydir=1;
+ else
+ ydir=-1;
+
+
+ if( cx>ax ) /* X-Schrittrichtung */
+ xdir=1;
+ else
+ xdir=-1;
+
+#ifdef DEBUG
+ Line(ax,ay,bx,by);
+ Line(bx,by,cx,cy);
+#endif
+
+
+ x=0; y=0;
+ xdir = 1; ydir = 1;
+ do
+ {
+ x1=x+xdir; y1=y;
+ x2=x+xdir; y2=y+ydir;
+ x3=x; y3=y+ydir;
+
+ /* y = x*x */
+ diff1=labs(y1*340-x1*x1);
+ diff2=labs(y2*340-x2*x2);
+ diff3=labs(y3*340-x3*x3);
+
+
+
+ if (diff1<diff3 && diff1 < diff3 )
+ {
+ x=x1; y=y1;
+ }
+ else
+ {
+ if( diff2<diff3 )
+ {
+ x=x2; y=y2;
+ }
+ else
+ {
+ x=x3; y=y3;
+ }
+ }
+
+ PutPixel(x,y);
+
+ i++;
+ }while( i<290 ) ;
+
+}
/hist-1992-2002/hexenspiel/elib/spline.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/elib/tester.c
===================================================================
--- hist-1992-2002/hexenspiel/elib/tester.c (nonexistent)
+++ hist-1992-2002/hexenspiel/elib/tester.c (revision 106)
@@ -0,0 +1,12 @@
+#include "display.h"
+
+void Spline(int ax,int ay,int bx,int by,int cx,int cy);
+
+main(void)
+{
+ GraphicOn();
+ color=3;
+ Spline(0,50, 0,0, 50,0 );
+ return 0;
+}
+
/hist-1992-2002/hexenspiel/elib/tester.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/elib/x2.c
===================================================================
--- hist-1992-2002/hexenspiel/elib/x2.c (nonexistent)
+++ hist-1992-2002/hexenspiel/elib/x2.c (revision 106)
@@ -0,0 +1,69 @@
+/*----------------------------------------------------------------------
+x2.c
+Copyright (c) 1993 by Tobias Herre
+----------------------------------------------------------------------*/
+
+
+
+void x2()
+{
+ int x,y;
+
+ x=0; y=0;
+ x=ax; y=ay;
+
+ do
+ {
+ x1=x+xdir; y1=y;
+ x2=x+xdir; y2=y+ydir;
+ x3=x; y3=y+ydir;
+
+ diff1=0;
+ diff=x1-bx; diff1+=diff*diff;
+ diff=y1-by; diff1+=diff*diff;
+ diff=x1-cx; diff1+=diff*diff;
+ diff=y1-cy; diff1+=diff*diff;
+ diff=x1-ax; diff1+=diff*diff;
+ diff=y1-ay; diff1+=diff*diff;
+
+ diff2=0;
+ diff=x2-bx; diff2+=diff*diff;
+ diff=y2-by; diff2+=diff*diff;
+ diff=x2-cx; diff2+=diff*diff;
+ diff=y2-cy; diff2+=diff*diff;
+ diff=x2-ax; diff2+=diff*diff;
+ diff=y2-ay; diff2+=diff*diff;
+
+ diff3=0;
+ diff=x3-bx; diff3+=diff*diff;
+ diff=y3-by; diff3+=diff*diff;
+ diff=x3-cx; diff3+=diff*diff;
+ diff=y3-cy; diff3+=diff*diff;
+ diff=x3-ax; diff3+=diff*diff;
+ diff=y3-ay; diff3+=diff*diff;
+
+
+ if( diff1<diff2 && diff1 < diff3 )
+ {
+ x=x1; y=y1;
+ }
+ else
+ {
+ if( diff2<diff3 )
+ {
+ x=x2; y=y2;
+ }
+ else
+ {
+ x=x3; y=y3;
+ }
+ }
+
+ PutPixel(x,y);
+
+ }while( x!=cx && y != cy) ;
+
+
+
+
+}
\ No newline at end of file
/hist-1992-2002/hexenspiel/elib/x2.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/fellipse.c
===================================================================
--- hist-1992-2002/hexenspiel/fellipse.c (nonexistent)
+++ hist-1992-2002/hexenspiel/fellipse.c (revision 106)
@@ -0,0 +1,48 @@
+/* ---------------------------------------------------------------
+FELLIPSE.C
+(c) 1992 by Tobias Herre
+Bestandteil von DISPLAY.LIB Version 1.0
+----------------------------------------------------------------*/
+
+#include "display.h"
+
+/* ----------------------------------------------------------------
+ ausgefllte Ellipse zeichnen (bei x,y mit Radius a und b)
+ Die Ellipse wird am Bildschirmrand abgeschnitten
+*/
+void FillEllipse(int x,int y,int a,int b,colortype col)
+{
+ int x1,y1;
+ long ref,xan,yan,xann,yann;
+
+ x1=0;y1=b;
+
+ xan=(long)b*(long)b; /* Anstieg fr X berechnen */
+ xann=2L*(long)b*(long)b; /* Anstieg fr X-Anstieg berechnen */
+
+ yan=-2L*(long)y1*(long)a*(long)a+(long)a*(long)a; /* Anstieg fr Y */
+ yann=2L*(long)a*(long)a; /* Anstieg des Y-Anstieges */
+
+ ref=xan/2;
+
+ while (y1>=1)
+ {
+ if(ref+yan<0){
+ ref+=xan; xan+=xann; x1++;
+ if(ref+ref+yan>=0){
+ HLine(x-x1+1,x+x1-1,y+y1,col);
+ HLine(x-x1+1,x+x1-1,y-y1,col);
+ ref+=yan; yan+=yann; y1--;
+ }
+ }
+ else {
+ HLine(x-x1,x+x1,y+y1,col);
+ HLine(x-x1,x+x1,y-y1,col);
+ ref+=yan; yan+=yann; y1--;
+ if (ref+ref+xan<0){
+ ref+=xan; xan+=xann; x1++;
+ }
+ }
+ }
+ HLine(x-a,x+a,y,col);
+}
\ No newline at end of file
/hist-1992-2002/hexenspiel/fellipse.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/fillpoly.c
===================================================================
--- hist-1992-2002/hexenspiel/fillpoly.c (nonexistent)
+++ hist-1992-2002/hexenspiel/fillpoly.c (revision 106)
@@ -0,0 +1,162 @@
+/* ---------------------------------------------------------------
+POLYGON.C
+(c) 1992 by Tobias Herre
+Bestandteil von DISPLAY.LIB Version 1.0
+----------------------------------------------------------------*/
+
+#include <stdio.h>
+#include <malloc.h>
+#include <math.h>
+
+#include "display.h"
+
+/*---------------------------------------------------------------
+ Zeichnen eines Polygons
+*/
+void FillPolygon(int points,int *plist)
+{
+ int y,x1,y1,x2,y2,help;
+ int hight,width;
+ int i;
+ int *coord,*coordl,*coordr,n,nl,nr,npoints;
+ int ymin,ymax;
+
+ struct lstru{
+ long sumx,xadd;
+ int y1,y2;
+ int x1,x2;
+ } *l;
+
+ #define YCLIP(pos) (int)(((long)(y2-y1)*(long)(pos-x1))/(x2-x1)+y1)
+
+ coord=coordl=coordr=NULL;
+ l=NULL;
+
+ /* Speicher fr die Y-Positionen der Durchtrittspunkte am linken
+ bzw. rechten Rand der PolygonLinien reservieren */
+ coordl=malloc( points*sizeof(int) );
+ if(coordl==NULL) goto exit;
+ coordr=malloc( points*sizeof(int) );
+ if(coordr==NULL) goto exit;
+
+ /* Schnittpunkte mit dem linken bzw. rechten Rand suchen */
+ for(nl=0,nr=0,i=0;i<points;i++){
+ x1=plist[i*2]; y1=plist[i*2+1];
+ if(i==points-1){x2=plist[0]; y2=plist[1];}
+ else{ x2=plist[i*2+2]; y2=plist[i*2+3];}
+
+ /* Schnittpunkt mit dem linken Rand berechnen, wenn einer vorhanden ist */
+ if ( (x1<MINX && x2>=MINX) || (x2<MINX && x1>=MINX) ){
+ coordl[nl++]=YCLIP(MINX);
+ };
+ /* Schnittpunkt mit dem rechten Rand berechnen, wenn einer vorhanden ist */
+ if ( (x1<=MAXX && x2>MAXX) || (x2<=MAXX && x1>MAXX) ){
+ coordr[nr++]=YCLIP(MAXX);
+ };
+ }
+
+ /* Speicher fr die zu berechnenden Linien reservieren */
+ l=malloc((points+nl+nr)*sizeof(struct lstru) );
+ if(l==NULL) goto exit;
+
+ n=0;
+
+ if(nl>0){
+ /* sortieren der gefundenen Schnittpunkte */
+ _IntQuickSort(coordl,0,nl-1);
+ /* Hinzufgen der Linien, die durch Schnitte mit dem linken Rand
+ Rand entstanden sind */
+ for(i=0;i<(nl-1)*2;i+=2){
+ l[n].y1=coordl[i]; l[n].x1=MINX;
+ l[n].y2=coordl[i+1];l[n].x2=MINX;
+ if(_GetClippedLine(&l[n].x1,&l[n].y1,&l[n].x2,&l[n].y2) != 0 ) n++;
+ }
+ }
+
+ if(nr>0){
+ /* sortieren */
+ _IntQuickSort(coordr,0,nr-1);
+ /* Hinzufgen von Linien, die durch Schnitte mit dem rechten
+ Rand entstanden sind */
+ for(i=0;i<(nr-1)*2;i+=2){
+ l[n].y1=coordr[i]; l[n].x1=MINX;
+ l[n].y2=coordr[i+1];l[n].x2=MINX;
+ if(_GetClippedLine(&l[n].x1,&l[n].y1,&l[n].x2,&l[n].y2) != 0) n++;
+ }
+ }
+
+ /* Add lines from original polygon */
+ for(i=0;i<points;i++){
+ x1=plist[i*2]; y1=plist[i*2+1];
+ if(i==points-1){x2=plist[0]; y2=plist[1];}
+ else{ x2=plist[i*2+2]; y2=plist[i*2+3];}
+ l[n].x1=x1; l[n].y1=y1; l[n].x2=x2; l[n].y2=y2;
+ if(_GetClippedLine(&l[n].x1,&l[n].y1,&l[n].x2,&l[n].y2) != 0) n++;
+ }
+
+
+ /* All done if no line is visible */
+ if(n==0) goto exit;
+ npoints=n;
+
+ free(coordl); free(coordr); coordl=NULL; coordr=NULL;
+
+ /* Speicher fr die zu berechnenden X-Position der einzelnen Linien
+ reservieren */
+ coord=malloc( points*sizeof(int) );
+ if(coord==NULL) goto exit;
+
+ /* Suche des h”chsten bzw. tiefsten Punktes des Polygons und berechnung
+ des Anstieges der einzelnen Linien */
+ ymin=MAXY; ymax=MINY;
+ for(i=0;i<npoints;i++){
+ /* Linie so drehen, daá sie von oben nach unten gezeichnet wird */
+ if(l[i].y1>l[i].y2) {
+ help=l[i].y1; l[i].y1=l[i].y2; l[i].y2=help;
+ help=l[i].x1; l[i].x1=l[i].x2; l[i].x2=help;
+ }
+ /* H”he und Breite der Linie ermitteln */
+ hight=l[i].y2-l[i].y1; width=l[i].x2-l[i].x1;
+
+ /* Richtung der Linie (links bzw. rechts) in help speichern */
+ if(width<0) { width=width*-1;help=-1;}
+ else help=1;
+
+ /* Anstieg der Linie ermitteln */
+ if(hight != 0)
+ l[i].xadd = (long)help*((((long)width)<<16)/((long)hight));
+ else
+ l[i].xadd = 0;
+
+ /* H”chsten bzw. tiefsten Punkt speichern */
+ if(l[i].y1<ymin) ymin=l[i].y1;
+ if(l[i].y2>ymax) ymax=l[i].y2;
+ }
+ for(y=ymin;y<=ymax;y++){
+ for(n=0,i=0;i<npoints;i++){
+ if(y>=l[i].y1 && y<=l[i].y2){
+ if(y==l[i].y1){
+ l[i].sumx=(((long)l[i].x1)<<16)+0x8000L;
+ }
+ else{
+ l[i].sumx+=l[i].xadd;
+ }
+ if(y!=l[i].y2){
+ coord[n]=(int)(l[i].sumx>>16);
+ n++;
+ }
+ }
+ }
+ _IntQuickSort(coord,0,n-1);
+ for(i=0;i<n;i+=2) HLine(coord[i],coord[i+1],y);
+ }
+
+
+ Polygon(points,plist);
+
+ exit:
+ if(l!=NULL) free(l);
+ if(coord!=NULL) free(l);
+ if(coordr!=NULL) free(coordr);
+ if(coordl!=NULL) free(coordl);
+}
/hist-1992-2002/hexenspiel/fillpoly.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/globvar.c
===================================================================
--- hist-1992-2002/hexenspiel/globvar.c (nonexistent)
+++ hist-1992-2002/hexenspiel/globvar.c (revision 106)
@@ -0,0 +1,20 @@
+/* ---------------------------------------------------------------
+GLOBVAR.C
+(c) 1992 by Tobias Herre
+part of DISPLAY.LIB version 1.0
+----------------------------------------------------------------*/
+
+#include <stdio.h>
+#include "display.h"
+
+void (* PutPixel)(int x,int y)=ColorPutPixel;
+
+
+int _clipping=1;
+colortype transpcolor=NOCOLOR;
+colortype color=STDCOLOR;
+void *pattern=NULL;
+int pthight,ptwidth;
+
+int fillstyle = NO_FILL;
+
/hist-1992-2002/hexenspiel/globvar.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/gr.java
===================================================================
--- hist-1992-2002/hexenspiel/gr.java (nonexistent)
+++ hist-1992-2002/hexenspiel/gr.java (revision 106)
@@ -0,0 +1,1099 @@
+//
+// hexenspiel.java
+// (c) 2002 Tube
+//
+
+
+import java.applet.Applet;
+import java.awt.event.*;
+import java.awt.image.*;
+import java.awt.*;
+import java.net.*;
+//import System.out.*;
+
+
+/*
+class LinearStepper
+{
+ interface LStepper
+ {
+ public long step();
+ }
+
+
+
+ static final int F=16;
+
+ private Stepper st;
+
+
+ long pos;
+
+ private class Stepper1 implements Stepper
+ {
+ public long step()
+ {
+ return 1;
+ }
+ }
+
+ public long step()
+ {
+ return st.step();
+ }
+
+
+}
+
+*/
+
+
+
+interface LinearIterpolationPutter
+{
+ public void pixelputter(int x);
+}
+
+
+class LinearInterpolation
+{
+ static final int F=16;
+ public int[] data;
+ public int len;
+
+
+ LinearInterpolation(int start, int end, int n)
+ {
+ if (n<0) n*=-1;
+ data=new int[n];
+ len = n;
+ l(data,0,start,end,n);
+ }
+
+ static void l(int dest[],int si, int start, int end, int n)
+ {
+ int i;
+ long add,pos,diff;
+ long sum;
+ long c1,c2,err;
+
+ if(start<end){
+ diff=end-start;
+ if(diff>=n){
+ add=( diff << F ) / n;
+ pos=((long)start<<F)+add/2;
+ for(i=0;i<n;i++){
+ dest[i+si] = (int)(pos>>F);
+ pos+=add;
+ }
+ }
+ else{
+ sum=n+1;
+ for (i=0; i<n ; i++){
+ sum-=(diff+1);
+ if (sum<0){
+ start++;
+ sum+=n;
+ }
+ dest[i+si] = start;
+ }
+ }
+ }
+ else{
+ diff=start-end;
+ if(diff>=n){
+ add=( diff << F ) / n;
+ pos=((long)start<<F)-add/2;
+ for(i=0;i<n;i++){
+ dest[i+si] = (int)(pos>>F);
+ pos-=add;
+ }
+ }
+ else{
+ sum=n+1;
+ for (i=0; i<n ; i++){
+ sum-=(diff+1);
+ if (sum<0){
+ start--;
+ sum+=n;
+ }
+ dest[i+si] = start;
+ }
+ }
+ }
+ }
+}
+
+
+
+
+
+//import LinearInterpolation.*;
+
+
+class ConvexPolygonShape
+{
+ int polbordera[];
+ int polborderb[];
+
+
+
+ int ystart;
+ int yend;
+ int lastcode;
+
+
+
+
+ ConvexPolygonShape(int w, int h)
+ {
+ polbordera = new int[h];
+ polborderb = new int[h];
+
+
+
+ yend=-1;
+ ystart=h+1;
+ lastcode = 5;
+ }
+
+
+ void line(int x1,int y1,int x2,int y2)
+ {
+ int deltax,deltay;
+ int code;
+ int count,countval,xadd;
+
+ deltax=x2-x1; deltay=y2-y1;
+ if(deltay==0)
+ {
+ lastcode=5;return;
+ }
+
+ code=0;
+ if ( deltax<0 )
+ {
+ deltax=-deltax; code |= 1;
+ }
+
+ if ( deltay<0 )
+ {
+ deltay=-deltay; code |= 2;
+ }
+
+ if ( deltay<0 )
+ {
+ if(y1<ystart) ystart=y1;
+ if(y2>yend) yend=y2;
+ }
+ else
+ {
+ if(y2<ystart) ystart=y2;
+ if(y1>yend) yend=y1;
+ }
+
+ switch (code)
+ {
+ case 0: // Linie von links oben nach rechts unten
+
+ if(deltay<deltax)
+ {
+ if(deltay!=0)
+ {
+ xadd=deltax/deltay;
+ countval=deltax%deltay;
+ count= (deltax>>1) % deltay - deltay;
+ x1+=xadd>>1;
+ while(y1<y2)
+ {
+ polborderb[y1]=x1;
+ y1++; x1+=xadd; count+=countval;
+ if(count>=0)
+ {
+ count-=deltay;
+ x1++;
+ }
+ }
+//LinearInterpolation.l( ybpoints,0,w,y1-y2 );
+
+ }
+ polborderb[y2]=x2;
+ }
+ else
+ {
+ count=deltay>>1;
+ polborderb[y1]=x1;
+ while(y1<y2)
+ {
+ count-=deltax; y1++;
+ if(count<0)
+ {
+ x1++; count+=deltay;
+ }
+ polborderb[y1]=x1;
+ }
+ }
+ break;
+
+ case 1: // Linie von rechts oben nach links unten
+ if(deltay<deltax)
+ {
+ if(deltay!=0)
+ {
+ xadd=deltax/deltay;
+ countval=deltax%deltay;
+ count= (deltax>>1)%deltay - deltay;
+ x2+=xadd>>1;
+ while(y2>y1)
+ {
+ polborderb[y2]=x2;
+ y2--; x2+=xadd; count+=countval;
+ if(count>=0)
+ {
+ count-=deltay;
+ x2++;
+ }
+ }
+ }
+ if(lastcode!=1)
+ polborderb[y1]=x1;
+ }
+ else
+ {
+ count=deltay>>1;
+ polborderb[y2]=x2;
+ while(y2>y1)
+ {
+ count-=deltax; y2--;
+ if(count<0)
+ {
+ x2++; count+=deltay;
+ }
+ polborderb[y2]=x2;
+ }
+ }
+ break;
+
+ case 2: /* Linie von links unten nach rechts oben */
+ if(deltay<deltax)
+ {
+ if(deltay!=0)
+ {
+ xadd=deltax/deltay;
+ countval=deltax%deltay;
+ count= (deltax>>1)%deltay - deltay;
+ x2-=xadd>>1;
+ while(y2<y1)
+ {
+ polbordera[y2]=x2;
+ y2++; x2-=xadd; count+=countval;
+ if(count>=0) {count-=deltay; x2--;}
+ }
+ }
+ if(lastcode!=2) polbordera[y1]=x1;
+ }
+ else
+ {
+ count=deltay>>1;
+ polbordera[y2]=x2;
+ while(y2<y1)
+ {
+ count-=deltax; y2++;
+ if(count<0) {x2--; count+=deltay;};
+ polbordera[y2]=x2;
+ }
+ }
+ break;
+
+ case 3: /* Linie von rechts unten nach links oben */
+ if(deltay<deltax){
+ if(deltay!=0){
+ xadd=deltax/deltay;
+ countval=deltax%deltay;
+ count= (deltax>>1)%deltay - deltay;
+ x1-=xadd>>1;
+ while(y1>y2){
+ polbordera[y1]=x1;
+ y1--; x1-=xadd; count+=countval;
+ if(count>=0) {count-=deltay; x1--;}
+ }
+ }
+ polbordera[y2]=x2;
+ }
+ else{
+ count=deltay>>1;
+ polbordera[y1]=x1;
+ while(y1>y2){
+ count-=deltax; y1--; if(count<0) {x1--; count+=deltay;};
+ polbordera[y1]=x1;
+ }
+ }
+ break;
+ } /* switch */
+
+ lastcode = code;
+}
+
+
+
+
+
+}
+
+
+
+
+class MRawGraphics extends Component
+{
+ public int buffer[] = null;
+ public int width=0, height=0;
+ int color=0;
+ int bgcolor=0;
+ int size=0;
+
+
+
+ public void setSize(int w,int h)
+ {
+ int s = w*h;
+ buffer = new int[w*h+5];
+ size=s;
+ width=w;
+ height=h;
+ }
+
+
+ public void drawPixel(int x,int y)
+ {
+ buffer[x+width*y]=color;
+ }
+
+ public int getPixel(int x, int y)
+ {
+ return buffer[x+width*y];
+ }
+
+ public void drawPixel(long x,long y)
+ {
+ buffer[(int)(x+width*y)]=color;
+ }
+
+ public void setColor( int c)
+ {
+ color=c;
+ }
+
+ public void setColor( int r, int g, int b)
+ {
+ color = (255<<24)|(r<<16)|(g<<8)|b;
+ }
+
+
+ void drawEllipse(int x,int y,int a,int b)
+ {
+ long x1,y1;
+ long ref,xan,yan,xann,yann;
+
+ x1=0;y1=b;
+
+ xan=b*b;
+ xann=2*b*b;
+
+ yan=-2*y1*a*a+a*a;
+ yann=2*a*a;
+
+ ref=xan/2;
+
+ while (y1>=0)
+ {
+ drawPixel(x+x1,y+y1);
+ drawPixel(x-x1,y+y1);
+ drawPixel(x+x1,y-y1);
+ drawPixel(x-x1,y-y1);
+
+ if(ref+yan<0)
+ {
+ ref+=xan; xan+=xann; x1++;
+ if(ref+ref+yan>=0)
+ {
+ ref+=yan; yan+=yann; y1--;
+ }
+ }
+ else
+ {
+ ref+=yan; yan+=yann; y1--;
+ if (ref+ref+xan<0)
+ {
+ ref+=xan; xan+=xann; x1++;
+ }
+ }
+ }
+ y1++;
+ while(x1<=a)
+ {
+ drawPixel(x+x1,y+y1);
+ drawPixel(x-x1,y+y1);
+ drawPixel(x+x1,y-y1);
+ drawPixel(x-x1,y-y1);
+ x1++;
+ }
+ }
+
+
+
+int tc = 0;
+
+final int MYF=16 ;
+
+private void DrawImageLine(int x1,int y1,int x2,int y2,int s_x,int s_y,int s_w,MRawGraphics mg)
+{
+ int deltax,deltay;
+ long sumx,sumy,xadd,yadd;
+ int xdir,ydir,i;
+ int width;
+ int color;
+
+ if (s_w<=0) return;
+
+ deltax=x2-x1; deltay=y2-y1;
+
+
+ if ( deltax<0 ) { deltax=-deltax; xdir=-1; } else xdir=1;
+ if ( deltay<0 ) { deltay=-deltay; ydir=-1; } else ydir=1;
+
+// deltax++;
+// deltay++;
+
+ xadd=((long)(deltax)<<16)/s_w;xadd*=xdir;
+ yadd=((long)(deltay)<<16)/s_w;yadd*=ydir;
+
+
+ sumx=((long)x1<<16)+(xadd)/2;
+ sumy=((long)y1<<16)+(yadd)/2;
+
+
+// xadd=yadd=0;
+
+tc=255-tc;
+
+
+ LinearInterpolation px,py;
+ px = new LinearInterpolation ( x1,x2,s_w);
+ py = new LinearInterpolation ( y1,y2,s_w);
+
+ for (i=0; i<s_w; i++)
+ {
+ int xx,yy;
+ xx=px.data[i];
+ yy=py.data[i];
+ color=mg.buffer[((yy+(0<<(MYF-1)))>>MYF)*mg.width+((xx+(0<<(MYF-1)))>>MYF)];
+// color=mg.buffer[(yy)*mg.width+(xx)];
+ setColor(color);
+ drawPixel(s_x+i,s_y);
+
+ }
+
+
+/*
+
+ for(i=0;i<s_w;i++){
+
+ color=mg.buffer[mg.width*(int)(sumy>>16)+(int)(sumx>>16)];
+
+ setColor(color);
+ drawPixel(s_x+i,s_y);
+
+// setColor(tc,0,0);
+ drawPixel((int)sumx>>16,(int)(sumy>>16));
+ sumx+=xadd; sumy+=yadd;
+ }
+
+*/
+
+}
+
+
+
+int bax[],bay[],bbx[],bby[];
+
+void CalcOrgPoints(int y1,int y2,int len,int orgpoints[],int lastcode)
+{
+ int deltay,ydir;
+ long yadd,sumy;
+ int i;
+ int bx[]=null,by[]=null;
+
+ switch(lastcode){
+ case 0:
+ bx=bbx;by=bby;break;
+ case 1:
+ bx=bbx;by=bby;break;
+ case 2:
+ bx=bax;by=bay;break;
+ case 3:
+ bx=bax;by=bay;break;
+ }
+
+ deltay=y2-y1;
+
+ if ( deltay==0)return;
+ if ( deltay<0 ) {
+ deltay=-deltay; ydir=-1;
+ }
+ else
+ ydir=1;
+
+ yadd=((long)len<<16)/(long)deltay;
+ sumy=(yadd)/2;
+
+ for(i=y1; i!=y2; i+=ydir){
+ bx[i]=orgpoints[(int)(sumy>>16)*2];
+ by[i]=orgpoints[(int)(sumy>>16)*2+1];
+ sumy+=yadd;
+ }
+ sumy=((long)len)<<16;
+ sumy=sumy-1-yadd;
+ bx[i]=orgpoints[(int)(sumy>>16)*2];
+ by[i]=orgpoints[(int)(sumy>>16)*2+1];
+ sumy+=yadd;
+}
+
+
+
+
+
+
+
+
+
+
+
+ public void drawImageShaped(int pixlist[], MRawGraphics mg)
+ {
+ ConvexPolygonShape ps = new ConvexPolygonShape(width,height);
+// int width,hight;
+ int orgpoints[];
+ int i;
+
+// b.polbordera=malloc( sizeof(int)*(MAXY-MINY+1) );
+// b.polborderb=malloc( sizeof(int)*(MAXY-MINY+1) );
+
+ bax = new int [height]; // (MAXY-MINY+1));
+ bay = new int [height]; //malloc( sizeof(int)*(MAXY-MINY+1));
+ bbx = new int [height]; // malloc( sizeof(int)*(MAXY-MINY+1));
+ bby = new int [height]; // malloc( sizeof(int)*(MAXY-MINY+1));
+
+
+ orgpoints = new int [2*width+2];
+
+
+ /* H”he und Breite des Originals ermitteln */
+// width=((int *)data)[0];
+// hight=((int *)data)[1];
+
+
+
+
+
+int xbpoints[];
+int ybpoints[];
+int xapoints[];
+int yapoints[];
+
+xbpoints = new int[height];
+ybpoints = new int[height];
+xapoints = new int[height];
+yapoints = new int[height];
+
+ int mgw=mg.width;
+ int mgh=mg.height;
+
+ mgw=mgw<<MYF;
+ mgh=mgh<<MYF;
+
+
+ int y1,y2,x1,x2;
+
+ x1=pixlist[0];y1=pixlist[1];x2=pixlist[2];y2=pixlist[3];
+
+ ps.line(x1,y1,x2,y2);
+
+
+ if ( y1 < y2 ){
+ LinearInterpolation.l(xbpoints,y1,0,mgw,y2-y1);
+ LinearInterpolation.l(ybpoints,y1,0,0,y2-y1);
+ }
+ else {
+ LinearInterpolation.l(xapoints,y2,mgw,0,y1-y2);
+ LinearInterpolation.l(yapoints,y2,0,0,y1-y2);
+ }
+
+//---
+
+ x1=pixlist[2];y1=pixlist[3];x2=pixlist[4];y2=pixlist[5];
+ ps.line(x1,y1,x2,y2);
+
+
+ if ( y1 < y2 ){
+ LinearInterpolation.l(xbpoints,y1,mgw,mgw,y2-y1);
+ LinearInterpolation.l(ybpoints,y1,0,mgh,y2-y1);
+ }
+ else {
+ LinearInterpolation.l(xapoints,y2,mgw,mgw,y1-y2);
+ LinearInterpolation.l(yapoints,y2,mgh,0,y1-y2);
+ }
+
+//---
+
+ x1=pixlist[4];y1=pixlist[5];x2=pixlist[6];y2=pixlist[7];
+ ps.line(x1,y1,x2,y2);
+
+ if ( y1 < y2 ){
+ LinearInterpolation.l(xbpoints,y1,mgw,0,y2-y1);
+ LinearInterpolation.l(ybpoints,y1,mgh,mgh,y2-y1);
+ }
+ else {
+ LinearInterpolation.l(xapoints,y2,0,mgw,y1-y2);
+ LinearInterpolation.l(yapoints,y2,mgh,mgh,y1-y2);
+ }
+
+//---
+
+ x1=pixlist[6];y1=pixlist[7];x2=pixlist[0];y2=pixlist[1];
+ ps.line(x1,y1,x2,y2);
+
+ if ( y1 < y2 ){
+ LinearInterpolation.l(xbpoints,y1,0,0,y2-y1);
+ LinearInterpolation.l(ybpoints,y1,mgh,0,y2-y1);
+ }
+ else {
+ LinearInterpolation.l(xapoints,y2,0,0,y1-y2);
+ LinearInterpolation.l(yapoints,y2,0,mgh,y1-y2);
+ }
+
+
+
+ LinearInterpolation lp;
+ lp = new LinearInterpolation(0,mgw,pixlist[3]-pixlist[1]);
+
+
+
+
+
+for( int z=0; z<lp.len; z++)
+{
+setColor ( mg.getPixel( (lp.data[z]+(MYF>>1))>>MYF,0) );
+
+// setColor( mg.buffer[ lp.data[z] / ( MYF) ] );
+drawPixel(z,400);
+
+
+}
+ for(i=0; i<lp.len; i++)
+ {
+ System.out.print(" ");
+ System.out.print("(");
+ System.out.print(lp.data[i]);
+ System.out.print(")");
+ System.out.print((lp.data[i]+(MYF>>1))>>MYF);
+ }
+
+ for(i=0; i<lp.len; i++)
+ {
+// System.out.print(" ");
+// System.out.print(lp.data[i]);
+ }
+
+
+System.out.println("");
+
+
+/*
+int ii=0;
+for (int hh=ps.ystart; hh<ps.yend; hh++ )
+{
+int c=mg.buffer[xbpoints[hh]+ybpoints[hh]*mg.width];
+setColor(c);
+drawPixel(ii,280);
+
+c=mg.buffer[xapoints[hh]+yapoints[hh]*mg.width];
+setColor(c);
+drawPixel(ii,285);
+
+ii++;
+
+
+}
+*/
+
+
+ for(i=ps.ystart;i<=ps.yend;i++){
+ DrawImageLine(
+ xapoints[i],yapoints[i],
+ xbpoints[i],ybpoints[i],
+ ps.polbordera[i],i,ps.polborderb[i]-ps.polbordera[i]+1,mg);
+ }
+
+
+
+
+
+ }
+}
+
+
+
+
+class MGraphics extends MRawGraphics
+{
+ Image img;
+ public MemoryImageSource ms;
+
+ public Image getImage()
+ {
+ return img;
+ }
+
+ public void setSize( int w,int h)
+ {
+ super.setSize(w,h);
+ ms = new MemoryImageSource(width,height,buffer,0,width);
+ ms.setAnimated(true);
+ img = createImage ( ms );
+ }
+
+
+ public void LoadImage( String name, Applet a)
+ {
+ MediaTracker t = new MediaTracker(this);
+ Image im;
+
+System.out.println("trying to load image");
+// im = a.getImage(a.getCodeBase(),name);
+Toolkit tk = Toolkit.getDefaultToolkit();
+im = tk.getImage(name);
+if ( im == null)
+ System.out.println("Scheisse");
+ t.addImage(im,0);
+ try
+ {
+ t.waitForID(0);
+ }
+ catch(InterruptedException e)
+ {
+ return;
+ }
+
+ setSize (im.getWidth(this),im.getHeight(this));
+ PixelGrabber pg = new PixelGrabber(im,0,0,width,height,buffer,0,width);
+ try
+ {
+ pg.grabPixels();
+ }
+ catch (InterruptedException e)
+ {
+ }
+
+
+ }
+
+ public void mgupdate()
+ {
+// ms.newPixels(0,0,width,height);
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ class gr1 extends Frame
+{
+
+ gr1()
+ {
+ init();
+ }
+
+ //
+ // our own repaint method
+ // notifies the thread to repaint
+ //
+
+ public synchronized void irepaint()
+ {
+ notify();
+ }
+
+
+ Applet app=new Applet();
+
+
+ Rectangle updateRgn = new Rectangle(0,0);
+ Rectangle dupdateRgn = new Rectangle(0,0);
+
+
+ private void setUpdateRgn(int x,int y, int w, int h)
+ {
+ if (updateRgn.height==0)
+ {
+ updateRgn.height=h;
+ updateRgn.width=w;
+ updateRgn.x=x;
+ updateRgn.y=y;
+ }
+ else
+ {
+ updateRgn.add(new Rectangle(x,y,w,h));
+ }
+
+ }
+
+
+
+
+
+
+
+String mpos = new String ("tube");
+MGraphics quad;
+
+ Image backBuffer;
+
+
+ MGraphics bpix;
+
+
+ public void init()
+ {
+
+ setBackground(new Color(99,0,0));
+
+ backBuffer = createImage( 800, 400);
+
+
+
+ quad = new MGraphics();
+// quad.LoadImage("quad1.gif",app);
+ quad.LoadImage("karte1.gif",app);
+
+ bpix = new MGraphics();
+ bpix.setSize(800,800);
+
+
+setSize(800,500);
+
+ repaint();
+ }
+
+
+//-----------------------------------------------------------------
+
+ public void paint(Graphics g)
+ {
+
+
+ Polygon xp = new Polygon();
+ xp.addPoint(0,0);
+ xp.addPoint(300,300);
+ xp.addPoint(0,300);
+
+
+int w = 100;
+int h = 100;
+int pix[] = new int[w * h];
+int index = 0;
+
+
+Image mimg;
+
+{
+
+/* for (int y = 0; y < h; y++) {
+ int red = (y * 255) / (h - 1);
+ for (int x = 0; x < w; x++) {
+ int blue = (x * 255) / (w - 1);
+ pix[index++] = (255 << 24) | (red << 16) | blue;
+ }
+ }
+ mimg = createImage(new MemoryImageSource(w, h, pix, 0, w));
+*/
+
+
+
+
+
+
+}
+
+
+
+/* Graphics bbg = backBuffer.getGraphics();
+ bbg.clearRect(
+ dupdateRgn.x,
+ dupdateRgn.y,
+ dupdateRgn.width,
+ dupdateRgn.height
+ );
+ g.drawImage(backBuffer,0,0,this);
+
+*/
+
+
+index = 0;
+for (int y1 = 0; y1 < 50; y1++)
+{
+ for (int x1 = 0; x1 < 50; x1++) {
+ pix[index++] = (255 << 24) | 255<<16;
+ }
+}
+
+
+
+/* index=0;
+ for (int y = 0; y < h; y++) {
+ int red = (y * 0) / (h - 1);
+ for (int x = 0; x < w; x++) {
+ int blue = (x * 255) / (w - 1);
+ pix[index++] = (255 << 24) | (255 << 16) | blue;
+ }
+ }
+*/
+
+//g.drawImage(mimg,0,0,this);
+
+//g.drawPolygon(x);
+
+
+
+
+
+
+
+
+bpix.setColor(0,0,120);
+bpix.drawPixel(10,10);
+bpix.drawPixel(10,11);
+bpix.drawPixel(10,12);
+bpix.drawPixel(10,13);
+
+
+ // int pli[] = {100,0,400,100,100,200,0,100};
+// int pli[] = {300,0,600,300,300,600,0,300};
+// int pli[] = {800,0,1600,800,800,1600,0,800};
+//int pli[] = {60,0,120,60,60,120,0,60};
+
+
+final int plix = 250;
+final int pliy = 20;
+final int pliz = 9;
+
+
+int pli[] = {plix + 0 , 91,
+ plix + 230 , 90 ,
+ plix + 330 , 390,
+ plix + -50 ,391};
+
+
+
+
+
+
+
+
+bpix.drawImageShaped (pli,quad);
+// bpix.drawEllipse(150,150,100,110);
+
+
+g.drawImage(bpix.getImage(),0,0,this );
+
+
+
+
+
+
+
+ }
+
+//----------------------------------------------------------------------
+
+
+
+
+
+
+
+
+
+
+}
+
+
+
+class gr
+{
+ public static void main (String[] args)
+ {
+
+// System.out.println("Hello World");
+// ISystem.out.print(9);
+
+ gr1 g = new gr1();
+ g.setVisible(true);
+
+
+ final int MYF = 10;
+
+ LinearInterpolation lp;
+ lp = new LinearInterpolation(0,4*MYF,5);
+
+ for(int i=0; i<lp.len; i++)
+ {
+ System.out.print(" ");
+ System.out.print(lp.data[i]);
+ }
+ System.out.println("");
+ for(int i=0; i<lp.len; i++)
+ {
+ System.out.print(" ");
+ System.out.print((int)(((double)lp.data[i])/MYF));
+ }
+ System.out.println("");
+ for(int i=0; i<lp.len; i++)
+ {
+ System.out.print(" ");
+ System.out.print(lp.data[i]);
+ }
+
+ while(true){
+ Thread.yield();
+ }
+ }
+}
/hist-1992-2002/hexenspiel/gr.java
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/ellipse.c
===================================================================
--- hist-1992-2002/hexenspiel/ellipse.c (nonexistent)
+++ hist-1992-2002/hexenspiel/ellipse.c (revision 106)
@@ -0,0 +1,61 @@
+/***********************************************************************
+ellipse.c
+Copyright (c) 1993 by Tobias Herre
+part of GRAPHLIB VERSION 1.0
+***********************************************************************/
+
+#include "display.h"
+#include "sys.h"
+
+/***********************************************************************
+description:
+ draw an ellipse using Breasenhams algorithm
+intput:
+ (x,y): center point
+ a: horizontal radius
+ b: vertical radius
+***********************************************************************/
+
+void Ellipse(int x,int y,int a,int b)
+{
+ int x1,y1;
+ int32 ref,xan,yan,xann,yann;
+
+ x1=0;y1=b;
+
+ xan=(int32)b*(int32)b;
+ xann=2L*(int32)b*(int32)b;
+
+ yan=-2L*(int32)y1*(int32)a*(int32)a+(int32)a*(int32)a;
+ yann=2L*(int32)a*(int32)a;
+
+ ref=xan/2;
+
+ while (y1>=0){
+ PutPixel(x+x1,y+y1);
+ PutPixel(x-x1,y+y1);
+ PutPixel(x+x1,y-y1);
+ PutPixel(x-x1,y-y1);
+
+ if(ref+yan<0){
+ ref+=xan; xan+=xann; x1++;
+ if(ref+ref+yan>=0){
+ ref+=yan; yan+=yann; y1--;
+ }
+ }
+ else{
+ ref+=yan; yan+=yann; y1--;
+ if (ref+ref+xan<0){
+ ref+=xan; xan+=xann; x1++;
+ }
+ }
+ }
+ y1++;
+ while(x1<=a){
+ PutPixel(x+x1,y+y1);
+ PutPixel(x-x1,y+y1);
+ PutPixel(x+x1,y-y1);
+ PutPixel(x-x1,y-y1);
+ x1++;
+ }
+}
/hist-1992-2002/hexenspiel/ellipse.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/fill.c
===================================================================
--- hist-1992-2002/hexenspiel/fill.c (nonexistent)
+++ hist-1992-2002/hexenspiel/fill.c (revision 106)
@@ -0,0 +1,90 @@
+/* ---------------------------------------------------------------
+FILL.C
+(c) 1992 by Tobias Herre
+part of DISPLAY.LIB version 1.0
+----------------------------------------------------------------*/
+
+#include <malloc.h>
+#include "display.h"
+
+static struct buffstru{
+ int from,to;
+ int x;
+}*b,*lb,*llb;
+static int blen,lblen,llblen;
+static colortype backcol;
+
+static int TestPixel(int x,int y)
+{
+ int i;
+ if(y<MINY || y>MAXY || x<MINX || x>MAXX) return 0;
+ for(i=0;i<llblen;i++) if(y>=llb[i].from && y<=llb[i].to && llb[i].x==x) return 0;
+ for(i=0;i<lblen;i++) if(y>=lb[i].from && y<=lb[i].to && lb[i].x==x) return 0;
+ for(i=0;i<blen;i++) if(y>=b[i].from && y<=b[i].to && b[i].x==x) return 0;
+ if(GetPixel(x,y)!=backcol) return 0;
+ return 1;
+}
+
+static void Scan(int x,int from,int to)
+{
+ int start,flag,y;
+ flag=0;
+ for(y=from;y<=to || flag;y++){
+ if(TestPixel(x,y)){
+ if(!flag) {
+ start=y-1;
+ flag=1;
+ }
+ }
+ else{
+ if(flag){
+ b[blen].x=x;
+ while( TestPixel(x,y) ) y++;
+ b[blen].to=y-1;
+ while( TestPixel(x,start)) start--;
+ b[blen].from=start+1;
+ flag=0;
+ blen++;
+ }
+ }
+ }
+}
+
+/*--------------------------------------------------------------
+*/
+void Fill(int x,int y)
+{
+ int i;
+ struct buffstru *help;
+
+ b=malloc( sizeof(struct buffstru) * (MAXY-MINY+1) );
+ if(b==NULL) goto exitfill;
+ lb=malloc( sizeof(struct buffstru) * (MAXY-MINY+1) );
+ if(lb==NULL) goto exitfill;
+ llb=malloc( sizeof(struct buffstru) * (MAXY-MINY+1) );
+ if(llb==NULL) goto exitfill;
+
+
+ backcol=GetPixel(x,y);
+
+ blen=0; lblen=0; llblen=0;
+ Scan(x,y,y);
+
+ do{
+ for(i=0;i<blen;i++){
+ VLine(b[i].from,b[i].to,b[i].x);
+ }
+ llblen=lblen; lblen=blen; blen=0;
+ help=llb; llb=lb; lb=b; b=help;
+ for(i=0;i<lblen;i++){
+ Scan(lb[i].x+1,lb[i].from,lb[i].to);
+ Scan(lb[i].x-1,lb[i].from,lb[i].to);
+ }
+ }while(blen!=0);
+
+ exitfill:
+ if(llb!=NULL) free(llb);
+ if(lb!=NULL) free(lb);
+ if(b!=NULL) free(b);
+
+}
/hist-1992-2002/hexenspiel/fill.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/getimage.c
===================================================================
--- hist-1992-2002/hexenspiel/getimage.c (nonexistent)
+++ hist-1992-2002/hexenspiel/getimage.c (revision 106)
@@ -0,0 +1,23 @@
+/* ---------------------------------------------------------------
+GETIMAGE.C
+(c) 1992 by Tobias Herre
+part of DISPLAY.LIB version 1.0
+----------------------------------------------------------------*/
+
+#include "display.h"
+
+/* ----------------------------------------------------------------
+ copy an image from screen to memory
+*/
+void GetImage(int x,int y,int width, int hight, void *data)
+{
+ int x1,y1;
+ *((int *)data) = width; data=(int *)data+1;
+ *((int *)data) = hight; data=(int *)data+1;
+ for(y1=0; y1<hight; y1++)
+ for(x1=0; x1<width; x1++){
+ *((colortype *)data) = GetPixel( x+x1,y+y1);
+ data=(colortype *)data+1;
+ }
+}
+
/hist-1992-2002/hexenspiel/getimage.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/gr.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/hist-1992-2002/hexenspiel/gr.class
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/gr1.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/hist-1992-2002/hexenspiel/gr1.class
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/hexenbackup.java
===================================================================
--- hist-1992-2002/hexenspiel/hexenbackup.java (nonexistent)
+++ hist-1992-2002/hexenspiel/hexenbackup.java (revision 106)
@@ -0,0 +1,1342 @@
+//
+// hexenspiel.java
+// (c) 2002 Tube
+//
+
+
+import java.applet.Applet;
+import java.awt.event.*;
+import java.awt.image.*;
+import java.awt.*;
+import java.net.*;
+
+
+
+
+class LinearStepper
+{
+ interface LStepper
+ {
+ public long step();
+ }
+
+
+
+ static final int F=16;
+
+ private Stepper st;
+
+
+ long pos;
+
+ private class Stepper1 implements Stepper
+ {
+ public long step()
+ {
+ return 1;
+ }
+ }
+
+ public long step()
+ {
+ return st.step();
+ }
+
+
+}
+
+
+
+
+
+interface LinearIterpolationPutter
+{
+ public void pixelputter(int x);
+}
+
+
+class LinearInterpolation
+{
+ static final int F=16;
+ public int[] data;
+ public int len;
+
+
+ LinearInterpolation(int start, int end, int n)
+ {
+ if (n<0) n*=-1;
+ data=new int[n];
+ len = n;
+ l(data,0,start,end,n);
+ }
+
+ static void l(int dest[],int si, int start, int end, int n)
+ {
+ int i;
+ long add,pos,diff;
+ int sum;
+
+ if(start<end){
+ diff=end-start;
+ if(diff>=n){
+ add=( diff << F ) / n;
+ pos=((long)start<<F)+add/2;
+ for(i=0;i<n;i++){
+ dest[i+si] = (int)(pos>>F);
+ pos+=add;
+ }
+ }
+ else{
+ sum=n>>1;
+ for(i=0;i<n;i++){
+ dest[i+si]=start;
+ sum-=(int)diff; if (sum<0) {start++; sum+=n;}
+ }
+ }
+ }
+ else{
+ diff=start-end;
+ if(diff>=n){
+ add=( diff << F ) / n;
+ pos=((long)start<<F)-add/2;
+
+ for(i=0;i<n;i++){
+ dest[i+si] = (int)(pos>>F);
+ pos-=add;
+ }
+
+ }
+ else{
+ sum=n>>1;
+ for(i=0;i<n;i++){
+ dest[i+si]=start;
+ sum-=(int)diff; if (sum<0) {start--; sum+=n;}
+ }
+ }
+ }
+ }
+
+
+}
+
+
+
+
+
+//import LinearInterpolation.*;
+
+
+class ConvexPolygonShape
+{
+ int polbordera[];
+ int polborderb[];
+
+
+
+ int ystart;
+ int yend;
+ int lastcode;
+
+
+
+
+ ConvexPolygonShape(int w, int h)
+ {
+ polbordera = new int[h];
+ polborderb = new int[h];
+
+
+
+ yend=-1;
+ ystart=h+1;
+ lastcode = 5;
+ }
+
+
+ void line(int x1,int y1,int x2,int y2)
+ {
+ int deltax,deltay;
+ int code;
+ int count,countval,xadd;
+
+ deltax=x2-x1; deltay=y2-y1;
+ if(deltay==0)
+ {
+ lastcode=5;return;
+ }
+
+ code=0;
+ if ( deltax<0 )
+ {
+ deltax=-deltax; code |= 1;
+ }
+
+ if ( deltay<0 )
+ {
+ deltay=-deltay; code |= 2;
+ }
+
+ if ( deltay<0 )
+ {
+ if(y1<ystart) ystart=y1;
+ if(y2>yend) yend=y2;
+ }
+ else
+ {
+ if(y2<ystart) ystart=y2;
+ if(y1>yend) yend=y1;
+ }
+
+ switch (code)
+ {
+ case 0: // Linie von links oben nach rechts unten
+
+ if(deltay<deltax)
+ {
+ if(deltay!=0)
+ {
+ xadd=deltax/deltay;
+ countval=deltax%deltay;
+ count= (deltax>>1) % deltay - deltay;
+ x1+=xadd>>1;
+ while(y1<y2)
+ {
+ polborderb[y1]=x1;
+ y1++; x1+=xadd; count+=countval;
+ if(count>=0)
+ {
+ count-=deltay;
+ x1++;
+ }
+ }
+//LinearInterpolation.l( ybpoints,0,w,y1-y2 );
+
+ }
+ polborderb[y2]=x2;
+ }
+ else
+ {
+ count=deltay>>1;
+ polborderb[y1]=x1;
+ while(y1<y2)
+ {
+ count-=deltax; y1++;
+ if(count<0)
+ {
+ x1++; count+=deltay;
+ }
+ polborderb[y1]=x1;
+ }
+ }
+ break;
+
+ case 1: // Linie von rechts oben nach links unten
+ if(deltay<deltax)
+ {
+ if(deltay!=0)
+ {
+ xadd=deltax/deltay;
+ countval=deltax%deltay;
+ count= (deltax>>1)%deltay - deltay;
+ x2+=xadd>>1;
+ while(y2>y1)
+ {
+ polborderb[y2]=x2;
+ y2--; x2+=xadd; count+=countval;
+ if(count>=0)
+ {
+ count-=deltay;
+ x2++;
+ }
+ }
+ }
+ if(lastcode!=1)
+ polborderb[y1]=x1;
+ }
+ else
+ {
+ count=deltay>>1;
+ polborderb[y2]=x2;
+ while(y2>y1)
+ {
+ count-=deltax; y2--;
+ if(count<0)
+ {
+ x2++; count+=deltay;
+ }
+ polborderb[y2]=x2;
+ }
+ }
+ break;
+
+ case 2: /* Linie von links unten nach rechts oben */
+ if(deltay<deltax)
+ {
+ if(deltay!=0)
+ {
+ xadd=deltax/deltay;
+ countval=deltax%deltay;
+ count= (deltax>>1)%deltay - deltay;
+ x2-=xadd>>1;
+ while(y2<y1)
+ {
+ polbordera[y2]=x2;
+ y2++; x2-=xadd; count+=countval;
+ if(count>=0) {count-=deltay; x2--;}
+ }
+ }
+ if(lastcode!=2) polbordera[y1]=x1;
+ }
+ else
+ {
+ count=deltay>>1;
+ polbordera[y2]=x2;
+ while(y2<y1)
+ {
+ count-=deltax; y2++;
+ if(count<0) {x2--; count+=deltay;};
+ polbordera[y2]=x2;
+ }
+ }
+ break;
+
+ case 3: /* Linie von rechts unten nach links oben */
+ if(deltay<deltax){
+ if(deltay!=0){
+ xadd=deltax/deltay;
+ countval=deltax%deltay;
+ count= (deltax>>1)%deltay - deltay;
+ x1-=xadd>>1;
+ while(y1>y2){
+ polbordera[y1]=x1;
+ y1--; x1-=xadd; count+=countval;
+ if(count>=0) {count-=deltay; x1--;}
+ }
+ }
+ polbordera[y2]=x2;
+ }
+ else{
+ count=deltay>>1;
+ polbordera[y1]=x1;
+ while(y1>y2){
+ count-=deltax; y1--; if(count<0) {x1--; count+=deltay;};
+ polbordera[y1]=x1;
+ }
+ }
+ break;
+ } /* switch */
+
+ lastcode = code;
+}
+
+
+
+
+
+}
+
+
+
+
+class MRawGraphics extends Component
+{
+ public int buffer[] = null;
+ public int width=0, height=0;
+ int color=0;
+ int bgcolor=0;
+ int size=0;
+
+
+
+ public void setSize(int w,int h)
+ {
+ int s = w*h;
+ buffer = new int[w*h];
+ size=s;
+ width=w;
+ height=h;
+ }
+
+
+ public void drawPixel(int x,int y)
+ {
+ buffer[x+width*y]=color;
+ }
+
+ public void drawPixel(long x,long y)
+ {
+ buffer[(int)(x+width*y)]=color;
+ }
+
+ public void setColor( int c)
+ {
+ color=c;
+ }
+
+ public void setColor( int r, int g, int b)
+ {
+ color = (255<<24)|(r<<16)|(g<<8)|b;
+ }
+
+
+ void drawEllipse(int x,int y,int a,int b)
+ {
+ long x1,y1;
+ long ref,xan,yan,xann,yann;
+
+ x1=0;y1=b;
+
+ xan=b*b;
+ xann=2*b*b;
+
+ yan=-2*y1*a*a+a*a;
+ yann=2*a*a;
+
+ ref=xan/2;
+
+ while (y1>=0)
+ {
+ drawPixel(x+x1,y+y1);
+ drawPixel(x-x1,y+y1);
+ drawPixel(x+x1,y-y1);
+ drawPixel(x-x1,y-y1);
+
+ if(ref+yan<0)
+ {
+ ref+=xan; xan+=xann; x1++;
+ if(ref+ref+yan>=0)
+ {
+ ref+=yan; yan+=yann; y1--;
+ }
+ }
+ else
+ {
+ ref+=yan; yan+=yann; y1--;
+ if (ref+ref+xan<0)
+ {
+ ref+=xan; xan+=xann; x1++;
+ }
+ }
+ }
+ y1++;
+ while(x1<=a)
+ {
+ drawPixel(x+x1,y+y1);
+ drawPixel(x-x1,y+y1);
+ drawPixel(x+x1,y-y1);
+ drawPixel(x-x1,y-y1);
+ x1++;
+ }
+ }
+
+
+
+int tc = 0;
+
+final int MYF=3; //23768;
+
+private void DrawImageLine(int x1,int y1,int x2,int y2,int s_x,int s_y,int s_w,MRawGraphics mg)
+{
+ int deltax,deltay;
+ long sumx,sumy,xadd,yadd;
+ int xdir,ydir,i;
+ int width;
+ int color;
+
+ if (s_w<=0) return;
+
+ deltax=x2-x1; deltay=y2-y1;
+
+
+ if ( deltax<0 ) { deltax=-deltax; xdir=-1; } else xdir=1;
+ if ( deltay<0 ) { deltay=-deltay; ydir=-1; } else ydir=1;
+
+// deltax++;
+// deltay++;
+
+ xadd=((long)(deltax)<<16)/s_w;xadd*=xdir;
+ yadd=((long)(deltay)<<16)/s_w;yadd*=ydir;
+
+
+ sumx=((long)x1<<16)+(xadd)/2;
+ sumy=((long)y1<<16)+(yadd)/2;
+
+
+// xadd=yadd=0;
+
+tc=255-tc;
+
+
+ LinearInterpolation px,py;
+ px = new LinearInterpolation ( x1,x2,s_w);
+ py = new LinearInterpolation ( y1,y2,s_w);
+
+ for (i=0; i<s_w; i++)
+ {
+ int xx,yy;
+ xx=px.data[i];
+ yy=py.data[i];
+ color=mg.buffer[(yy/MYF)*mg.width+(xx/MYF)];
+// color=mg.buffer[(yy)*mg.width+(xx)];
+ setColor(color);
+ drawPixel(s_x+i,s_y);
+
+ }
+
+
+/*
+
+ for(i=0;i<s_w;i++){
+
+ color=mg.buffer[mg.width*(int)(sumy>>16)+(int)(sumx>>16)];
+
+ setColor(color);
+ drawPixel(s_x+i,s_y);
+
+// setColor(tc,0,0);
+ drawPixel((int)sumx>>16,(int)(sumy>>16));
+ sumx+=xadd; sumy+=yadd;
+ }
+
+*/
+
+}
+
+
+
+int bax[],bay[],bbx[],bby[];
+
+void CalcOrgPoints(int y1,int y2,int len,int orgpoints[],int lastcode)
+{
+ int deltay,ydir;
+ long yadd,sumy;
+ int i;
+ int bx[]=null,by[]=null;
+
+ switch(lastcode){
+ case 0:
+ bx=bbx;by=bby;break;
+ case 1:
+ bx=bbx;by=bby;break;
+ case 2:
+ bx=bax;by=bay;break;
+ case 3:
+ bx=bax;by=bay;break;
+ }
+
+ deltay=y2-y1;
+
+ if ( deltay==0)return;
+ if ( deltay<0 ) {
+ deltay=-deltay; ydir=-1;
+ }
+ else
+ ydir=1;
+
+ yadd=((long)len<<16)/(long)deltay;
+ sumy=(yadd)/2;
+
+ for(i=y1; i!=y2; i+=ydir){
+ bx[i]=orgpoints[(int)(sumy>>16)*2];
+ by[i]=orgpoints[(int)(sumy>>16)*2+1];
+ sumy+=yadd;
+ }
+ sumy=((long)len)<<16;
+ sumy=sumy-1-yadd;
+ bx[i]=orgpoints[(int)(sumy>>16)*2];
+ by[i]=orgpoints[(int)(sumy>>16)*2+1];
+ sumy+=yadd;
+}
+
+
+
+
+
+
+
+
+
+
+
+ public void drawImageShaped(int pixlist[], MRawGraphics mg)
+ {
+ ConvexPolygonShape ps = new ConvexPolygonShape(width,height);
+// int width,hight;
+ int orgpoints[];
+ int i;
+
+// b.polbordera=malloc( sizeof(int)*(MAXY-MINY+1) );
+// b.polborderb=malloc( sizeof(int)*(MAXY-MINY+1) );
+
+ bax = new int [height]; // (MAXY-MINY+1));
+ bay = new int [height]; //malloc( sizeof(int)*(MAXY-MINY+1));
+ bbx = new int [height]; // malloc( sizeof(int)*(MAXY-MINY+1));
+ bby = new int [height]; // malloc( sizeof(int)*(MAXY-MINY+1));
+
+
+ orgpoints = new int [2*width+2];
+
+
+ /* H”he und Breite des Originals ermitteln */
+// width=((int *)data)[0];
+// hight=((int *)data)[1];
+
+
+
+
+
+int xbpoints[];
+int ybpoints[];
+int xapoints[];
+int yapoints[];
+
+xbpoints = new int[height];
+ybpoints = new int[height];
+xapoints = new int[height];
+yapoints = new int[height];
+
+ int mgw=mg.width-1;
+ int mgh=mg.height-1;
+
+ mgw=mgw*MYF;
+ mgh=mgh*MYF;
+
+
+ int y1,y2,x1,x2;
+
+ x1=pixlist[0];y1=pixlist[1];x2=pixlist[2];y2=pixlist[3];
+
+ ps.line(x1,y1,x2,y2);
+
+
+ if ( y1 < y2 ){
+ LinearInterpolation.l(xbpoints,y1,0,mgw,y2-y1);
+ LinearInterpolation.l(ybpoints,y1,0,0,y2-y1);
+ }
+ else {
+ LinearInterpolation.l(xapoints,y2,mgw,0,y1-y2);
+ LinearInterpolation.l(yapoints,y2,0,0,y1-y2);
+ }
+
+//---
+
+ x1=pixlist[2];y1=pixlist[3];x2=pixlist[4];y2=pixlist[5];
+ ps.line(x1,y1,x2,y2);
+
+
+ if ( y1 < y2 ){
+ LinearInterpolation.l(xbpoints,y1,mgw,mgw,y2-y1);
+ LinearInterpolation.l(ybpoints,y1,0,mgh,y2-y1);
+ }
+ else {
+ LinearInterpolation.l(xapoints,y2,mgw,mgw,y1-y2);
+ LinearInterpolation.l(yapoints,y2,mgh,0,y1-y2);
+ }
+
+//---
+
+ x1=pixlist[4];y1=pixlist[5];x2=pixlist[6];y2=pixlist[7];
+ ps.line(x1,y1,x2,y2);
+
+ if ( y1 < y2 ){
+ LinearInterpolation.l(xbpoints,y1,mgw,0,y2-y1);
+ LinearInterpolation.l(ybpoints,y1,mgh,mgh,y2-y1);
+ }
+ else {
+ LinearInterpolation.l(xapoints,y2,0,mgw,y1-y2);
+ LinearInterpolation.l(yapoints,y2,mgh,mgh,y1-y2);
+ }
+
+//---
+
+ x1=pixlist[6];y1=pixlist[7];x2=pixlist[0];y2=pixlist[1];
+ ps.line(x1,y1,x2,y2);
+
+ if ( y1 < y2 ){
+ LinearInterpolation.l(xbpoints,y1,0,0,y2-y1);
+ LinearInterpolation.l(ybpoints,y1,mgh,0,y2-y1);
+ }
+ else {
+ LinearInterpolation.l(xapoints,y2,0,0,y1-y2);
+ LinearInterpolation.l(yapoints,y2,0,mgh,y1-y2);
+ }
+
+
+
+ LinearInterpolation lp;
+ lp = new LinearInterpolation(0,mg.width-1,pixlist[3]-pixlist[1]);
+
+
+
+
+for( int z=0; z<lp.len; z++)
+{
+
+setColor( mg.buffer[ lp.data[z] ] );
+drawPixel(z,270);
+
+
+}
+
+/*
+int ii=0;
+for (int hh=ps.ystart; hh<ps.yend; hh++ )
+{
+int c=mg.buffer[xbpoints[hh]+ybpoints[hh]*mg.width];
+setColor(c);
+drawPixel(ii,280);
+
+c=mg.buffer[xapoints[hh]+yapoints[hh]*mg.width];
+setColor(c);
+drawPixel(ii,285);
+
+ii++;
+
+
+}
+*/
+
+
+ for(i=ps.ystart;i<=ps.yend;i++){
+ DrawImageLine(
+ xapoints[i],yapoints[i],
+ xbpoints[i],ybpoints[i],
+ ps.polbordera[i],i,ps.polborderb[i]-ps.polbordera[i]+1,mg);
+ }
+
+
+
+
+
+ }
+}
+
+
+
+
+class MGraphics extends MRawGraphics
+{
+ Image img;
+ public MemoryImageSource ms;
+
+ public Image getImage()
+ {
+ return img;
+ }
+
+ public void setSize( int w,int h)
+ {
+ super.setSize(w,h);
+ ms = new MemoryImageSource(width,height,buffer,0,width);
+ ms.setAnimated(true);
+ img = createImage ( ms );
+ }
+
+
+ public void LoadImage( String name, Applet a)
+ {
+ MediaTracker t = new MediaTracker(this);
+ Image im;
+ im = a.getImage(a.getCodeBase(),name);
+ t.addImage(im,0);
+ try
+ {
+ t.waitForID(0);
+ }
+ catch(InterruptedException e)
+ {
+ return;
+ }
+
+ setSize (im.getWidth(this),im.getHeight(this));
+ PixelGrabber pg = new PixelGrabber(im,0,0,width,height,buffer,0,width);
+ try
+ {
+ pg.grabPixels();
+ }
+ catch (InterruptedException e)
+ {
+ }
+
+
+ }
+
+ public void mgupdate()
+ {
+// ms.newPixels(0,0,width,height);
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+public class Hexenspiel extends Applet
+ implements Runnable
+// implements Runnable,MouseListener,MouseMotionListener
+
+{
+
+ //
+ // our own repaint method
+ // notifies the thread to repaint
+ //
+
+ public synchronized void irepaint()
+ {
+ notify();
+ }
+
+
+ Hexenspiel app=this;
+
+
+ Rectangle updateRgn = new Rectangle(0,0);
+ Rectangle dupdateRgn = new Rectangle(0,0);
+
+
+ private void setUpdateRgn(int x,int y, int w, int h)
+ {
+ if (updateRgn.height==0)
+ {
+ updateRgn.height=h;
+ updateRgn.width=w;
+ updateRgn.x=x;
+ updateRgn.y=y;
+ }
+ else
+ {
+ updateRgn.add(new Rectangle(x,y,w,h));
+ }
+
+ }
+
+
+ Karte klist [];
+
+
+
+private class Karte implements Runnable
+{
+int ddd=0;
+
+ Image im; // the image
+ public MGraphics mg;
+
+ int xpos=110,ypos=110; // the x and y position
+ int rot = 0; // current rotation
+ int w=-1,h=-1; // width and height
+ int maxwh=-1;
+ int drot = 0;
+
+
+ Karte ( int n)
+ {
+
+ String kl = "karte" + Integer.toString(n)+".gif";
+ mg = new MGraphics();
+ mg.LoadImage(kl,app);
+ im = mg.getImage();
+ }
+
+ public void paint ( Graphics g )
+ {
+
+
+ if ( im != null )
+ {
+
+
+ if ( maxwh == -1)
+ {
+ w = im.getWidth(app);
+ h = im.getHeight(app);
+ if ( w==-1 || h==-1)
+ {
+ return;
+ }
+ maxwh = (int)Math.sqrt(w*w+h*h);
+ }
+
+
+/* Graphics2D g2d = (Graphics2D)g;
+ AffineTransform at = new AffineTransform();
+ at.setToTranslation(xpos,ypos);
+ at.rotate(rot * Math.PI/180.0,w/2,h/2);
+ g2d.drawImage (im,at,this);
+ g2d.setTransform(at);
+ g2d.setColor(new Color(200,200,200));
+ g2d.drawRect(0,0,w,h);
+*/
+
+mg.setColor(0,0,0);
+mg.mgupdate();
+
+ g.drawImage(mg.getImage(),xpos,ypos,app);
+ g.drawRect(xpos,ypos,w,h);
+
+
+
+
+
+ }
+
+ }
+
+ private void clearBackGround()
+ {
+ int wwd = (maxwh-w)/2;
+ int hwd = (maxwh-h)/2;
+ setUpdateRgn(xpos-wwd,ypos-hwd,maxwh,maxwh);
+ }
+
+
+ public void Rot ( int angle)
+ {
+ if ( maxwh==-1 )
+ return;
+ clearBackGround();
+ rot = angle;
+ }
+
+ public void Move ( int x, int y)
+ {
+ if (maxwh ==-1)
+ return;
+ clearBackGround();
+ xpos=x;
+ ypos=y;
+ clearBackGround();
+
+ }
+
+ public synchronized void run()
+ {
+ int r=rot;
+
+ while(r<drot)
+ {
+ r+=10;
+ Rot(r);
+ irepaint();
+ mysleep(50);
+
+ }
+ Rot (drot);
+ irepaint();
+ }
+
+ public void start()
+ {
+ Thread t;
+ t= new Thread(this);
+ t.start();
+ }
+
+ public boolean underMouse(int x,int y)
+ {
+ if ( x>xpos && x<xpos+w && y>ypos && y<ypos+h)
+ return true;
+ return false;
+
+ }
+
+}
+
+
+String mpos = new String ("tube");
+MGraphics quad;
+
+ Image backBuffer;
+
+
+ MGraphics bpix;
+
+
+ public void init()
+ {
+
+
+
+ setBackground(new Color(0,0,0));
+ klist = new Karte[9];
+ for ( int i=0; i<9; i++)
+ {
+ klist[i]=new Karte(i+1);
+ }
+
+ updateRgn.x=0;
+ updateRgn.y=0;
+ updateRgn.width=getSize().width;
+ updateRgn.height=getSize().height;
+
+// addMouseListener(this);
+// addMouseMotionListener(this);
+
+ backBuffer = createImage( getSize().width, getSize().height);
+
+
+
+quad = new MGraphics();
+quad.LoadImage("quad1.gif",app);
+ bpix = new MGraphics();
+ bpix.setSize(800,800);
+
+
+
+ irepaint();
+ }
+
+
+//-----------------------------------------------------------------
+
+ public void paint(Graphics g)
+ {
+
+prepareImage(backBuffer,this);
+
+
+ Polygon xp = new Polygon();
+ xp.addPoint(0,0);
+ xp.addPoint(300,300);
+ xp.addPoint(0,300);
+
+
+int w = 100;
+int h = 100;
+int pix[] = new int[w * h];
+int index = 0;
+
+
+Image mimg;
+
+{
+
+/* for (int y = 0; y < h; y++) {
+ int red = (y * 255) / (h - 1);
+ for (int x = 0; x < w; x++) {
+ int blue = (x * 255) / (w - 1);
+ pix[index++] = (255 << 24) | (red << 16) | blue;
+ }
+ }
+ mimg = createImage(new MemoryImageSource(w, h, pix, 0, w));
+*/
+
+
+
+
+
+
+}
+
+
+
+ Graphics bbg = backBuffer.getGraphics();
+ bbg.clearRect(
+ dupdateRgn.x,
+ dupdateRgn.y,
+ dupdateRgn.width,
+ dupdateRgn.height
+ );
+ bbg.setClip(dupdateRgn);
+ for (int i=0; i<9; i++)
+ {
+ if ( klist[i]!=null)
+ {
+ klist[i].paint(backBuffer.getGraphics());
+ }
+ }
+//g.setClip(x);
+ g.drawImage(backBuffer,0,0,this);
+
+g.setClip(null);
+
+/*
+for(int i=0; i<180; i++)
+{
+ g.drawImage(klist[0].im,0,i,180,1,this);
+
+
+}
+*/
+
+
+index = 0;
+for (int y1 = 0; y1 < 50; y1++)
+{
+ for (int x1 = 0; x1 < 50; x1++) {
+ pix[index++] = (255 << 24) | 255<<16;
+ }
+}
+
+
+
+/* index=0;
+ for (int y = 0; y < h; y++) {
+ int red = (y * 0) / (h - 1);
+ for (int x = 0; x < w; x++) {
+ int blue = (x * 255) / (w - 1);
+ pix[index++] = (255 << 24) | (255 << 16) | blue;
+ }
+ }
+*/
+
+//g.drawImage(mimg,0,0,this);
+
+//g.drawPolygon(x);
+
+
+
+
+
+
+
+
+bpix.setColor(0,0,120);
+bpix.drawPixel(10,10);
+bpix.drawPixel(10,11);
+bpix.drawPixel(10,12);
+bpix.drawPixel(10,13);
+
+
+// int pli[] = {100,0,400,100,100,200,0,100};
+// int pli[] = {300,0,600,300,300,600,0,300};
+// int pli[] = {800,0,1600,800,800,1600,0,800};
+//int pli[] = {60,0,120,60,60,120,0,60};
+
+int pli[] = {250 + 0,0,
+ 250 + 106, 106,
+ 250 + 0, 106*2,
+ 250 -106,106};
+
+
+
+bpix.drawImageShaped (pli,quad);
+// bpix.drawEllipse(150,150,100,110);
+
+
+g.drawImage(bpix.getImage(),0,0,this );
+
+
+
+
+
+
+
+ }
+
+//----------------------------------------------------------------------
+ void mysleep(int t)
+ {
+ try
+ {
+ Thread.sleep(t);
+ }
+ catch(InterruptedException e)
+ {
+ }
+ }
+
+ public synchronized void run()
+ {
+
+
+ int r=0;
+ while (true)
+ {
+ Thread.yield();
+ try {wait(); }catch(InterruptedException e){}
+ repaint();
+ }
+ }
+
+ public void start()
+ {
+ Thread t;
+ t= new Thread(this);
+ t.start();
+ }
+
+
+ boolean bringmousecardtoptop(int x,int y)
+ {
+ int k = -1;
+ for ( int i=0; i<9; i++)
+ {
+ if ( klist[i]!=null)
+ {
+ if (klist[i].underMouse(x,y) )
+ {
+ k=i;
+ }
+ }
+ }
+
+
+ if ( k!=-1 )
+ {
+ Karte tkarte = klist[k];
+ for (int i=k; i<8; i++)
+ {
+ klist[i]=klist[i+1];
+ klist[i].clearBackGround();
+ }
+ klist[8]=tkarte;
+ klist[8].clearBackGround();
+ return true;
+
+ }
+ return false;
+ }
+
+
+ int xoff,yoff;
+ boolean pressed = false;
+
+ public boolean mouseDrag(Event e, int x, int y)
+ {
+ mpos = new String ("tabbie");
+ if ( pressed )
+ {
+ klist[8].Move(x+xoff,y+yoff);
+ irepaint();
+ }
+
+
+
+ return super.mouseDrag(e,x,y);
+ }
+
+ public boolean mouseDown(Event e,int x, int y)
+ {
+ pressed = bringmousecardtoptop(x,y);
+ xoff = klist[8].xpos-x;
+ yoff = klist[8].ypos-y;
+ irepaint();
+ return true;
+ }
+
+
+ public synchronized void mouseDragged( MouseEvent e)
+ {
+/*setBackground( new Color(255,0,0));
+Graphics g = null;
+g.drawRect(0,0,100,100);
+*/
+
+ if ( pressed )
+ {
+ klist[8].Move(e.getX()+xoff,e.getY()+yoff);
+ irepaint();
+ }
+ }
+
+
+ public void mousePressed( MouseEvent e)
+ {
+ pressed = bringmousecardtoptop(e.getX(),e.getY());
+ xoff = klist[8].xpos-e.getX();
+ yoff = klist[8].ypos-e.getY();
+ irepaint();
+ }
+
+ public void mouseClicked ( MouseEvent e)
+ {
+ int c = e.getClickCount();
+
+ if ( c==1 )
+ {
+ bringmousecardtoptop(e.getX(),e.getY());
+ irepaint();
+
+ }
+
+ if ( c == 2)
+ {
+ klist[8].drot+=90;
+ klist[8].start();
+ }
+// if ( c == 3)
+// klist[6].start();
+
+ }
+
+ public void mouseReleased ( MouseEvent e)
+ {
+// pressed = false;
+
+ }
+
+ public void mouseEntered ( MouseEvent e)
+ {
+
+ }
+
+ public void mouseExited ( MouseEvent e)
+ {
+
+ }
+
+ public void mouseMoved( MouseEvent e)
+ {
+/* if (pressed)
+ {
+ klist[8].Move(e.getX(),e.getY());
+ irepaint();
+ }
+*/
+mpos = new String ("tabbe");
+irepaint();
+ }
+
+
+ public void update( Graphics g)
+ {
+ if ( updateRgn.height==0)
+ return;
+ dupdateRgn.x = updateRgn.x;
+ dupdateRgn.y = updateRgn.y;
+ dupdateRgn.width = updateRgn.width;
+ dupdateRgn.height = updateRgn.height;
+ updateRgn.height=0;
+ g.setClip(dupdateRgn);
+ paint(g);
+
+ }
+
+ public boolean isDoubleBuffered()
+ {
+ return true;
+ }
+
+
+}
+
+
/hist-1992-2002/hexenspiel/hexenbackup.java
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/intqs.c
===================================================================
--- hist-1992-2002/hexenspiel/intqs.c (nonexistent)
+++ hist-1992-2002/hexenspiel/intqs.c (revision 106)
@@ -0,0 +1,39 @@
+/* ---------------------------------------------------------------
+INTQS.C
+(c) 1992 by Tobias Herre
+Bestandteil von DISPLAY.LIB Version 1.0
+----------------------------------------------------------------*/
+
+#include "display.h"
+
+/* ---------------------------------------------------------------
+ Sortieren eines mit Integerzahlen besetzten Feldes
+*/
+void _IntQuickSort (int *f,int l,int r)
+{
+ int i,j,help;
+ while (r > l) {
+ i=l+1;j=r;
+ while (i<=j){
+ while (i<=j && (f[l]>f[i])) i++;
+ while (i<=j && (f[l]<=f[j])) j--;
+ if (i<=j) {
+ help = f[i];
+ f[i]=f[j];
+ f[j]=help;
+ i++; j--;
+ }
+ }
+ if (j != l) {
+ help = f[j];
+ f[j]=f[l];
+ f[l]=help;
+ }
+ if (j+j > r+l){
+ _IntQuickSort(f,j+1,r);r = j-1;
+ }
+ else{
+ _IntQuickSort(f,l,j-1);l = j+1;
+ }
+ }
+}
/hist-1992-2002/hexenspiel/intqs.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/karte3.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/hist-1992-2002/hexenspiel/karte3.gif
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/karte7.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/hist-1992-2002/hexenspiel/karte7.gif
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/line.c
===================================================================
--- hist-1992-2002/hexenspiel/line.c (nonexistent)
+++ hist-1992-2002/hexenspiel/line.c (revision 106)
@@ -0,0 +1,72 @@
+/*----------------------------------------------------------------------
+line.c
+Copyright (c) 1993 by Tobias Herre
+----------------------------------------------------------------------*/
+
+#include "display.h"
+
+/*----------------------------------------------------------------------
+Line
+ Zeichnet eine Linie mit Breasenhams Algorithmus
+Eingabe:
+ (x1,y1): Startpunkt
+ (x2,y2): Endpunkt
+----------------------------------------------------------------------*/
+void Line(int x1,int y1,int x2,int y2)
+{
+ int dx,dy,xdir,ydir,sum;
+
+ if( _GetClippedLine(&x1,&y1,&x2,&y2) == 0 ) return;
+
+ dx=x2-x1;dy=y2-y1;
+
+ /* Schrittrichtungen fuer x und y ermitteln */
+
+ if (dx<0)
+ {
+ xdir=-1; dx=-dx;
+ }
+ else
+ xdir=1;
+
+ if (dy<0)
+ {
+ ydir=-1; dy=-dy;
+ }
+ else
+ ydir=1;
+
+
+ /* Linie Zeichnen */
+
+ PutPixel(x1,y1); /* Erster Punkt ist immer klar */
+
+ if(dx>=dy) /* Linie mit Anstieg kleiner als 1 */
+ {
+ sum=dx>>1;
+ while(x1!=x2)
+ {
+ sum-=dy;x1+=xdir;
+ if (sum<0)
+ {
+ y1+=ydir; sum+=dx;
+ }
+ PutPixel(x1,y1);
+ }
+ }
+ else
+ { /* Linie mit Anstieg groesser als 1 */
+ sum=dy>>1;
+ while( y1!=y2 )
+ {
+ sum-=dx;y1+=ydir;
+ if (sum<0)
+ {
+ x1+=xdir; sum+=dy;
+ }
+ PutPixel(x1,y1);
+ }
+ }
+ /* Linie zeichnen beendet */
+}
+
\ No newline at end of file
/hist-1992-2002/hexenspiel/line.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/ptline.c
===================================================================
--- hist-1992-2002/hexenspiel/ptline.c (nonexistent)
+++ hist-1992-2002/hexenspiel/ptline.c (revision 106)
@@ -0,0 +1,47 @@
+/* ---------------------------------------------------------------
+PLINE.C
+(c) 1992 by Tobias Herre
+Bestandteil von DISPLAY.LIB Version 1.0
+----------------------------------------------------------------*/
+
+
+#include "display.h"
+
+/*--------------------------------------------------------------
+ Linie zeichnen (von x1,x2 nach y1,y2 mit der Farbe col)
+*/
+void PatternLine(int x1,int y1,int x2,int y2,void *data)
+{
+ int dx,dy,xdir,ydir,sum;
+ int width,hight;
+
+ if( _GetClippedLine(&x1,&y1,&x2,&y2) == 0 ) return;
+
+ /* Differenz fr x und y berechnen */
+ dx=x2-x1;dy=y2-y1;
+
+ /* Schrittrichtung fr x und y und den Betrag von dx und dy bilden */
+ if (dx<0) {xdir=-1;dx=-dx;} else xdir=1;
+ if (dy<0) {ydir=-1;dy=-dy;} else ydir=1;
+
+ width=*((int *)data); data=(int *)data+1;
+ hight=*((int *)data); data=(int *)data+1;
+
+ PutPixel(x1,y1,((colortype *)data)[(y1%hight)*width+x1%width]); /* ersten Punkt setzen */
+
+ if(dx>=dy){
+ sum=dx>>1;
+ while(x1!=x2){
+ sum-=dy;x1+=xdir; if (sum<0) {y1+=ydir; sum+=dx;}
+ PutPixel(x1,y1,((colortype *)data)[(y1%hight)*width+x1%width]);
+ }
+ }
+ else {
+ sum=dy>>1;
+ while( y1!=y2 ){
+ sum-=dx;y1+=ydir; if (sum<0) {x1+=xdir; sum+=dy;}
+ PutPixel(x1,y1,((colortype *)data)[(y1%hight)*width+x1%width]);
+ }
+ }
+}
+
/hist-1992-2002/hexenspiel/ptline.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/putpixel.c
===================================================================
--- hist-1992-2002/hexenspiel/putpixel.c (nonexistent)
+++ hist-1992-2002/hexenspiel/putpixel.c (revision 106)
@@ -0,0 +1,22 @@
+/* ---------------------------------------------------------------
+PUTPIXEL.C
+(c) 1992 by Tobias Herre
+part of DISPLAY.LIB version 1.0
+----------------------------------------------------------------*/
+
+#include "display.h"
+
+void PatternPutPixel(int x,int y)
+{
+ colortype col;
+/* _GetClippedPixel(&x,&y); */
+ col=((colortype *)pattern)[(y%pthight)*ptwidth+x%ptwidth];
+ if(col!=transpcolor) _SYSPutPixel(x,y,col);
+}
+
+void ColorPutPixel(int x,int y)
+{
+ _SYSPutPixel(x,y,color);
+}
+
+
/hist-1992-2002/hexenspiel/putpixel.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/setpatt.c
===================================================================
--- hist-1992-2002/hexenspiel/setpatt.c (nonexistent)
+++ hist-1992-2002/hexenspiel/setpatt.c (revision 106)
@@ -0,0 +1,23 @@
+/* ---------------------------------------------------------------
+SETPATT.C
+(c) 1992 by Tobias Herre
+part of DISPLAY.LIB version 1.0
+----------------------------------------------------------------*/
+
+#include <stdio.h>
+#include "display.h"
+
+void SetPattern (void *setpattern)
+{
+ PutPixel=PatternPutPixel;
+ ptwidth=*(int *)setpattern; setpattern=(int *)setpattern+1;
+ pthight=*(int *)setpattern; setpattern=(int *)setpattern+1;
+ pattern=setpattern;
+}
+
+
+void SetColor(colortype col)
+{
+ color=col;
+ PutPixel=ColorPutPixel;
+}
/hist-1992-2002/hexenspiel/setpatt.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/vline.c
===================================================================
--- hist-1992-2002/hexenspiel/vline.c (nonexistent)
+++ hist-1992-2002/hexenspiel/vline.c (revision 106)
@@ -0,0 +1,23 @@
+/* ---------------------------------------------------------------
+VLINE.C
+(c) 1992 by Tobias Herre
+Bestandteil von DISPLAY.LIB Version 1.0
+----------------------------------------------------------------*/
+
+#include "display.h"
+
+/*----------------------------------------------------------------
+ vertikale Linie zeichnen (von y1,y2 in x mit der Farbe col)
+*/
+void VLine (int y1,int y2,int x)
+{
+ int dy,ydir;
+
+ if(_GetClippedLine(&x,&y1,&x,&y2) == 0 ) return;
+
+ dy=y2-y1;if(dy<0) {dy=-dy;ydir=-1;} else ydir=1;
+ dy++;
+ while (dy){
+ PutPixel(x,y1); y1+=ydir; dy--;
+ }
+}
/hist-1992-2002/hexenspiel/vline.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/head.c
===================================================================
--- hist-1992-2002/hexenspiel/head.c (nonexistent)
+++ hist-1992-2002/hexenspiel/head.c (revision 106)
@@ -0,0 +1,5 @@
+/* ---------------------------------------------------------------
+SETPATT.C
+(c) 1992 by Tobias Herre
+part of DISPLAY.LIB version 1.0
+----------------------------------------------------------------*/
/hist-1992-2002/hexenspiel/head.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/hexenspiel.java2
===================================================================
--- hist-1992-2002/hexenspiel/hexenspiel.java2 (nonexistent)
+++ hist-1992-2002/hexenspiel/hexenspiel.java2 (revision 106)
@@ -0,0 +1,397 @@
+///
+// hexenspiel.java
+// (c) 2002 Tube
+//
+
+
+import java.applet.Applet;
+import java.awt.geom.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.net.*;
+
+
+public class Hexenspiel extends Applet
+ implements Runnable,MouseMotionListener,MouseListener
+
+{
+
+ //
+ // our own repaint method
+ // notifies the thread to repaint
+ //
+
+ public synchronized void irepaint()
+ {
+ notify();
+ }
+
+
+
+ Hexenspiel app=this;
+
+
+ Rectangle updateRgn = new Rectangle(0,0);
+ Rectangle dupdateRgn = new Rectangle(0,0);
+
+
+ private void setUpdateRgn(int x,int y, int w, int h)
+ {
+ if (updateRgn.height==0)
+ {
+ updateRgn.height=h;
+ updateRgn.width=w;
+ updateRgn.x=x;
+ updateRgn.y=y;
+ }
+ else
+ {
+ updateRgn.add(new Rectangle(x,y,w,h));
+ }
+
+ }
+
+
+ Karte klist [];
+
+
+
+private class Karte extends Component implements Runnable
+{
+ Image im; // the image
+
+ int xpos=110,ypos=110; // the x and y position
+ int rot = 0; // current rotation
+ int w=-1,h=-1; // width and height
+ int maxwh=-1;
+ int drot = 0;
+
+
+ Karte ( int n)
+ {
+
+
+
+ String kl;
+ kl = "karte" + Integer.toString(n)+".gif";
+ im = getImage(getCodeBase(),kl);
+
+ }
+
+ public void paint ( Graphics g )
+ {
+
+
+ if ( im != null )
+ {
+
+
+ if ( maxwh == -1)
+ {
+ w = im.getWidth(app);
+ h = im.getHeight(app);
+ if ( w==-1 || h==-1)
+ {
+ return;
+ }
+ maxwh = (int)Math.sqrt(w*w+h*h);
+ }
+
+
+/* Graphics2D g2d = (Graphics2D)g;
+ AffineTransform at = new AffineTransform();
+ at.setToTranslation(xpos,ypos);
+ at.rotate(rot * Math.PI/180.0,w/2,h/2);
+ g2d.drawImage (im,at,this);
+ g2d.setTransform(at);
+ g2d.setColor(new Color(200,200,200));
+ g2d.drawRect(0,0,w,h);
+*/
+
+ g.drawImage(im,xpos,ypos,app);
+
+
+
+
+
+ }
+
+ }
+
+ private void clearBackGround()
+ {
+ int wwd = (maxwh-w)/2;
+ int hwd = (maxwh-h)/2;
+ setUpdateRgn(xpos-wwd,ypos-hwd,maxwh,maxwh);
+ }
+
+
+ public void Rot ( int angle)
+ {
+ if ( maxwh==-1 )
+ return;
+ clearBackGround();
+ rot = angle;
+ }
+
+ public void Move ( int x, int y)
+ {
+ if (maxwh ==-1)
+ return;
+ clearBackGround();
+ xpos=x;
+ ypos=y;
+ clearBackGround();
+
+ }
+
+ public synchronized void run()
+ {
+ int r=rot;
+
+ while(r<drot)
+ {
+ r+=10;
+ Rot(r);
+ irepaint();
+ mysleep(50);
+
+ }
+ Rot (drot);
+ irepaint();
+ }
+
+ public void start()
+ {
+ Thread t;
+ t= new Thread(this);
+ t.start();
+ }
+
+ public boolean underMouse(int x,int y)
+ {
+ if ( x>xpos && x<xpos+w && y>ypos && y<ypos+h)
+ return true;
+ return false;
+
+ }
+
+}
+
+ Image backBuffer;
+
+
+ public void init()
+ {
+ setBackground(new Color(200,255,200));
+ klist = new Karte[9];
+ for ( int i=0; i<9; i++)
+ {
+ klist[i]=new Karte(i+1);
+ }
+
+ updateRgn.x=0;
+ updateRgn.y=0;
+ updateRgn.width=getSize().width;
+ updateRgn.height=getSize().height;
+
+ addMouseListener(this);
+ addMouseMotionListener(this);
+ backBuffer = createImage( getSize().width, getSize().height);
+
+ irepaint();
+ }
+
+ public void paint(Graphics g)
+ {
+
+
+ Graphics bbg = backBuffer.getGraphics();
+
+ bbg.clearRect(
+ dupdateRgn.x,
+ dupdateRgn.y,
+ dupdateRgn.width,
+ dupdateRgn.height
+ );
+ bbg.setClip(dupdateRgn);
+
+
+ for (int i=0; i<9; i++)
+ {
+ if ( klist[i]!=null)
+ {
+ klist[i].paint(backBuffer.getGraphics());
+
+
+
+ }
+
+
+
+ }
+ g.drawImage(backBuffer,0,0,this);
+
+
+ }
+
+
+ void mysleep(int t)
+ {
+ try
+ {
+ Thread.sleep(t);
+ }
+ catch(InterruptedException e)
+ {
+ }
+ }
+
+ public synchronized void run()
+ {
+
+
+ int r=0;
+ while (true)
+ {
+ Thread.yield();
+
+ try {wait(); }catch(InterruptedException e){}
+ repaint();
+ }
+ }
+
+ public void start()
+ {
+ Thread t;
+ t= new Thread(this);
+ t.start();
+ }
+
+
+ boolean bringmousecardtoptop(MouseEvent e)
+ {
+ int x = e.getX();
+ int y = e.getY();
+
+ int k = -1;
+ for ( int i=0; i<9; i++)
+ {
+ if ( klist[i]!=null)
+ {
+ if (klist[i].underMouse(x,y) )
+ {
+ k=i;
+ }
+ }
+ }
+
+
+ if ( k!=-1 )
+ {
+ Karte tkarte = klist[k];
+ for (int i=k; i<8; i++)
+ {
+ klist[i]=klist[i+1];
+ klist[i].clearBackGround();
+ }
+ klist[8]=tkarte;
+ klist[8].clearBackGround();
+ return true;
+
+ }
+ return false;
+ }
+
+
+ int xoff,yoff;
+ boolean pressed = false;
+
+ public synchronized void mouseDragged( MouseEvent e)
+ {
+ if ( pressed )
+ {
+ klist[8].Move(e.getX()+xoff,e.getY()+yoff);
+ irepaint();
+ }
+ }
+
+
+ public void mousePressed( MouseEvent e)
+ {
+ pressed = bringmousecardtoptop(e);
+ xoff = klist[8].xpos-e.getX();
+ yoff = klist[8].ypos-e.getY();
+ irepaint();
+ }
+
+ public void mouseClicked ( MouseEvent e)
+ {
+ int c = e.getClickCount();
+
+ if ( c==1 )
+ {
+ bringmousecardtoptop(e);
+ irepaint();
+
+ }
+
+ if ( c == 2)
+ {
+ klist[8].drot+=90;
+ klist[8].start();
+ }
+// if ( c == 3)
+// klist[6].start();
+
+ }
+
+ public void mouseReleased ( MouseEvent e)
+ {
+// pressed = false;
+
+ }
+
+ public void mouseEntered ( MouseEvent e)
+ {
+
+ }
+
+ public void mouseExited ( MouseEvent e)
+ {
+
+ }
+
+ public void mouseMoved( MouseEvent e)
+ {
+/* if (pressed)
+ {
+ klist[8].Move(e.getX(),e.getY());
+ irepaint();
+ }
+*/
+ }
+
+
+ public void update( Graphics g)
+ {
+
+
+ if ( updateRgn.height==0)
+ return;
+ dupdateRgn = (Rectangle)updateRgn.clone();
+ updateRgn.height=0;
+ g.setClip(dupdateRgn);
+ paint(g);
+
+ }
+
+ public boolean isDoubleBuffered()
+ {
+ return true;
+ }
+
+
+}
+
+
/hist-1992-2002/hexenspiel/hexenspiel.java2
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/karte1.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/hist-1992-2002/hexenspiel/karte1.gif
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/karte5.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/hist-1992-2002/hexenspiel/karte5.gif
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/karte9.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/hist-1992-2002/hexenspiel/karte9.gif
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/polygon.c
===================================================================
--- hist-1992-2002/hexenspiel/polygon.c (nonexistent)
+++ hist-1992-2002/hexenspiel/polygon.c (revision 106)
@@ -0,0 +1,22 @@
+/* ---------------------------------------------------------------
+POLYGON.C
+(c) 1992 by Tobias Herre
+Bestandteil von DISPLAY.LIB Version 1.0
+----------------------------------------------------------------*/
+
+#include "display.h"
+
+/*---------------------------------------------------------------
+ Zeichnen eines Polygons
+*/
+void Polygon(int points,int *plist)
+{
+ int i;
+ if(points<1) return;
+ if(points==1) PutPixel(plist[0],plist[1]);
+
+ for(i=0;i<(points*2)-2;i+=2){
+ Line(plist[i],plist[i+1],plist[i+2],plist[i+3]);
+ }
+ Line(plist[0],plist[1],plist[points*2-2],plist[points*2-1]);
+}
/hist-1992-2002/hexenspiel/polygon.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/putimgs.c
===================================================================
--- hist-1992-2002/hexenspiel/putimgs.c (nonexistent)
+++ hist-1992-2002/hexenspiel/putimgs.c (revision 106)
@@ -0,0 +1,167 @@
+/* ---------------------------------------------------------------
+PUTIMGSH.C
+(c) 1992 by Tobias Herre
+Bestandteil von GRAPHS.LIB Version 1.0
+----------------------------------------------------------------*/
+
+#include <malloc.h>
+
+#include "display.h"
+#include "sysscr.h"
+
+static void DrawImageLine(int x1,int y1,int x2,int y2,int s_x,int s_y,int s_w,void *data)
+{
+ int deltax,deltay;
+ long sumx,sumy,xadd,yadd;
+ int xdir,ydir,i;
+ int width;
+ int color;
+
+ if (s_w<=0) return;
+
+ deltax=x2-x1; deltay=y2-y1;
+
+ width=*((int *)data)++;
+ ((int *)data)++;
+
+ if ( deltax<0 ) { deltax=-deltax; xdir=-1; } else xdir=1;
+ if ( deltay<0 ) { deltay=-deltay; ydir=-1; } else ydir=1;
+
+
+ xadd=((long)(deltax)<<16)/s_w;xadd*=xdir;
+ yadd=((long)(deltay)<<16)/s_w;yadd*=ydir;
+
+ sumx=((long)x1<<16)+(xadd)/2;
+ sumy=((long)y1<<16)+(yadd)/2;
+
+ for(i=0;i<s_w;i++){
+ color=((char *)data)[width*(int)(sumy>>16)+(int)(sumx>>16)];
+ SetColor(color); PutPixel(s_x+i,s_y);
+/* PutPixel((int)(sumx>>16),(int)(sumy>>16),9); */
+ sumx+=xadd; sumy+=yadd;
+ }
+}
+
+static int *bax,*bay,*bbx,*bby;
+
+static void CalcOrgPoints(int y1,int y2,int len,int *orgpoints,int lastcode)
+{
+ int deltay,ydir;
+ long yadd,sumy;
+ int i;
+ int *bx,*by;
+ switch(lastcode){
+ case 0:
+ bx=bbx;by=bby;break;
+ case 1:
+ bx=bbx;by=bby;break;
+ case 2:
+ bx=bax;by=bay;break;
+ case 3:
+ bx=bax;by=bay;break;
+ };
+
+ deltay=y2-y1;
+
+ if ( deltay==0)return;
+ if ( deltay<0 ) {
+ deltay=-deltay; ydir=-1;
+ }
+ else
+ ydir=1;
+ yadd=((long)len<<16)/(long)deltay;
+ sumy=(yadd)/2;
+
+
+ for(i=y1; i!=y2; i+=ydir){
+ bx[i]=orgpoints[(int)(sumy>>16)*2];
+ by[i]=orgpoints[(int)(sumy>>16)*2+1];
+ sumy+=yadd;
+ }
+ sumy=((long)len)<<16;
+ sumy=sumy-1-yadd;
+ bx[i]=orgpoints[(int)(sumy>>16)*2];
+ by[i]=orgpoints[(int)(sumy>>16)*2+1];
+ sumy+=yadd;
+}
+
+
+
+void PutImageShaped(int pixlist[8], void *data)
+{
+ type_polborder b;
+ int width,hight;
+ int *orgpoints;
+ int i;
+/*
+Line (0,0,0,157,7);
+DrawImageLine(0,0,0,157,0,200,19,data);
+getch();
+exit(0);
+*/
+ b.polbordera=malloc( sizeof(int)*(MAXY-MINY+1) );
+ b.polborderb=malloc( sizeof(int)*(MAXY-MINY+1) );
+ bax = malloc( sizeof(int)*(MAXY-MINY+1));
+ bay = malloc( sizeof(int)*(MAXY-MINY+1));
+ bbx = malloc( sizeof(int)*(MAXY-MINY+1));
+ bby = malloc( sizeof(int)*(MAXY-MINY+1));
+ orgpoints = malloc( 2*sizeof(int)*(MAXX-MINX+2));
+ if( b.polbordera==NULL) goto end;
+ if( b.polborderb==NULL) goto end;
+ if(bax==NULL || bay==NULL || bbx==NULL || bby==NULL) goto end;
+ if(orgpoints==NULL) goto end;
+
+ /* H”he und Breite des Originals ermitteln */
+ width=((int *)data)[0];
+ hight=((int *)data)[1];
+
+ b.lastcode=5;
+ b.ystart=9999; b.yend=-9999;
+
+
+ __CalcPolygonLine(pixlist[0],pixlist[1],pixlist[2],pixlist[3],&b);
+ for(i=0;i<width;i++){
+ orgpoints[i<<1]=i;
+ orgpoints[(i<<1)+1]=0;
+ }
+ CalcOrgPoints(pixlist[1],pixlist[3],width,orgpoints,b.lastcode);
+
+ __CalcPolygonLine(pixlist[2],pixlist[3],pixlist[4],pixlist[5],&b);
+ for(i=0;i<hight;i++){
+ orgpoints[i<<1]=width-1;
+ orgpoints[(i<<1)+1]=i;
+ }
+ CalcOrgPoints(pixlist[3],pixlist[5],hight,orgpoints,b.lastcode);
+
+ __CalcPolygonLine(pixlist[4],pixlist[5],pixlist[6],pixlist[7],&b);
+ for(i=0;i<width;i++){
+ orgpoints[i<<1]=width-1-i;
+ orgpoints[(i<<1)+1]=hight-1;
+ }
+ CalcOrgPoints(pixlist[5],pixlist[7],width,orgpoints,b.lastcode);
+
+ __CalcPolygonLine(pixlist[6],pixlist[7],pixlist[0],pixlist[1],&b);
+ for(i=0;i<hight;i++){
+ orgpoints[i<<1]=0;
+ orgpoints[(i<<1)+1]=hight-1-i;
+ }
+ CalcOrgPoints(pixlist[7],pixlist[1],hight,orgpoints,b.lastcode);
+
+
+ for(i=b.ystart;i<=b.yend;i++){
+ DrawImageLine(bax[i],bay[i],bbx[i],bby[i],b.polbordera[i],i,b.polborderb[i]-b.polbordera[i]+1,data);
+ }
+
+ end:
+ if(b.polbordera!=NULL) free(b.polbordera);
+ if(b.polborderb!=NULL) free(b.polborderb);
+ if(bax!=NULL) free(bax);
+ if(bay!=NULL) free(bay);
+ if(bbx!=NULL) free(bbx);
+ if(bby!=NULL) free(bby);
+}
+
+
+
+
+
/hist-1992-2002/hexenspiel/putimgs.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/quad.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/hist-1992-2002/hexenspiel/quad.gif
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/sysscr.h
===================================================================
--- hist-1992-2002/hexenspiel/sysscr.h (nonexistent)
+++ hist-1992-2002/hexenspiel/sysscr.h (revision 106)
@@ -0,0 +1,10 @@
+typedef struct{
+ int *polbordera;
+ int *polborderb;
+ int ystart;
+ int yend;
+ int lastcode;
+} type_polborder;
+
+extern void __CalcPolygonLine(int x1,int y1, int x2,int y2,type_polborder *b);
+extern void __CalcPolygonLines(int len,int *pixlist,type_polborder *b);
/hist-1992-2002/hexenspiel/sysscr.h
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/hex.java
===================================================================
--- hist-1992-2002/hexenspiel/hex.java (nonexistent)
+++ hist-1992-2002/hexenspiel/hex.java (revision 106)
@@ -0,0 +1,429 @@
+///
+// hexenspiel.java
+// (c) 2002 Tube
+//
+
+
+import java.applet.Applet;
+import java.awt.geom.*;
+import java.awt.event.*;
+import java.awt.*;
+import java.net.*;
+
+
+public class Hexenspiel extends Applet
+ implements Runnable,MouseMotionListener,MouseListener
+
+{
+
+ //
+ // our own repaint method
+ // notifies the thread to repaint
+ //
+
+ public synchronized void irepaint()
+ {
+ notify();
+ }
+
+
+
+ Hexenspiel app=this;
+
+
+ Rectangle updateRgn = new Rectangle(0,0);
+ Rectangle dupdateRgn = new Rectangle(0,0);
+
+
+ private void setUpdateRgn(int x,int y, int w, int h)
+ {
+ if (updateRgn.height==0)
+ {
+ updateRgn.height=h;
+ updateRgn.width=w;
+ updateRgn.x=x;
+ updateRgn.y=y;
+ }
+ else
+ {
+ updateRgn.add(new Rectangle(x,y,w,h));
+ }
+
+ }
+
+
+ Karte klist [];
+
+
+
+private class Karte extends Component implements Runnable
+{
+ Image im; // the image
+
+ int xpos=110,ypos=110; // the x and y position
+ int rot = 0; // current rotation
+ int w=-1,h=-1; // width and height
+ int maxwh=-1;
+ int drot = 0;
+
+public String kl;
+
+ Karte ( int n)
+ {
+
+
+
+// String kl;
+ kl = getCodeBase().toString() + "/karte" + Integer.toString(n)+".gif";
+
+
+ im = getImage(getCodeBase(),"karte1.gif");
+
+ }
+
+ public void paint ( Graphics g )
+ {
+
+
+ if ( im != null )
+ {
+
+
+ if ( maxwh == -1)
+ {
+ w = im.getWidth(app);
+ h = im.getHeight(app);
+ if ( w==-1 || h==-1)
+ {
+ return;
+ }
+ maxwh = (int)Math.sqrt(w*w+h*h);
+ }
+
+
+/* g.drawImage(im,0,0,this);
+
+ Graphics2D g2d = (Graphics2D)g;
+
+ g.drawImage(im,210,210,this);
+*/
+// AffineTransform at = new AffineTransform();
+// at.setToTranslation(xpos,ypos);
+// at.rotate(rot * Math.PI/180.0,w/2,h/2);
+// g2d.drawImage (im,at,this);
+// g2d.setTransform(at);
+// g2d.setColor(new Color(200,200,200));
+// g2d.drawRect(0,0,w,h);
+
+
+
+ }
+
+ }
+
+ private void clearBackGround()
+ {
+ int wwd = (maxwh-w)/2;
+ int hwd = (maxwh-h)/2;
+ setUpdateRgn(xpos-wwd,ypos-hwd,maxwh,maxwh);
+ }
+
+
+ public void Rot ( int angle)
+ {
+ if ( maxwh==-1 )
+ return;
+ clearBackGround();
+ rot = angle;
+ }
+
+ public void Move ( int x, int y)
+ {
+ if (maxwh ==-1)
+ return;
+ clearBackGround();
+ xpos=x;
+ ypos=y;
+ clearBackGround();
+
+ }
+
+ public synchronized void run()
+ {
+ int r=rot;
+
+ while(r<drot)
+ {
+ r+=10;
+ Rot(r);
+ irepaint();
+ mysleep(50);
+
+ }
+ Rot (drot);
+ irepaint();
+ }
+
+ public void start()
+ {
+ Thread t;
+ t= new Thread(this);
+ t.start();
+ }
+
+ public boolean underMouse(int x,int y)
+ {
+ if ( x>xpos && x<xpos+w && y>ypos && y<ypos+h)
+ return true;
+ return false;
+
+ }
+
+}
+
+
+
+// Image im = null;
+
+
+
+
+ public void init()
+ {
+ setBackground(new Color(200,255,200));
+
+Image imi = getImage(getCodeBase(),"karte1.gif");
+
+
+/* klist = new Karte[9];
+ for ( int i=0; i<9; i++)
+ {
+ klist[i]=new Karte(i+1);
+ }
+
+ updateRgn.x=0;
+ updateRgn.y=0;
+ updateRgn.width=getSize().width;
+ updateRgn.height=getSize().height;
+
+ addMouseListener(this);
+ addMouseMotionListener(this);
+ irepaint();
+
+*/
+
+
+ }
+
+ public void paint(Graphics g)
+ {
+
+// Graphics2D g2d = (Graphics2D)g;
+// g.drawImage(klist[0].im,0,0,this);
+
+
+//Graphics g = app.getGraphics();
+g.drawString(new String("HEllo"),0,50);
+//g.drawString(klist[0].kl,0,100);
+
+
+/*
+
+ Image backBuffer;
+ backBuffer = createImage( getSize().width, getSize().height);
+
+ Graphics bbg = backBuffer.getGraphics();
+
+ bbg.clearRect(
+ dupdateRgn.x,
+ dupdateRgn.y,
+ dupdateRgn.width,
+ dupdateRgn.height
+ );
+ bbg.setClip(dupdateRgn);
+
+
+ for (int i=0; i<9; i++)
+ {
+ if ( klist[i]!=null)
+ {
+ // klist[i].paint(g) backBuffer.getGraphics());
+
+
+
+ g.drawImage(klist[i].im,0,0,this);
+
+
+ g.drawImage(klist[i].im,210,210,this);
+ }
+
+
+
+ }
+// g.drawImage(backBuffer,0,0,this);
+*/
+
+ }
+
+
+ void mysleep(int t)
+ {
+ try
+ {
+ Thread.sleep(t);
+ }
+ catch(InterruptedException e)
+ {
+ }
+ }
+
+ public synchronized void run()
+ {
+
+
+ int r=0;
+ while (true)
+ {
+ Thread.yield();
+
+ try {wait(); }catch(InterruptedException e){}
+ repaint();
+ }
+ }
+
+ public void start()
+ {
+// Thread t;
+// t= new Thread(this);
+// t.start();
+ }
+
+
+ boolean bringmousecardtoptop(MouseEvent e)
+ {
+ int x = e.getX();
+ int y = e.getY();
+
+ int k = -1;
+ for ( int i=0; i<9; i++)
+ {
+ if ( klist[i]!=null)
+ {
+ if (klist[i].underMouse(x,y) )
+ {
+ k=i;
+ }
+ }
+ }
+
+
+ if ( k!=-1 )
+ {
+ Karte tkarte = klist[k];
+ for (int i=k; i<8; i++)
+ {
+ klist[i]=klist[i+1];
+ klist[i].clearBackGround();
+ }
+ klist[8]=tkarte;
+ klist[8].clearBackGround();
+ return true;
+
+ }
+ return false;
+ }
+
+
+ int xoff,yoff;
+ boolean pressed = false;
+
+ public synchronized void mouseDragged( MouseEvent e)
+ {
+ if ( pressed )
+ {
+ klist[8].Move(e.getX()+xoff,e.getY()+yoff);
+ irepaint();
+ }
+ }
+
+
+ public void mousePressed( MouseEvent e)
+ {
+ pressed = bringmousecardtoptop(e);
+ xoff = klist[8].xpos-e.getX();
+ yoff = klist[8].ypos-e.getY();
+ irepaint();
+ }
+
+ public void mouseClicked ( MouseEvent e)
+ {
+ int c = e.getClickCount();
+
+ if ( c==1 )
+ {
+ bringmousecardtoptop(e);
+ irepaint();
+
+ }
+
+ if ( c == 2)
+ {
+ klist[8].drot+=90;
+ klist[8].start();
+ }
+// if ( c == 3)
+// klist[6].start();
+
+ }
+
+ public void mouseReleased ( MouseEvent e)
+ {
+// pressed = false;
+
+ }
+
+ public void mouseEntered ( MouseEvent e)
+ {
+
+ }
+
+ public void mouseExited ( MouseEvent e)
+ {
+
+ }
+
+ public void mouseMoved( MouseEvent e)
+ {
+/* if (pressed)
+ {
+ klist[8].Move(e.getX(),e.getY());
+ irepaint();
+ }
+*/
+ }
+
+
+ public void update( Graphics g)
+ {
+
+repaint();
+/*
+ if ( updateRgn.height==0)
+ return;
+ dupdateRgn = (Rectangle)updateRgn.clone();
+//dupdateRgn=updateRgn;
+ updateRgn.height=0;
+// g.setClip(dupdateRgn);
+ paint(g);
+*/
+ }
+
+ public boolean isDoubleBuffered()
+ {
+ return true;
+ }
+
+
+}
+
+
/hist-1992-2002/hexenspiel/hex.java
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/hline.c
===================================================================
--- hist-1992-2002/hexenspiel/hline.c (nonexistent)
+++ hist-1992-2002/hexenspiel/hline.c (revision 106)
@@ -0,0 +1,23 @@
+/* ---------------------------------------------------------------
+HLINE.C
+(c) 1992 by Tobias Herre
+Bestandteil von DISPLAY.LIB Version 1.0
+----------------------------------------------------------------*/
+
+#include "display.h"
+
+/*----------------------------------------------------------------
+ horizontale Linie zeichnen (von x1,x2 iny y mit der Farbe col
+*/
+void HLine (int x1,int x2,int y)
+{
+ int dx,xdir;
+
+ if(_GetClippedLine (&x1,&y,&x2,&y) == 0) return;
+
+ dx=x2-x1;if(dx<0) {dx=-dx;xdir=-1;} else xdir=1;
+ dx++;
+ while (dx){
+ PutPixel(x1,y); x1+=xdir; dx--;
+ }
+}
/hist-1992-2002/hexenspiel/hline.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/karte2.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/hist-1992-2002/hexenspiel/karte2.gif
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/karte6.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/hist-1992-2002/hexenspiel/karte6.gif
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/l.c
===================================================================
--- hist-1992-2002/hexenspiel/l.c (nonexistent)
+++ hist-1992-2002/hexenspiel/l.c (revision 106)
@@ -0,0 +1,8 @@
+/*----------------------------------------------------------------------
+funktionsname
+Beschreibung:
+Eingabe:
+Ausgabe:
+ Rueckgabewert:
+Bemerkungen
+----------------------------------------------------------------------*/
/hist-1992-2002/hexenspiel/l.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/ptbox.c
===================================================================
--- hist-1992-2002/hexenspiel/ptbox.c (nonexistent)
+++ hist-1992-2002/hexenspiel/ptbox.c (revision 106)
@@ -0,0 +1,25 @@
+/* ---------------------------------------------------------------
+PTBOX.C
+(c) 1992 by Tobias Herre
+Bestandteil von DISPLAY.LIB Version 1.0
+----------------------------------------------------------------*/
+
+#include "display.h"
+/*---------------------------------------------------------------
+ Zeichnen einer ausgefllten Box (x1,y1,x2,y2)
+*/
+void PatternFillBox(int x1,int y1,int x2,int y2,void *data)
+{
+ int dir;
+ if(_GetClippedBox(&x1,&y1,&x2,&y2) == 0) return;
+
+ if(y1<y2) dir=1;
+ else dir=-1;
+
+ /* zeichnen der Box */
+ PatternLine(x1,y1,x2,y1,data);
+ while(y1!=y2){
+ y1+=dir;
+ PatternLine(x1,y1,x2,y1,data);
+ }
+}
/hist-1992-2002/hexenspiel/ptbox.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/putimgz.c
===================================================================
--- hist-1992-2002/hexenspiel/putimgz.c (nonexistent)
+++ hist-1992-2002/hexenspiel/putimgz.c (revision 106)
@@ -0,0 +1,48 @@
+/* ---------------------------------------------------------------
+PUTIMGZ.C
+(c) 1992 by Tobias Herre
+Bestandteil von DISPLAY.LIB Version 1.0
+----------------------------------------------------------------*/
+
+#include "display.h"
+
+/* ----------------------------------------------------------------
+ Zeichnet ein Image auf den Bildschirm und vergӇert bzw.
+ verkleinert dieses
+ Das Image wird an die Position s_x und s_y gesetzt.
+ Die Gr”áe wird durch s_w (Breite) und s_h (H”he) bestimmt.
+*/
+void PutImageZoomed(int s_x,int s_y,int s_w,int s_h,void *data)
+{
+ long sumx,sumy,xadd,yadd,ys,xs;
+ int x1,y1,x2,y2,ix,iy;
+ int width,hight;
+ colortype color;
+
+ if(s_w==0 || s_h==0) return;
+
+ /* Image clippen */
+ x1=s_x; y1=s_y; x2=s_x+s_w-1; y2=s_y+s_h-1;
+ if (_GetClippedBox(&x1,&y1,&x2,&y2)==0) return;
+
+ /* Breite und H”he des Originals auslesen */
+
+ width=*((int *)data); data=(int *)data+1;
+ hight=*((int *)data); data=(int *)data+1;
+
+ if(width<=0 || hight<=0) return;
+
+ /* X- und Y-Schrittweite berechnen */
+ xadd=((long)(width)<<16)/s_w; yadd=((long)(hight)<<16)/s_h;
+
+ /* Startwerte berechnen */
+ ys=(yadd>>1)+yadd*(y1-s_y); xs=(xadd>>1)+xadd*(x1-s_x);
+
+ /* Image zeichnen */
+ for(sumy=ys,iy=y1;iy<=y2;iy++,sumy+=yadd){
+ for(sumx=xs,ix=x1;ix<=x2;ix++,sumx+=xadd){
+ color=((colortype *)data)[width*(int)(sumy>>16)+(int)(sumx>>16)];
+ _SYSPutPixel(ix,iy,color);
+ }
+ }
+}
/hist-1992-2002/hexenspiel/putimgz.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/quad1.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/hist-1992-2002/hexenspiel/quad1.gif
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/tester.c
===================================================================
--- hist-1992-2002/hexenspiel/tester.c (nonexistent)
+++ hist-1992-2002/hexenspiel/tester.c (revision 106)
@@ -0,0 +1,12 @@
+#include "display.h"
+
+void Spline(int ax,int ay,int bx,int by,int cx,int cy);
+
+main(void)
+{
+ GraphicOn();
+ color=3;
+ Spline(0,50, 0,0, 50,0 );
+ return 0;
+}
+
/hist-1992-2002/hexenspiel/tester.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/hexenspiel.html
===================================================================
--- hist-1992-2002/hexenspiel/hexenspiel.html (nonexistent)
+++ hist-1992-2002/hexenspiel/hexenspiel.html (revision 106)
@@ -0,0 +1,21 @@
+<html>
+<head>
+<title>Hexenspiel</title>
+</head>
+<body>
+
+
+<applet code="Hexenspiel.class" width="640" height="95%" alt="jajaja Java-Applets mit">
+<param name="TestText" value="SELFHTML">
+</applet>
+
+
+
+<div id="tube">
+
+
+<p>&nbsp;</p>
+</div>
+
+</body>
+</html>
/hist-1992-2002/hexenspiel/hexenspiel.html
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/j.cmd
===================================================================
--- hist-1992-2002/hexenspiel/j.cmd (nonexistent)
+++ hist-1992-2002/hexenspiel/j.cmd (revision 106)
@@ -0,0 +1,2 @@
+javac gr.java
+java gr
/hist-1992-2002/hexenspiel/j.cmd
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/karte4.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/hist-1992-2002/hexenspiel/karte4.gif
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/karte8.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/hist-1992-2002/hexenspiel/karte8.gif
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/oldfill.c
===================================================================
--- hist-1992-2002/hexenspiel/oldfill.c (nonexistent)
+++ hist-1992-2002/hexenspiel/oldfill.c (revision 106)
@@ -0,0 +1,67 @@
+/* ---------------------------------------------------------------
+FILL.C
+(c) 1992 by Tobias Herre
+Bestandteil von GRAPHS.LIB Version 1.0
+----------------------------------------------------------------*/
+
+#include <malloc.h>
+#include "screen.h"
+
+/*--------------------------------------------------------------
+ nichtrekursive Fllroutine
+*/
+
+#define NIL -1 /* Zeiger auf Ende des Puffers */
+#define SCR_Y MAXY+1 /* H”he des Bildschirms */
+#define SCR_X MAXX+1 /* Breite des Bildschirms */
+
+void Fill(int x,int y,int col)
+{
+ int *buffera,*bufferb;
+ int *bread,*bwrite,*bhelp; /* Zeiger auf Lese-und Schreibpuffer */
+ int wptr,rptr; /* Zeiger in die Puffer */
+ int backcol; /* Speicher fr Hintergrundfarbe */
+ int s,e,s1,e1,eu,ed,xl,xr;
+
+ buffera=malloc( sizeof(int) * SCR_Y*3);
+ if(buffera==NULL) goto exitfill;
+ bufferb=malloc( sizeof(int) * SCR_Y*3);
+ if(bufferb==NULL) goto exitfill;
+
+
+ backcol=GetPixel(x,y);if(backcol==col) goto exitfill;
+
+ for (s=y;GetPixel(x,s)==backcol && s>=MINY;s--) PutPixel(x,s,col);
+ s++;
+ for (e=y+1;GetPixel(x,e)==backcol && e<=MAXY;e++) PutPixel(x,e,col);
+ e--;
+ bread=buffera;bwrite=bufferb;
+ bread[0]=s;bread[1]=e;bread[2]=x;bread[3]=NIL;
+
+ while (bread[0] != NIL) {
+ for (rptr=0,wptr=0,bwrite[0]=NIL;bread[rptr]!=NIL;rptr+=3){
+ for (s=bread[rptr],e=bread[rptr+1],xl=bread[rptr+2]-1,xr=bread[rptr+2]+1,ed=-1,eu=-1;s<=e;s++){
+ if (s>eu && xl>=MINX)
+ if (GetPixel(xl,s)==backcol){
+ for (s1=s;GetPixel(xl,s1)==backcol && s1>=MINY;s1--) PutPixel(xl,s1,col);
+ s1++;
+ for (e1=s+1;GetPixel(xl,e1)==backcol && e1<=MAXY;e1++) PutPixel(xl,e1,col);e1--;
+ bwrite[wptr]=s1;bwrite[wptr+1]=e1;bwrite[wptr+2]=xl;
+ wptr+=3;bwrite[wptr]=NIL; eu=e1;
+ }
+ if (s>ed && xr<=MAXX)
+ if (GetPixel(xr,s)==backcol){
+ for (s1=s;GetPixel(xr,s1)==backcol && s1>=MINY;s1--)PutPixel(xr,s1,col);
+ s1++;
+ for (e1=s+1;GetPixel(xr,e1)==backcol && e1<=MAXY;e1++)PutPixel(xr,e1,col);e1--;
+ bwrite[wptr]=s1;bwrite[wptr+1]=e1;bwrite[wptr+2]=xr;
+ wptr+=3;bwrite[wptr]=NIL; ed=e1;
+ }
+ }
+ }
+ bhelp=bread;bread=bwrite;bwrite=bhelp; /* Puffer tauschen */
+ }
+ exitfill:
+ if(buffera!=NULL) free(buffera);
+ if(bufferb!=NULL) free(bufferb);
+}
/hist-1992-2002/hexenspiel/oldfill.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/putimage.c
===================================================================
--- hist-1992-2002/hexenspiel/putimage.c (nonexistent)
+++ hist-1992-2002/hexenspiel/putimage.c (revision 106)
@@ -0,0 +1,28 @@
+/* ---------------------------------------------------------------
+PUTIMAGE.C
+(c) 1992 by Tobias Herre
+Bestandteil von DISPLAY.LIB Version 1.0
+----------------------------------------------------------------*/
+
+#include "display.h"
+
+/* ----------------------------------------------------------------
+ Kopieren eines Bildschirmausschnittes vom Speicher auf den
+ Bildschirm
+*/
+void PutImage(int x,int y,void *data)
+{
+ int width,hight;
+ int x1,x2,y1,y2;
+ int xoff,yoff,xi,yi;
+ width = *((int *)data); data=(int *)data+1;
+ hight = *((int *)data); data=(int *)data+1;
+
+ x1=x; y1=y; x2=x+width; y2=y+hight;
+ if(_GetClippedBox(&x1,&y1,&x2,&y2) == 0) return;
+ yoff=y1-y; xoff=x1-x;
+
+ for(yi=yoff,y=y1; y<y2; y++,yi++)
+ for(xi=xoff,x=x1; x<x2; x++,xi++)
+ _SYSPutPixel( x,y,((colortype *) data)[xi+width*yi*sizeof(colortype)]);
+}
/hist-1992-2002/hexenspiel/putimage.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/qs.c
===================================================================
--- hist-1992-2002/hexenspiel/qs.c (nonexistent)
+++ hist-1992-2002/hexenspiel/qs.c (revision 106)
@@ -0,0 +1,37 @@
+/* ---------------------------------------------------------------
+*/
+static void QSort (int l,int r)
+{
+ int i,j;
+ Polygon help;
+ while (r > l) {
+ i=l+1;j=r;
+ while (i<=j){
+ while (i<=j && (CmpBodyPolys(l,i)>0)) i++;
+ while (i<=j && (CmpBodyPolys(l,j)<=0)) j--;
+ if (i<=j) {
+ help = polylist[i];
+ polylist[i]=polylist[j];
+ polylist[j]=help;
+ i++; j--;
+ }
+ }
+ if (j != l) {
+ help = polylist[j];
+ polylist[j]=polylist[l];
+ polylist[l]=help;
+ }
+ if (j+j > r+l){
+ QSort(j+1,r);r = j-1;
+ }
+ else{
+ QSort(l,j-1);l = j+1;
+ }
+ }
+}
+
+
+static void SortBodys(void)
+{
+ QSort( 0,nextpolylist-1);
+}
/hist-1992-2002/hexenspiel/qs.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/spline.c
===================================================================
--- hist-1992-2002/hexenspiel/spline.c (nonexistent)
+++ hist-1992-2002/hexenspiel/spline.c (revision 106)
@@ -0,0 +1,77 @@
+/*----------------------------------------------------------------------
+spline.c
+Copyright (c) 1993 by Tobias Herre
+----------------------------------------------------------------------*/
+#include <math.h>
+#include "display.h"
+
+
+/*----------------------------------------------------------------------
+Spline
+ Zeichnet eine Spline
+Eingabe:
+----------------------------------------------------------------------*/
+void Spline(int ax,int ay,int bx,int by,int cx,int cy)
+{
+ int i=0;
+ long diff1,diff2,diff3;
+ long diff;
+ int x,y;
+ int x1,x2,x3,y1,y2,y3;
+
+ int xdir,ydir;
+
+ if( cy>ay ) /* Y-Schrittrichtung bestimmen */
+ ydir=1;
+ else
+ ydir=-1;
+
+
+ if( cx>ax ) /* X-Schrittrichtung */
+ xdir=1;
+ else
+ xdir=-1;
+
+#ifdef DEBUG
+ Line(ax,ay,bx,by);
+ Line(bx,by,cx,cy);
+#endif
+
+
+ x=0; y=0;
+ xdir = 1; ydir = 1;
+ do
+ {
+ x1=x+xdir; y1=y;
+ x2=x+xdir; y2=y+ydir;
+ x3=x; y3=y+ydir;
+
+ /* y = x*x */
+ diff1=labs(y1*340-x1*x1);
+ diff2=labs(y2*340-x2*x2);
+ diff3=labs(y3*340-x3*x3);
+
+
+
+ if (diff1<diff3 && diff1 < diff3 )
+ {
+ x=x1; y=y1;
+ }
+ else
+ {
+ if( diff2<diff3 )
+ {
+ x=x2; y=y2;
+ }
+ else
+ {
+ x=x3; y=y3;
+ }
+ }
+
+ PutPixel(x,y);
+
+ i++;
+ }while( i<290 ) ;
+
+}
/hist-1992-2002/hexenspiel/spline.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hist-1992-2002/hexenspiel/x2.c
===================================================================
--- hist-1992-2002/hexenspiel/x2.c (nonexistent)
+++ hist-1992-2002/hexenspiel/x2.c (revision 106)
@@ -0,0 +1,69 @@
+/*----------------------------------------------------------------------
+x2.c
+Copyright (c) 1993 by Tobias Herre
+----------------------------------------------------------------------*/
+
+
+
+void x2()
+{
+ int x,y;
+
+ x=0; y=0;
+ x=ax; y=ay;
+
+ do
+ {
+ x1=x+xdir; y1=y;
+ x2=x+xdir; y2=y+ydir;
+ x3=x; y3=y+ydir;
+
+ diff1=0;
+ diff=x1-bx; diff1+=diff*diff;
+ diff=y1-by; diff1+=diff*diff;
+ diff=x1-cx; diff1+=diff*diff;
+ diff=y1-cy; diff1+=diff*diff;
+ diff=x1-ax; diff1+=diff*diff;
+ diff=y1-ay; diff1+=diff*diff;
+
+ diff2=0;
+ diff=x2-bx; diff2+=diff*diff;
+ diff=y2-by; diff2+=diff*diff;
+ diff=x2-cx; diff2+=diff*diff;
+ diff=y2-cy; diff2+=diff*diff;
+ diff=x2-ax; diff2+=diff*diff;
+ diff=y2-ay; diff2+=diff*diff;
+
+ diff3=0;
+ diff=x3-bx; diff3+=diff*diff;
+ diff=y3-by; diff3+=diff*diff;
+ diff=x3-cx; diff3+=diff*diff;
+ diff=y3-cy; diff3+=diff*diff;
+ diff=x3-ax; diff3+=diff*diff;
+ diff=y3-ay; diff3+=diff*diff;
+
+
+ if( diff1<diff2 && diff1 < diff3 )
+ {
+ x=x1; y=y1;
+ }
+ else
+ {
+ if( diff2<diff3 )
+ {
+ x=x2; y=y2;
+ }
+ else
+ {
+ x=x3; y=y3;
+ }
+ }
+
+ PutPixel(x,y);
+
+ }while( x!=cx && y != cy) ;
+
+
+
+
+}
\ No newline at end of file
/hist-1992-2002/hexenspiel/x2.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property