Browse Source

Entfernen von Objekten ist jetzt möglich

Kolja Strohm 5 years ago
parent
commit
e9e3cff5d9
6 changed files with 619 additions and 144 deletions
  1. 435 96
      Bild.cpp
  2. 22 4
      Bild.h
  3. 138 44
      Schrift.cpp
  4. 12 0
      Trie.h
  5. 9 0
      UIMLView.cpp
  6. 3 0
      UIMLView.h

+ 435 - 96
Bild.cpp

@@ -68,16 +68,55 @@ inline void Bild::alphaPixelP( int x, int y, int f )
     alphaPixelP( fc[ x + y * size.x ], f );
 }
 
+inline void Bild::alphaPixelP3D( int x, int y, int f )
+{
+    alphaPixelP3D( fc[ x + y * size.x ], f );
+}
+
+inline void Bild::alphaPixelAssozP( int &fc, int f )
+{
+    unsigned char *fc1 = (unsigned char*)&fc;
+    unsigned char *fc2 = (unsigned char*)&f;
+    unsigned char na = ~fc2[ 3 ];
+    unsigned char a = (unsigned char)( fc2[ 3 ] + ( ( na * fc1[ 3 ] ) >> 8 ) );
+    if( a == 0 )
+        return;
+    fc1[ 2 ] = (unsigned char)( ( fc2[ 2 ] * fc2[ 3 ] + ( ( fc1[ 2 ] * na * fc1[ 3 ] ) >> 8 ) ) / a );
+    fc1[ 1 ] = (unsigned char)( ( fc2[ 1 ] * fc2[ 3 ] + ( ( fc1[ 1 ] * na * fc1[ 3 ] ) >> 8 ) ) / a );
+    fc1[ 0 ] = (unsigned char)( ( fc2[ 0 ] * fc2[ 3 ] + ( ( fc1[ 0 ] * na * fc1[ 3 ] ) >> 8 ) ) / a );
+    fc1[ 3 ] = a;
+}
+
+inline void Bild::alphaPixelP3D( int &fc, int colorb )
+{
+    //alphaPixelAssozP( fc, colorb );
+    //return;
+    int alpha = ( ( colorb >> 24 ) & 0xFF );
+    int na = ( 0x100 - alpha );
+    fc = ( ( ( ( ( na * ( fc & 0xFF00FF ) ) >> 8 ) + ( ( alpha * ( colorb & 0xFF00FF ) ) >> 8 ) ) & 0xFF00FF ) |
+        ( ( ( ( na * ( fc & 0x00FF00 ) ) >> 8 ) + ( ( alpha * ( colorb & 0x00FF00 ) ) >> 8 ) ) & 0x00FF00 ) |
+        ( ( fc & 0xFF000000 ) ) ) * ( fc != 0 ) | ( fc == 0 ) * colorb;
+    //unsigned char *fc1 = (unsigned char*)&fc;
+    //unsigned char *fc2 = (unsigned char*)&colorb;
+    //unsigned char na = 255-fc2[ 3 ];
+    //fc1[ 3 ] = fc2[ 3 ];
+    //fc1[ 2 ] = (unsigned char)( ( fc2[ 2 ] * fc2[ 3 ] + fc1[ 2 ] * na ) / 255 );
+    //fc1[ 1 ] = (unsigned char)( ( fc2[ 1 ] * fc2[ 3 ] + fc1[ 1 ] * na ) / 255 );
+    //fc1[ 0 ] = (unsigned char)( ( fc2[ 0 ] * fc2[ 3 ] + fc1[ 0 ] * na ) / 255 );
+}
+
 inline void Bild::alphaPixelP( int &fc, int colorb )
 {
+    //alphaPixelAssozP( fc, colorb );
+    //return;
     int alpha = ( ( colorb >> 24 ) & 0xFF );
     int na = ( 0x100 - alpha );
     fc = ( ( ( ( ( na * ( fc & 0xFF00FF ) ) >> 8 ) + ( ( alpha * ( colorb & 0xFF00FF ) ) >> 8 ) ) & 0xFF00FF ) |
         ( ( ( ( na * ( fc & 0x00FF00 ) ) >> 8 ) + ( ( alpha * ( colorb & 0x00FF00 ) ) >> 8 ) ) & 0x00FF00 ) |
-           ( ( fc & 0xFF000000 ) ) ) * ( fc != 0 || !alpha3D ) | ( fc == 0 && alpha3D ) * colorb;
-    //unsigned char *fc1 = (unsigned char*)&fc[ i ];
+        ( ( fc & 0xFF000000 ) ) );
+    //unsigned char *fc1 = (unsigned char*)&fc;
     //unsigned char *fc2 = (unsigned char*)&colorb;
-    //unsigned char na = ~fc2[ 3 ];
+    //unsigned char na = 255-fc2[ 3 ];
     //fc1[ 3 ] = fc2[ 3 ];
     //fc1[ 2 ] = (unsigned char)( ( fc2[ 2 ] * fc2[ 3 ] + fc1[ 2 ] * na ) / 255 );
     //fc1[ 1 ] = (unsigned char)( ( fc2[ 1 ] * fc2[ 3 ] + fc1[ 1 ] * na ) / 255 );
@@ -112,7 +151,7 @@ void Bild::drawFlatDreieck( int y1, int y2, float m1, float b1, float m2, float
 }
 
 void Bild::drawFlatDreieckTextur( int y1, int y2, double m1, double b1, double m2, double b2, double tx1, double ty1, double tx2, double ty2,
-                                  double tx_1o, double ty_1o, double tx_2o, double ty_2o, double txf, double tyf, Bild &textur )
+    double tx_1o, double ty_1o, double tx_2o, double ty_2o, double txf, double tyf, Bild &textur )
 {
     const double yStart = max( y1, dPosA[ doa ].y );
     const double yEnd = min( y2, dSizeA[ doa ].y );
@@ -129,17 +168,30 @@ void Bild::drawFlatDreieckAlpha( int y1, int y2, float m1, float b1, float m2, f
 {
     const int yStart = max( (int)( y1 + 0.5 ), dPosA[ doa ].y );
     const int yEnd = min( (int)( y2 + 0.5 ), dSizeA[ doa ].y );
-    for( int y = yStart; y < yEnd; y++ )
+    if( alpha3D )
     {
-        const int xStart = max( (int)( m1 * ( (float)y + 0.5f ) + b1 + 0.5f ), dPosA[ doa ].x );
-        const int xEnd = min( (int)( m2 * ( (float)y + 0.5 ) + b2 + 0.5f ), dSizeA[ doa ].x );
-        for( int x = xStart; x < xEnd; x++ )
-            alphaPixelP( fc[ x + y * size.x ], farbe );
+        for( int y = yStart; y < yEnd; y++ )
+        {
+            const int xStart = max( (int)( m1 * ( (float)y + 0.5f ) + b1 + 0.5f ), dPosA[ doa ].x );
+            const int xEnd = min( (int)( m2 * ( (float)y + 0.5 ) + b2 + 0.5f ), dSizeA[ doa ].x );
+            for( int x = xStart; x < xEnd; x++ )
+                alphaPixelP3D( fc[ x + y * size.x ], farbe );
+        }
+    }
+    else
+    {
+        for( int y = yStart; y < yEnd; y++ )
+        {
+            const int xStart = max( (int)( m1 * ( (float)y + 0.5f ) + b1 + 0.5f ), dPosA[ doa ].x );
+            const int xEnd = min( (int)( m2 * ( (float)y + 0.5 ) + b2 + 0.5f ), dSizeA[ doa ].x );
+            for( int x = xStart; x < xEnd; x++ )
+                alphaPixelP( fc[ x + y * size.x ], farbe );
+        }
     }
 }
 
 void Bild::drawFlatDreieckTexturAlpha( int y1, int y2, double m1, double b1, double m2, double b2, double tx1, double ty1, double tx2, double ty2,
-                                       double tx_1o, double ty_1o, double tx_2o, double ty_2o, double txf, double tyf, Bild &textur )
+    double tx_1o, double ty_1o, double tx_2o, double ty_2o, double txf, double tyf, Bild &textur )
 {
     const double yStart = max( y1, dPosA[ doa ].y );
     const double yEnd = min( y2, dSizeA[ doa ].y );
@@ -238,16 +290,33 @@ void Bild::drawLinieHTexturAlpha( Vec2< double > p, double len, Vec2< double > t
     int *buffer = textur.getBuffer();
     int txtBr = textur.getBreite();
     int f;
-    for( int i = 0; i < len; ++i, ++fc )
+    if( alpha3D )
     {
-        f = buffer[ (int)( (int)( x + 0.5 ) + (int)( y + 0.5 ) * txtBr ) ];
-        if( alpha[ alphaAnzahl ] )
+        for( int i = 0; i < len; ++i, ++fc )
         {
-            unsigned char *cf = (unsigned char*)&f;
-            cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
+            f = buffer[ (int)( (int)( x + 0.5 ) + (int)( y + 0.5 ) * txtBr ) ];
+            if( alpha[ alphaAnzahl ] )
+            {
+                unsigned char *cf = (unsigned char*)&f;
+                cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
+            }
+            alphaPixelP3D( *fc, f );
+            x += txo, y += tyo;
+        }
+    }
+    else
+    {
+        for( int i = 0; i < len; ++i, ++fc )
+        {
+            f = buffer[ (int)( (int)( x + 0.5 ) + (int)( y + 0.5 ) * txtBr ) ];
+            if( alpha[ alphaAnzahl ] )
+            {
+                unsigned char *cf = (unsigned char*)&f;
+                cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
+            }
+            alphaPixelP( *fc, f );
+            x += txo, y += tyo;
         }
-        alphaPixelP( *fc, f );
-        x += txo, y += tyo;
     }
     rend = 1;
 }
@@ -405,19 +474,34 @@ void Bild::alphaRegion( int x, int y, int b, int h, int ff )
     int na = ( 0x100 - alpha );
     int i1 = ( alpha * ( ff & 0xFF00FF ) ) >> 8;
     int i2 = ( alpha * ( ff & 0x00FF00 ) ) >> 8;
-    for( int i = 0; i < h; pixel += size.x - b, ++i, rowEnd += size.x )
+    if( alpha3D )
     {
-        for( ; pixel < rowEnd; ++pixel )
+        for( int i = 0; i < h; pixel += size.x - b, ++i, rowEnd += size.x )
         {
-            *pixel = ( ( ( ( ( na * ( *pixel & 0xFF00FF ) ) >> 8 ) + i1 ) & 0xFF00FF ) |
-                ( ( ( ( na * ( *pixel & 0x00FF00 ) ) >> 8 ) + i2 ) & 0x00FF00 ) |
-                       ( ( *pixel & 0xFF000000 ) ) ) * ( *pixel != 0 || !alpha3D ) | ( *pixel == 0 && alpha3D ) * ff;
+            for( ; pixel < rowEnd; ++pixel )
+            {
+                *pixel = ( ( ( ( ( na * ( *pixel & 0xFF00FF ) ) >> 8 ) + i1 ) & 0xFF00FF ) |
+                    ( ( ( ( na * ( *pixel & 0x00FF00 ) ) >> 8 ) + i2 ) & 0x00FF00 ) |
+                    ( ( *pixel & 0xFF000000 ) ) ) * ( *pixel != 0 ) | ( *pixel == 0 ) * ff;
+            }
+        }
+    }
+    else
+    {
+        for( int i = 0; i < h; pixel += size.x - b, ++i, rowEnd += size.x )
+        {
+            for( ; pixel < rowEnd; ++pixel )
+            {
+                *pixel = ( ( ( ( ( na * ( *pixel & 0xFF00FF ) ) >> 8 ) + i1 ) & 0xFF00FF ) |
+                    ( ( ( ( na * ( *pixel & 0x00FF00 ) ) >> 8 ) + i2 ) & 0x00FF00 ) |
+                    ( ( *pixel & 0xFF000000 ) ) );
+            }
         }
     }
     rend = 1;
 }
 
-void Bild::alphaPixel( int i, int f )
+void Bild::alphaPixel2D( int i, int f )
 {
     if( !alpha[ alphaAnzahl ] )
         alphaPixelP( fc[ i ], f );
@@ -430,7 +514,20 @@ void Bild::alphaPixel( int i, int f )
     }
 }
 
-void Bild::alphaPixel( int x, int y, int f )
+void Bild::alphaPixel3D( int i, int f )
+{
+    if( !alpha[ alphaAnzahl ] )
+        alphaPixelP3D( fc[ i ], f );
+    if( alpha[ alphaAnzahl ] < 0xFF )
+    {
+        unsigned char *cf = (unsigned char*)&f;
+        cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
+        alphaPixelP3D( fc[ i ], f );
+        rend = 1;
+    }
+}
+
+void Bild::alphaPixel2D( int x, int y, int f )
 {
     if( !alpha[ alphaAnzahl ] )
         alphaPixelP( fc[ x + y * size.x ], f );
@@ -443,7 +540,20 @@ void Bild::alphaPixel( int x, int y, int f )
     }
 }
 
-void Bild::alphaPixelDP( int x, int y, int f )
+void Bild::alphaPixel3D( int x, int y, int f )
+{
+    if( !alpha[ alphaAnzahl ] )
+        alphaPixelP3D( fc[ x + y * size.x ], f );
+    if( alpha[ alphaAnzahl ] < 0xFF )
+    {
+        unsigned char *cf = (unsigned char*)&f;
+        cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
+        alphaPixelP3D( fc[ x + y * size.x ], f );
+        rend = 1;
+    }
+}
+
+void Bild::alphaPixelDP2D( int x, int y, int f )
 {
     if( alpha[ alphaAnzahl ] == 0xFF )
         return;
@@ -462,11 +572,38 @@ void Bild::alphaPixelDP( int x, int y, int f )
     rend = 1;
 }
 
-void Bild::alphaPixelDP( int i, int f )
+void Bild::alphaPixelDP3D( int x, int y, int f )
+{
+    if( alpha[ alphaAnzahl ] == 0xFF )
+        return;
+    int dpx = dPosA[ doa ].x;
+    int dpy = dPosA[ doa ].y;
+    int dgx = dSizeA[ doa ].x;
+    int dgy = dSizeA[ doa ].y;
+    if( x < dpx || y < dpy || x > dgx || y > dgy )
+        return;
+    if( alpha[ alphaAnzahl ] )
+    {
+        unsigned char *cf = (unsigned char*)&f;
+        cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
+    }
+    alphaPixelP3D( fc[ x + y * size.x ], f );
+    rend = 1;
+}
+
+void Bild::alphaPixelDP2D( int i, int f )
 {
     int x = i % size.x;
     int y = i / size.x;
-    alphaPixelDP( x, y, f );
+    alphaPixelDP2D( x, y, f );
+    rend = 1;
+}
+
+void Bild::alphaPixelDP3D( int i, int f )
+{
+    int x = i % size.x;
+    int y = i / size.x;
+    alphaPixelDP3D( x, y, f );
     rend = 1;
 }
 
@@ -476,7 +613,10 @@ void Bild::setPixelDP( int x, int y, int f )
         return;
     if( alpha[ alphaAnzahl ] )
     {
-        alphaPixelDP( x, y, f );
+        if( alpha3D )
+            alphaPixelDP3D( x, y, f );
+        else
+            alphaPixelDP2D( x, y, f );
         return;
     }
     int dpx = dPosA[ doa ].x;
@@ -617,7 +757,7 @@ void Bild::drawLinieHAlpha( int x, int y, int len, int f ) // zeichnet eine hori
     {
         fc[ i ] = ( ( ( ( ( na * ( fc[ i ] & 0xFF00FF ) ) >> 8 ) + i1 ) & 0xFF00FF ) |
             ( ( ( ( na * ( fc[ i ] & 0x00FF00 ) ) >> 8 ) + i2 ) & 0x00FF00 ) |
-                    ( ( fc[ i ] & 0xFF000000 ) ) ) * ( fc[ i ] != 0 || !alpha3D ) | ( fc[ i ] == 0 && alpha3D ) * f;
+            ( ( fc[ i ] & 0xFF000000 ) ) ) * ( fc[ i ] != 0 || !alpha3D ) | ( fc[ i ] == 0 && alpha3D ) * f;
     }
     rend = 1;
 }
@@ -664,7 +804,7 @@ void Bild::drawLinieVAlpha( int x, int y, int len, int f ) // zeichnet eine vert
     {
         fc[ i ] = ( ( ( ( ( na * ( fc[ i ] & 0xFF00FF ) ) >> 8 ) + i1 ) & 0xFF00FF ) |
             ( ( ( ( na * ( fc[ i ] & 0x00FF00 ) ) >> 8 ) + i2 ) & 0x00FF00 ) |
-                    ( fc[ i ] & 0xFF000000 ) ) * ( fc[ i ] != 0 || !alpha3D ) | ( fc[ i ] == 0 && alpha3D ) * f;
+            ( fc[ i ] & 0xFF000000 ) ) * ( fc[ i ] != 0 || !alpha3D ) | ( fc[ i ] == 0 && alpha3D ) * f;
     }
     rend = 1;
 }
@@ -743,7 +883,7 @@ void Bild::drawLinieBordered( Punkt a, Punkt b, int bc, int fc )
         else
             yf = yf < 0 ? -1 : 1;
         double x = (double)a.x, y = (double)a.y;
-        int maxP = (int)( sqrt( (float)(xlen * xlen + ylen * ylen) ) + 0.5 );
+        int maxP = (int)( sqrt( (float)( xlen * xlen + ylen * ylen ) ) + 0.5 );
         int count = 0;
         int maxPixel = size.x * size.y;
         while( !( (int)( x + 0.5 ) == b.x && (int)( y + 0.5 ) == b.y ) && count < maxP )
@@ -842,7 +982,7 @@ void Bild::drawLinieBorderedAlpha( Punkt a, Punkt b, int bc, int fc )
             unsigned char *cf = (unsigned char*)&fc;
             cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
         }
-        int maxP = (int)( sqrt( (float)(xlen * xlen + ylen * ylen) ) + 0.5 );
+        int maxP = (int)( sqrt( (float)( xlen * xlen + ylen * ylen ) ) + 0.5 );
         int alpha = ( ( fc >> 24 ) & 0xFF );
         int alpha2 = ( ( bc >> 24 ) & 0xFF );
         int na = ( 0x100 - alpha );
@@ -861,28 +1001,28 @@ void Bild::drawLinieBorderedAlpha( Punkt a, Punkt b, int bc, int fc )
                 int &pixel = this->fc[ (int)( x - 0.5 ) + (int)( y + 0.5 ) * size.x ];
                 pixel = ( ( ( ( ( na2 * ( pixel & 0xFF00FF ) ) >> 8 ) + j1 ) & 0xFF00FF ) |
                     ( ( ( ( na2 * ( pixel & 0x00FF00 ) ) >> 8 ) + j2 ) & 0x00FF00 ) |
-                          ( pixel & 0xFF000000 ) ) * ( pixel != 0 || !alpha3D ) | ( pixel == 0 && alpha3D ) * bc;
+                    ( pixel & 0xFF000000 ) ) * ( pixel != 0 || !alpha3D ) | ( pixel == 0 && alpha3D ) * bc;
             }
             if( (int)( (int)( x + 1.5 ) + (int)( y + 0.5 ) * size.x ) < maxPixel )
             {
                 int &pixel = this->fc[ (int)( x + 1.5 ) + (int)( y + 0.5 ) * size.x ];
                 pixel = ( ( ( ( ( na2 * ( pixel & 0xFF00FF ) ) >> 8 ) + j1 ) & 0xFF00FF ) |
                     ( ( ( ( na2 * ( pixel & 0x00FF00 ) ) >> 8 ) + j2 ) & 0x00FF00 ) |
-                          ( pixel & 0xFF000000 ) ) * ( pixel != 0 || !alpha3D ) | ( pixel == 0 && alpha3D ) * bc;
+                    ( pixel & 0xFF000000 ) ) * ( pixel != 0 || !alpha3D ) | ( pixel == 0 && alpha3D ) * bc;
             }
             if( (int)( (int)( x + 0.5 ) + (int)( y - 0.5 ) * size.x ) < maxPixel )
             {
                 int &pixel = this->fc[ (int)( x + 0.5 ) + (int)( y - 0.5 ) * size.x ];
                 pixel = ( ( ( ( ( na2 * ( pixel & 0xFF00FF ) ) >> 8 ) + j1 ) & 0xFF00FF ) |
                     ( ( ( ( na2 * ( pixel & 0x00FF00 ) ) >> 8 ) + j2 ) & 0x00FF00 ) |
-                          ( pixel & 0xFF000000 ) ) * ( pixel != 0 || !alpha3D ) | ( pixel == 0 && alpha3D ) * bc;
+                    ( pixel & 0xFF000000 ) ) * ( pixel != 0 || !alpha3D ) | ( pixel == 0 && alpha3D ) * bc;
             }
             if( (int)( (int)( x + 0.5 ) + (int)( y + 1.5 ) * size.x ) < maxPixel )
             {
                 int &pixel = this->fc[ (int)( x + 0.5 ) + (int)( y + 1.5 ) * size.x ];
                 pixel = ( ( ( ( ( na2 * ( pixel & 0xFF00FF ) ) >> 8 ) + j1 ) & 0xFF00FF ) |
                     ( ( ( ( na2 * ( pixel & 0x00FF00 ) ) >> 8 ) + j2 ) & 0x00FF00 ) |
-                          ( pixel & 0xFF000000 ) ) * ( pixel != 0 || !alpha3D ) | ( pixel == 0 && alpha3D ) * bc;
+                    ( pixel & 0xFF000000 ) ) * ( pixel != 0 || !alpha3D ) | ( pixel == 0 && alpha3D ) * bc;
             }
             x += xf, y += yf;
         }
@@ -893,7 +1033,7 @@ void Bild::drawLinieBorderedAlpha( Punkt a, Punkt b, int bc, int fc )
             int &pixel = this->fc[ (int)( x + 0.5 ) + (int)( y + 0.5 ) * size.x ];
             pixel = ( ( ( ( ( na * ( pixel & 0xFF00FF ) ) >> 8 ) + i1 ) & 0xFF00FF ) |
                 ( ( ( ( na * ( pixel & 0x00FF00 ) ) >> 8 ) + i2 ) & 0x00FF00 ) |
-                      ( pixel & 0xFF000000 ) ) * ( pixel != 0 || !alpha3D ) | ( pixel == 0 && alpha3D ) * fc;
+                ( pixel & 0xFF000000 ) ) * ( pixel != 0 || !alpha3D ) | ( pixel == 0 && alpha3D ) * fc;
             x += xf, y += yf;
         }
         rend = 1;
@@ -974,7 +1114,7 @@ void Bild::drawLinie( Punkt a, Punkt b, int fc ) // zeichnet eine Linie von Punk
         else
             yf = yf < 0 ? -1 : 1;
         double x = (double)a.x, y = (double)a.y;
-        int maxP = (int)( sqrt( (float)(xlen * xlen + ylen * ylen) ) + 0.5 );
+        int maxP = (int)( sqrt( (float)( xlen * xlen + ylen * ylen ) ) + 0.5 );
         int count = 0;
         while( !( (int)( x + 0.5 ) == b.x && (int)( y + 0.5 ) == b.y ) && count < maxP )
         {
@@ -1060,7 +1200,7 @@ void Bild::drawLinieAlpha( Punkt a, Punkt b, int fc )
             unsigned char *cf = (unsigned char*)&fc;
             cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
         }
-        int maxP = (int)( sqrt( (float)(xlen * xlen + ylen * ylen) ) + 0.5 );
+        int maxP = (int)( sqrt( (float)( xlen * xlen + ylen * ylen ) ) + 0.5 );
         int count = 0;
         int alpha = ( ( fc >> 24 ) & 0xFF );
         int na = ( 0x100 - alpha );
@@ -1072,7 +1212,7 @@ void Bild::drawLinieAlpha( Punkt a, Punkt b, int fc )
             int &pixel = this->fc[ (int)( x + 0.5 ) + (int)( y + 0.5 ) * size.x ];
             pixel = ( ( ( ( ( na * ( pixel & 0xFF00FF ) ) >> 8 ) + i1 ) & 0xFF00FF ) |
                 ( ( ( ( na * ( pixel & 0x00FF00 ) ) >> 8 ) + i2 ) & 0x00FF00 ) |
-                      ( pixel & 0xFF000000 ) ) * ( pixel != 0 || !alpha3D ) | ( pixel == 0 && alpha3D ) * fc;
+                ( pixel & 0xFF000000 ) ) * ( pixel != 0 || !alpha3D ) | ( pixel == 0 && alpha3D ) * fc;
             x += xf, y += yf;
         }
         rend = 1;
@@ -1157,56 +1297,56 @@ void Bild::drawKreisAlpha( int xOff, int yOff, int r, int fc )
             pixel = &this->fc[ xOff + a + ( yOff + b ) * size.x ];
             *pixel = ( ( ( ( ( na * ( *pixel & 0xFF00FF ) ) >> 8 ) + i1 ) & 0xFF00FF ) |
                 ( ( ( ( na * ( *pixel & 0x00FF00 ) ) >> 8 ) + i2 ) & 0x00FF00 ) |
-                       ( *pixel & 0xFF000000 ) ) * ( *pixel != 0 || !alpha3D ) | ( *pixel == 0 && alpha3D ) * fc;
+                ( *pixel & 0xFF000000 ) ) * ( *pixel != 0 || !alpha3D ) | ( *pixel == 0 && alpha3D ) * fc;
         }
         if( xOff - a < dgx && xOff - a > dpx && yOff + b < dgy && yOff + b > dpy )
         {
             pixel = &this->fc[ xOff - a + ( yOff + b ) * size.x ];
             *pixel = ( ( ( ( ( na * ( *pixel & 0xFF00FF ) ) >> 8 ) + i1 ) & 0xFF00FF ) |
                 ( ( ( ( na * ( *pixel & 0x00FF00 ) ) >> 8 ) + i2 ) & 0x00FF00 ) |
-                       ( *pixel & 0xFF000000 ) ) * ( *pixel != 0 || !alpha3D ) | ( *pixel == 0 && alpha3D ) * fc;
+                ( *pixel & 0xFF000000 ) ) * ( *pixel != 0 || !alpha3D ) | ( *pixel == 0 && alpha3D ) * fc;
         }
         if( xOff + a < dgx && xOff + a > dpx && yOff - b < dgy && yOff - b > dpy )
         {
             pixel = &this->fc[ xOff + a + ( yOff - b ) * size.x ];
             *pixel = ( ( ( ( ( na * ( *pixel & 0xFF00FF ) ) >> 8 ) + i1 ) & 0xFF00FF ) |
                 ( ( ( ( na * ( *pixel & 0x00FF00 ) ) >> 8 ) + i2 ) & 0x00FF00 ) |
-                       ( *pixel & 0xFF000000 ) ) * ( *pixel != 0 || !alpha3D ) | ( *pixel == 0 && alpha3D ) * fc;
+                ( *pixel & 0xFF000000 ) ) * ( *pixel != 0 || !alpha3D ) | ( *pixel == 0 && alpha3D ) * fc;
         }
         if( xOff - a < dgx && xOff - a > dpx && yOff - b < dgy && yOff - b > dpy )
         {
             pixel = &this->fc[ xOff - a + ( yOff - b ) * size.x ];
             *pixel = ( ( ( ( ( na * ( *pixel & 0xFF00FF ) ) >> 8 ) + i1 ) & 0xFF00FF ) |
                 ( ( ( ( na * ( *pixel & 0x00FF00 ) ) >> 8 ) + i2 ) & 0x00FF00 ) |
-                       ( *pixel & 0xFF000000 ) ) * ( *pixel != 0 || !alpha3D ) | ( *pixel == 0 && alpha3D ) * fc;
+                ( *pixel & 0xFF000000 ) ) * ( *pixel != 0 || !alpha3D ) | ( *pixel == 0 && alpha3D ) * fc;
         }
         if( xOff + b < dgx && xOff + b > dpx && yOff + a < dgy && yOff + a > dpy )
         {
             pixel = &this->fc[ xOff + b + ( yOff + a ) * size.x ];
             *pixel = ( ( ( ( ( na * ( *pixel & 0xFF00FF ) ) >> 8 ) + i1 ) & 0xFF00FF ) |
                 ( ( ( ( na * ( *pixel & 0x00FF00 ) ) >> 8 ) + i2 ) & 0x00FF00 ) |
-                       ( *pixel & 0xFF000000 ) ) * ( *pixel != 0 || !alpha3D ) | ( *pixel == 0 && alpha3D ) * fc;
+                ( *pixel & 0xFF000000 ) ) * ( *pixel != 0 || !alpha3D ) | ( *pixel == 0 && alpha3D ) * fc;
         }
         if( xOff - b < dgx && xOff - b > dpx && yOff + a < dgy && yOff + a > dpy )
         {
             pixel = &this->fc[ xOff - b + ( yOff + a ) * size.x ];
             *pixel = ( ( ( ( ( na * ( *pixel & 0xFF00FF ) ) >> 8 ) + i1 ) & 0xFF00FF ) |
                 ( ( ( ( na * ( *pixel & 0x00FF00 ) ) >> 8 ) + i2 ) & 0x00FF00 ) |
-                       ( *pixel & 0xFF000000 ) ) * ( *pixel != 0 || !alpha3D ) | ( *pixel == 0 && alpha3D ) * fc;
+                ( *pixel & 0xFF000000 ) ) * ( *pixel != 0 || !alpha3D ) | ( *pixel == 0 && alpha3D ) * fc;
         }
         if( xOff + b < dgx && xOff + b > dpx && yOff - a < dgy && yOff - a > dpy )
         {
             pixel = &this->fc[ xOff + b + ( yOff - a ) * size.x ];
             *pixel = ( ( ( ( ( na * ( *pixel & 0xFF00FF ) ) >> 8 ) + i1 ) & 0xFF00FF ) |
                 ( ( ( ( na * ( *pixel & 0x00FF00 ) ) >> 8 ) + i2 ) & 0x00FF00 ) |
-                       ( *pixel & 0xFF000000 ) ) * ( *pixel != 0 || !alpha3D ) | ( *pixel == 0 && alpha3D ) * fc;
+                ( *pixel & 0xFF000000 ) ) * ( *pixel != 0 || !alpha3D ) | ( *pixel == 0 && alpha3D ) * fc;
         }
         if( xOff - b < dgx && xOff - b > dpx && yOff - a < dgy && yOff - a > dpy )
         {
             pixel = &this->fc[ xOff - b + ( yOff - a ) * size.x ];
             *pixel = ( ( ( ( ( na * ( *pixel & 0xFF00FF ) ) >> 8 ) + i1 ) & 0xFF00FF ) |
                 ( ( ( ( na * ( *pixel & 0x00FF00 ) ) >> 8 ) + i2 ) & 0x00FF00 ) |
-                       ( *pixel & 0xFF000000 ) ) * ( *pixel != 0 || !alpha3D ) | ( *pixel == 0 && alpha3D ) * fc;
+                ( *pixel & 0xFF000000 ) ) * ( *pixel != 0 || !alpha3D ) | ( *pixel == 0 && alpha3D ) * fc;
         }
     }
     rend = 1;
@@ -1250,7 +1390,7 @@ void Bild::drawBild( int x, int y, int br, int hi, Bild &zBild ) // zeichet zBil
     rend = 1;
 }
 
-void Bild::alphaBild( int x, int y, int br, int hi, Bild &zBild )
+void Bild::alphaBildAssoz( int x, int y, int br, int hi, Bild &zBild )
 {
     if( alpha[ alphaAnzahl ] == 0xFF )
         return;
@@ -1280,7 +1420,7 @@ void Bild::alphaBild( int x, int y, int br, int hi, Bild &zBild )
             ygr = yy * size.x;
             ygr2 = ( yy - yst2 + yst ) * bb;
             for( xx = xst2; xx < dgx; ++xx )
-                alphaPixelP( fc[ xx + ygr ], ff[ ( xx - xst2 + xst ) + ygr2 ] );
+                alphaPixelAssozP( fc[ xx + ygr ], ff[ ( xx - xst2 + xst ) + ygr2 ] );
         }
     }
     else
@@ -1294,8 +1434,95 @@ void Bild::alphaBild( int x, int y, int br, int hi, Bild &zBild )
             {
                 int fc = ff[ ( xx - xst2 + xst ) + ygr2 ];
                 unsigned char *cf = (unsigned char*)&fc;
-                cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
-                alphaPixelP( this->fc[ xx + ygr ], fc );
+                //cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
+                alphaPixelAssozP( this->fc[ xx + ygr ], fc );
+            }
+        }
+    }
+    rend = 1;
+}
+
+void Bild::alphaBild( int x, int y, int br, int hi, Bild &zBild )
+{
+    if( alpha[ alphaAnzahl ] == 0xFF )
+        return;
+    int dpx = dPosA[ doa ].x;
+    int dpy = dPosA[ doa ].y;
+    int dgx = dSizeA[ doa ].x;
+    int dgy = dSizeA[ doa ].y;
+    x += drawOff[ doa ].x;
+    y += drawOff[ doa ].y;
+    if( x + br < dpx || y + hi < dpy || x > dgx || y > dgy )
+        return;
+    br = minInt( br, zBild.getBreite() );
+    hi = minInt( hi, zBild.getHeight() );
+    int xst = maxInt( dpx - x, 0 );
+    int yst = maxInt( dpy - y, 0 );
+    int xst2 = maxInt( x, dpx );
+    int yst2 = maxInt( y, dpy );
+    dgx = minInt( x + br, dgx );
+    dgy = minInt( y + hi, dgy );
+    int bb = zBild.getBreite();
+    int *ff = zBild.getBuffer();
+    if( !alpha[ alphaAnzahl ] )
+    {
+        int xx, ygr, ygr2;
+        if( alpha3D )
+        {
+            for( int yy = yst2; yy < dgy; ++yy )
+            {
+                ygr = yy * size.x;
+                ygr2 = ( yy - yst2 + yst ) * bb;
+                int fci = xst2 + ygr;
+                int ffi = xst + ygr2;
+                for( xx = xst2; xx < dgx; ++xx, ++fci, ++ffi )
+                    alphaPixelP3D( fc[ fci ], ff[ ffi ] );
+            }
+        }
+        else
+        {
+            for( int yy = yst2; yy < dgy; ++yy )
+            {
+                ygr = yy * size.x;
+                ygr2 = ( yy - yst2 + yst ) * bb;
+                int fci = xst2 + ygr;
+                int ffi = xst + ygr2;
+                for( xx = xst2; xx < dgx; ++xx, ++fci, ++ffi )
+                    alphaPixelP( fc[ fci ], ff[ ffi ] );
+            }
+        }
+    }
+    else
+    {
+        int xx, ygr, ygr2;
+        if( alpha3D )
+        {
+            for( int yy = yst2; yy < dgy; ++yy )
+            {
+                ygr = yy * size.x;
+                ygr2 = ( yy - yst2 + yst ) * bb;
+                for( xx = xst2; xx < dgx; ++xx )
+                {
+                    int fc = ff[ ( xx - xst2 + xst ) + ygr2 ];
+                    unsigned char *cf = (unsigned char*)&fc;
+                    cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
+                    alphaPixelP( this->fc[ xx + ygr ], fc );
+                }
+            }
+        }
+        else
+        {
+            for( int yy = yst2; yy < dgy; ++yy )
+            {
+                ygr = yy * size.x;
+                ygr2 = ( yy - yst2 + yst ) * bb;
+                for( xx = xst2; xx < dgx; ++xx )
+                {
+                    int fc = ff[ ( xx - xst2 + xst ) + ygr2 ];
+                    unsigned char *cf = (unsigned char*)&fc;
+                    cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
+                    alphaPixelP3D( this->fc[ xx + ygr ], fc );
+                }
             }
         }
     }
@@ -1364,25 +1591,54 @@ void Bild::alphaBild90( int x, int y, int br, int hi, Bild &zBild )
     if( !alpha[ alphaAnzahl ] )
     {
         int yy, xbb;
-        for( int xx = xst2; xx < dgx; ++xx )
+        if( alpha3D )
         {
-            xbb = ( zBild.getHeight() - ( xx - xst2 + xst + 1 ) ) * bb;
-            for( yy = yst2; yy < dgy; ++yy )
-                alphaPixelP( xx, yy, ff[ ( yy - yst2 + yst ) + xbb ] );
+            for( int xx = xst2; xx < dgx; ++xx )
+            {
+                xbb = ( zBild.getHeight() - ( xx - xst2 + xst + 1 ) ) * bb;
+                for( yy = yst2; yy < dgy; ++yy )
+                    alphaPixelP3D( xx, yy, ff[ ( yy - yst2 + yst ) + xbb ] );
+            }
+        }
+        else
+        {
+            for( int xx = xst2; xx < dgx; ++xx )
+            {
+                xbb = ( zBild.getHeight() - ( xx - xst2 + xst + 1 ) ) * bb;
+                for( yy = yst2; yy < dgy; ++yy )
+                    alphaPixelP( xx, yy, ff[ ( yy - yst2 + yst ) + xbb ] );
+            }
         }
     }
     else
     {
         int yy, xbb;
-        for( int xx = xst2; xx < dgx; ++xx )
+        if( alpha3D )
         {
-            xbb = ( zBild.getHeight() - ( xx - xst2 + xst + 1 ) ) * bb;
-            for( yy = yst2; yy < dgy; ++yy )
+            for( int xx = xst2; xx < dgx; ++xx )
             {
-                int fc = ff[ ( yy - yst2 + yst ) + xbb ];
-                unsigned char *cf = (unsigned char*)&fc;
-                cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
-                alphaPixelP( xx, yy, fc );
+                xbb = ( zBild.getHeight() - ( xx - xst2 + xst + 1 ) ) * bb;
+                for( yy = yst2; yy < dgy; ++yy )
+                {
+                    int fc = ff[ ( yy - yst2 + yst ) + xbb ];
+                    unsigned char *cf = (unsigned char*)&fc;
+                    cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
+                    alphaPixelP3D( xx, yy, fc );
+                }
+            }
+        }
+        else
+        {
+            for( int xx = xst2; xx < dgx; ++xx )
+            {
+                xbb = ( zBild.getHeight() - ( xx - xst2 + xst + 1 ) ) * bb;
+                for( yy = yst2; yy < dgy; ++yy )
+                {
+                    int fc = ff[ ( yy - yst2 + yst ) + xbb ];
+                    unsigned char *cf = (unsigned char*)&fc;
+                    cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
+                    alphaPixelP( xx, yy, fc );
+                }
             }
         }
     }
@@ -1452,27 +1708,58 @@ void Bild::alphaBild180( int x, int y, int br, int hi, Bild &zBild )
     if( !alpha[ alphaAnzahl ] )
     {
         int xx, ygr, ybb;
-        for( int yy = yst2; yy < dgy; ++yy )
+        if( alpha3D )
         {
-            ygr = yy * size.x;
-            ybb = ( zBild.getHeight() - ( yy - yst2 + yst + 1 ) ) * bb;
-            for( xx = xst2; xx < dgx; ++xx )
-                alphaPixelP( fc[ xx + ygr ], ff[ ( bb - ( xx - xst2 + xst + 1 ) ) + ybb ] );
+            for( int yy = yst2; yy < dgy; ++yy )
+            {
+                ygr = yy * size.x;
+                ybb = ( zBild.getHeight() - ( yy - yst2 + yst + 1 ) ) * bb;
+                for( xx = xst2; xx < dgx; ++xx )
+                    alphaPixelP3D( fc[ xx + ygr ], ff[ ( bb - ( xx - xst2 + xst + 1 ) ) + ybb ] );
+            }
+        }
+        else
+        {
+            for( int yy = yst2; yy < dgy; ++yy )
+            {
+                ygr = yy * size.x;
+                ybb = ( zBild.getHeight() - ( yy - yst2 + yst + 1 ) ) * bb;
+                for( xx = xst2; xx < dgx; ++xx )
+                    alphaPixelP( fc[ xx + ygr ], ff[ ( bb - ( xx - xst2 + xst + 1 ) ) + ybb ] );
+            }
         }
     }
     else
     {
         int xx, ygr, ybb;
-        for( int yy = yst2; yy < dgy; ++yy )
+        if( alpha3D )
         {
-            ygr = yy * size.x;
-            ybb = ( zBild.getHeight() - ( yy - yst2 + yst + 1 ) ) * bb;
-            for( xx = xst2; xx < dgx; ++xx )
+            for( int yy = yst2; yy < dgy; ++yy )
             {
-                int fc = ff[ ( bb - ( xx - xst2 + xst + 1 ) ) + ybb ];
-                unsigned char *cf = (unsigned char*)&fc;
-                cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
-                alphaPixelP( this->fc[ xx + ygr ], fc );
+                ygr = yy * size.x;
+                ybb = ( zBild.getHeight() - ( yy - yst2 + yst + 1 ) ) * bb;
+                for( xx = xst2; xx < dgx; ++xx )
+                {
+                    int fc = ff[ ( bb - ( xx - xst2 + xst + 1 ) ) + ybb ];
+                    unsigned char *cf = (unsigned char*)&fc;
+                    cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
+                    alphaPixelP3D( this->fc[ xx + ygr ], fc );
+                }
+            }
+        }
+        else
+        {
+            for( int yy = yst2; yy < dgy; ++yy )
+            {
+                ygr = yy * size.x;
+                ybb = ( zBild.getHeight() - ( yy - yst2 + yst + 1 ) ) * bb;
+                for( xx = xst2; xx < dgx; ++xx )
+                {
+                    int fc = ff[ ( bb - ( xx - xst2 + xst + 1 ) ) + ybb ];
+                    unsigned char *cf = (unsigned char*)&fc;
+                    cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
+                    alphaPixelP( this->fc[ xx + ygr ], fc );
+                }
             }
         }
     }
@@ -1541,25 +1828,54 @@ void Bild::alphaBild270( int x, int y, int br, int hi, Bild &zBild )
     if( !alpha[ alphaAnzahl ] )
     {
         int yy, xbb;
-        for( int xx = xst2; xx < dgx; ++xx )
+        if( alpha3D )
         {
-            xbb = ( xx - xst2 + xst ) * bb;
-            for( yy = yst2; yy < dgy; ++yy )
-                alphaPixelP( xx, yy, ff[ ( bb - ( yy - yst2 + yst + 1 ) ) + xbb ] );
+            for( int xx = xst2; xx < dgx; ++xx )
+            {
+                xbb = ( xx - xst2 + xst ) * bb;
+                for( yy = yst2; yy < dgy; ++yy )
+                    alphaPixelP3D( xx, yy, ff[ ( bb - ( yy - yst2 + yst + 1 ) ) + xbb ] );
+            }
+        }
+        else
+        {
+            for( int xx = xst2; xx < dgx; ++xx )
+            {
+                xbb = ( xx - xst2 + xst ) * bb;
+                for( yy = yst2; yy < dgy; ++yy )
+                    alphaPixelP( xx, yy, ff[ ( bb - ( yy - yst2 + yst + 1 ) ) + xbb ] );
+            }
         }
     }
     else
     {
         int yy, xbb;
-        for( int xx = xst2; xx < dgx; ++xx )
+        if( alpha3D )
         {
-            xbb = ( xx - xst2 + xst ) * bb;
-            for( yy = yst2; yy < dgy; ++yy )
+            for( int xx = xst2; xx < dgx; ++xx )
             {
-                int fc = ff[ ( bb - ( yy - yst2 + yst + 1 ) ) + xbb ];
-                unsigned char *cf = (unsigned char*)&fc;
-                cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
-                alphaPixelP( xx, yy, fc );
+                xbb = ( xx - xst2 + xst ) * bb;
+                for( yy = yst2; yy < dgy; ++yy )
+                {
+                    int fc = ff[ ( bb - ( yy - yst2 + yst + 1 ) ) + xbb ];
+                    unsigned char *cf = (unsigned char*)&fc;
+                    cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
+                    alphaPixelP3D( xx, yy, fc );
+                }
+            }
+        }
+        else
+        {
+            for( int xx = xst2; xx < dgx; ++xx )
+            {
+                xbb = ( xx - xst2 + xst ) * bb;
+                for( yy = yst2; yy < dgy; ++yy )
+                {
+                    int fc = ff[ ( bb - ( yy - yst2 + yst + 1 ) ) + xbb ];
+                    unsigned char *cf = (unsigned char*)&fc;
+                    cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
+                    alphaPixelP( xx, yy, fc );
+                }
             }
         }
     }
@@ -1629,16 +1945,34 @@ void Bild::alphaBildSkall( int x, int y, int br, int hi, Bild &zBild )
     int *ff = zBild.getBuffer();
     int xx, ygr, ygr2;
     double xb = 0;
-    for( int yy = yst2; yy < dgy; ++yy )
+    if( alpha3D )
     {
-        ygr = yy * size.x;
-        ygr2 = (int)( ( yy - yst2 + yst ) * yo ) * bb;
-        for( xx = xst2, xb = xst * xo; xx < dgx; ++xx, xb += xo )
+        for( int yy = yst2; yy < dgy; ++yy )
         {
-            int f = ff[ (int)xb + ygr2 ];
-            unsigned char *cf = (unsigned char*)&f;
-            cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
-            alphaPixelP( fc[ xx + ygr ], f );
+            ygr = yy * size.x;
+            ygr2 = (int)( ( yy - yst2 + yst ) * yo ) * bb;
+            for( xx = xst2, xb = xst * xo; xx < dgx; ++xx, xb += xo )
+            {
+                int f = ff[ (int)xb + ygr2 ];
+                unsigned char *cf = (unsigned char*)&f;
+                cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
+                alphaPixelP3D( fc[ xx + ygr ], f );
+            }
+        }
+    }
+    else
+    {
+        for( int yy = yst2; yy < dgy; ++yy )
+        {
+            ygr = yy * size.x;
+            ygr2 = (int)( ( yy - yst2 + yst ) * yo ) * bb;
+            for( xx = xst2, xb = xst * xo; xx < dgx; ++xx, xb += xo )
+            {
+                int f = ff[ (int)xb + ygr2 ];
+                unsigned char *cf = (unsigned char*)&f;
+                cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
+                alphaPixelP( fc[ xx + ygr ], f );
+            }
         }
     }
     rend = 1;
@@ -2069,7 +2403,7 @@ void Bild::replaceColorWithAlpha( int color )
         for( int x = dx + xx; x < bb; x++ )
         {
             unsigned char *cf = ( unsigned char* )&( fc[ x + ygr ] );
-            int abstand = (int)sqrt( (float)(( r - cf[ 2 ] ) * ( r - cf[ 2 ] ) + ( g - cf[ 1 ] ) * ( g - cf[ 1 ] ) + ( b - cf[ 0 ] ) * ( b - cf[ 0 ] )) );
+            int abstand = (int)sqrt( (float)( ( r - cf[ 2 ] ) * ( r - cf[ 2 ] ) + ( g - cf[ 1 ] ) * ( g - cf[ 1 ] ) + ( b - cf[ 0 ] ) * ( b - cf[ 0 ] ) ) );
             if( abstand > 255 )
                 abstand = 255;
             cf[ 3 ] = (unsigned char)( abstand );
@@ -2215,6 +2549,11 @@ const Punkt &Bild::getDrawOff() const
     return drawOff[ doa ];
 }
 
+bool Bild::hasAlpha3D()
+{
+    return alpha3D;
+}
+
 // Reference Counting 
 Bild *Bild::getThis()
 {

+ 22 - 4
Bild.h

@@ -35,7 +35,10 @@ namespace Framework
 
         // privat
         inline void alphaPixelP( int x, int y, int f );
+        inline void alphaPixelP3D( int x, int y, int f );
         inline void alphaPixelP( int &fc, int f );
+        inline void alphaPixelP3D( int &fc, int f );
+        inline void alphaPixelAssozP( int &fc, int f );
         inline char getOutCode( Punkt p ) const;
         void drawFlatDreieck( int y1, int y2, float m1, float b1, float m2, float b2, int farbe );
         void drawFlatDreieckTextur( int y1, int y2, double m1, double b1, double m2, double b2, double tx1, double ty1, double tx2, double ty2,
@@ -80,21 +83,25 @@ namespace Framework
         //  x: Die X Koordinate des Pixels
         //  y: Die Y Koordinate des Pixels
         //  f: Die Farbe in A8R8G8B8 Format, die geblendet werden soll
-        __declspec( dllexport ) void alphaPixel( int x, int y, int f );
+        __declspec( dllexport ) void alphaPixel2D( int x, int y, int f );
+        __declspec( dllexport ) void alphaPixel3D( int x, int y, int f );
         // Blendet mittels Alphablending eine Farbe auf einen bestimmten Pixel
         // Beachtet nicht die begrenzung der Zeichnenfläche und das Skroll Offset
         //  i: Der Index des Pixels im Pixel Array
         //  f: Die Farbe in A8R8G8B8 Format, die geblendet werden soll
-        __declspec( dllexport ) void alphaPixel( int i, int f );
+        __declspec( dllexport ) void alphaPixel2D( int i, int f );
+        __declspec( dllexport ) void alphaPixel3D( int i, int f );
         // Blendet mittels Alphablending eine Farbe auf einen bestimmten Pixel
         //  x: Die X Koordinate des Pixels
         //  y: Die Y Koordinate des Pixels
         //  f: Die Farbe in A8R8G8B8 Format, die geblendet werden soll
-        __declspec( dllexport ) void alphaPixelDP( int x, int y, int f );
+        __declspec( dllexport ) void alphaPixelDP2D( int x, int y, int f );
+        __declspec( dllexport ) void alphaPixelDP3D( int x, int y, int f );
         // Blendet mittels Alphablending eine Farbe auf einen bestimmten Pixel
         //  i: Der Index des Pixels im Pixel Array
         //  f: Die Farbe in A8R8G8B8 Format, die geblendet werden soll
-        __declspec( dllexport ) void alphaPixelDP( int i, int f );
+        __declspec( dllexport ) void alphaPixelDP2D( int i, int f );
+        __declspec( dllexport ) void alphaPixelDP3D( int i, int f );
         // Setzt die Farbe eines besimmten Pixels
         //  x: Die X Koordinate des Pixels
         //  y: Die Y Koordinate des Pixels
@@ -197,6 +204,13 @@ namespace Framework
         //  hi: Die Höhe des Rechecks in dem das Bild gezeichnet werden soll
         //  zBild: Das Bild, was gezeichnet werden soll
         __declspec( dllexport ) void alphaBild( int x, int y, int br, int hi, Bild &zBild );
+        // Zeichnet ein Bild in ein bestimmtes Feld ohne Skallierung mit alpha blending
+        //  x: Die X Koordinate der linken oberen Ecke des Rechtecks in dem das Bild gezeichnet werden soll
+        //  y: Die Y Koordinate der linken oberen Ecke des Rechtecks in dem das Bild gezeichnet werden soll
+        //  br: Die Breite des Rechecks in dem das Bild gezeichnet werden soll
+        //  hi: Die Höhe des Rechecks in dem das Bild gezeichnet werden soll
+        //  zBild: Das Bild, was gezeichnet werden soll
+        __declspec( dllexport ) void alphaBildAssoz( int x, int y, int br, int hi, Bild &zBild );
         // Zeichnet ein Bild um 90 grad nach rechts gedreht in ein bestimmtes Feld ohne Skallierung
         //  x: Die X Koordinate der linken oberen Ecke des Rechtecks in dem das Bild gezeichnet werden soll
         //  y: Die Y Koordinate der linken oberen Ecke des Rechtecks in dem das Bild gezeichnet werden soll
@@ -344,6 +358,10 @@ namespace Framework
         __declspec( dllexport ) const Punkt &getDrawGr() const;
         // Gibt die Koordinaten zurück, die zu allen Positionen vor dem Zeichnen hinzugefügt werden
         __declspec( dllexport ) const Punkt &getDrawOff() const;
+        // Wird dieser Flag gesetzt, so wird beim Alpha Blending wenn die vorheriege Farbe 0 ist nur die neue mit ihrem Alpha Wert kopiert.
+        // Das ist sinnvoll für die Verwendung im 3DBildschirm, wo das Gezeichnette Bild später mittels Alpha Blending angezeigt wird.
+        // Der Flag wird im 3DBildschirm automatisch gesetzt
+        __declspec( dllexport ) bool hasAlpha3D();
         // Erhöht den Reference Counting Zähler.
         //  return: this.
         __declspec( dllexport ) Bild *getThis();

+ 138 - 44
Schrift.cpp

@@ -640,27 +640,57 @@ void TextRenderer::renderChar( int &x, int y, char c, Bild &zRObj, bool selected
                     if( !a2 )
                     {
                         int xx, ygr = ( ys - 1 ) * b->getBreite(), ygr2 = ( yp + ys - 1 ) * zRObj.getBreite();
-                        for( int yy = ys; yy < h; ++yy )
+                        if( zRObj.hasAlpha3D() )
                         {
-                            ygr += b->getBreite();
-                            ygr2 += zRObj.getBreite();
-                            for( xx = xs; xx < br; ++xx )
-                                zRObj.alphaPixel( xp + xx + ygr2, f | ( b->getBuff()[ xx + ygr ] << 24 ) );
+                            for( int yy = ys; yy < h; ++yy )
+                            {
+                                ygr += b->getBreite();
+                                ygr2 += zRObj.getBreite();
+                                for( xx = xs; xx < br; ++xx )
+                                    zRObj.alphaPixel3D( xp + xx + ygr2, f | ( b->getBuff()[ xx + ygr ] << 24 ) );
+                            }
+                        }
+                        else
+                        {
+                            for( int yy = ys; yy < h; ++yy )
+                            {
+                                ygr += b->getBreite();
+                                ygr2 += zRObj.getBreite();
+                                for( xx = xs; xx < br; ++xx )
+                                    zRObj.alphaPixel2D( xp + xx + ygr2, f | ( b->getBuff()[ xx + ygr ] << 24 ) );
+                            }
                         }
                     }
                     else
                     {
                         int a;
                         int xx, ygr = ( ys - 1 ) * b->getBreite(), ygr2 = ( yp + ys - 1 ) * zRObj.getBreite();
-                        for( int yy = ys; yy < h; ++yy )
+                        if( zRObj.hasAlpha3D() )
                         {
-                            ygr += b->getBreite();
-                            ygr2 += zRObj.getBreite();
-                            for( xx = xs; xx < br; ++xx )
+                            for( int yy = ys; yy < h; ++yy )
                             {
-                                a = b->getBuff()[ xx + ygr ] - a2;
-                                if( a > 0 )
-                                    zRObj.alphaPixel( xp + xx + ygr2, f | ( a << 24 ) );
+                                ygr += b->getBreite();
+                                ygr2 += zRObj.getBreite();
+                                for( xx = xs; xx < br; ++xx )
+                                {
+                                    a = b->getBuff()[ xx + ygr ] - a2;
+                                    if( a > 0 )
+                                        zRObj.alphaPixel3D( xp + xx + ygr2, f | ( a << 24 ) );
+                                }
+                            }
+                        }
+                        else
+                        {
+                            for( int yy = ys; yy < h; ++yy )
+                            {
+                                ygr += b->getBreite();
+                                ygr2 += zRObj.getBreite();
+                                for( xx = xs; xx < br; ++xx )
+                                {
+                                    a = b->getBuff()[ xx + ygr ] - a2;
+                                    if( a > 0 )
+                                        zRObj.alphaPixel2D( xp + xx + ygr2, f | ( a << 24 ) );
+                                }
                             }
                         }
                     }
@@ -676,34 +706,71 @@ void TextRenderer::renderChar( int &x, int y, char c, Bild &zRObj, bool selected
                     if( !a2 )
                     {
                         int dx, ygr, ygr2;
-                        for( int dy = ys; dy < maxY; ++dy )
+                        if( zRObj.hasAlpha3D() )
                         {
-                            ygr2 = ( yp + dy ) * zRObj.getBreite();
-                            ygr = (int)y * br;
-                            for( dx = xs; dx < maxX; ++dx )
+                            for( int dy = ys; dy < maxY; ++dy )
                             {
-                                zRObj.alphaPixel( xp + dx + ygr2, f | ( b->getBuff()[ (int)x + ygr ] << 24 ) );
-                                x += xoff;
+                                ygr2 = ( yp + dy ) * zRObj.getBreite();
+                                ygr = (int)y * br;
+                                for( dx = xs; dx < maxX; ++dx )
+                                {
+                                    zRObj.alphaPixel3D( xp + dx + ygr2, f | ( b->getBuff()[ (int)x + ygr ] << 24 ) );
+                                    x += xoff;
+                                }
+                                x = xs;
+                                y += yoff;
+                            }
+                        }
+                        else
+                        {
+                            for( int dy = ys; dy < maxY; ++dy )
+                            {
+                                ygr2 = ( yp + dy ) * zRObj.getBreite();
+                                ygr = (int)y * br;
+                                for( dx = xs; dx < maxX; ++dx )
+                                {
+                                    zRObj.alphaPixel2D( xp + dx + ygr2, f | ( b->getBuff()[ (int)x + ygr ] << 24 ) );
+                                    x += xoff;
+                                }
+                                x = xs;
+                                y += yoff;
                             }
-                            x = xs;
-                            y += yoff;
                         }
                     }
                     else
                     {
                         int a, dx, ygr, ygr2;
-                        for( int dy = ys; dy < maxY; ++dy )
+                        if( zRObj.hasAlpha3D() )
                         {
-                            ygr2 = ( yp + dy ) * zRObj.getBreite();
-                            ygr = (int)y * br;
-                            for( dx = xs; dx < maxX; ++dx )
+                            for( int dy = ys; dy < maxY; ++dy )
                             {
-                                a = b->getBuff()[ (int)x + ygr ] - a2;
-                                zRObj.alphaPixel( xp + dx + ygr2, f | ( a << 24 ) );
-                                x += xoff;
+                                ygr2 = ( yp + dy ) * zRObj.getBreite();
+                                ygr = (int)y * br;
+                                for( dx = xs; dx < maxX; ++dx )
+                                {
+                                    a = b->getBuff()[ (int)x + ygr ] - a2;
+                                    zRObj.alphaPixel3D( xp + dx + ygr2, f | ( a << 24 ) );
+                                    x += xoff;
+                                }
+                                x = xs;
+                                y += yoff;
+                            }
+                        }
+                        else
+                        {
+                            for( int dy = ys; dy < maxY; ++dy )
+                            {
+                                ygr2 = ( yp + dy ) * zRObj.getBreite();
+                                ygr = (int)y * br;
+                                for( dx = xs; dx < maxX; ++dx )
+                                {
+                                    a = b->getBuff()[ (int)x + ygr ] - a2;
+                                    zRObj.alphaPixel2D( xp + dx + ygr2, f | ( a << 24 ) );
+                                    x += xoff;
+                                }
+                                x = xs;
+                                y += yoff;
                             }
-                            x = xs;
-                            y += yoff;
                         }
                     }
                 }
@@ -912,26 +979,53 @@ void GravurTextRenderer::renderChar( int &x, int y, char c, Bild &zRObj, bool se
                 maxX = ( xp + maxX ) >= zRObjGr.x ? ( zRObjGr.x - xp ) : maxX;
                 maxY = ( yp + maxY ) >= zRObjGr.y ? ( zRObjGr.y - yp ) : maxY;
                 int dx, ygr, ygr2;
-                for( int dy = ys; dy < maxY; ++dy )
+                if( zRObj.hasAlpha3D() )
+                {
+                    for( int dy = ys; dy < maxY; ++dy )
+                    {
+                        ygr2 = ( yp + dy ) * zRObj.getBreite();
+                        ygr = (int)y * br;
+                        for( dx = xs; dx < maxX; ++dx )
+                        {
+                            int f = 0;
+                            if( b->getBuff()[ (int)x + ygr ] )
+                                f = 0x20000000;
+                            else if( ( (int)( x + xoff ) < br && b->getBuff()[ (int)( x + xoff ) + ygr ] ) || ( (int)( y - yoff ) < h && b->getBuff()[ (int)x + (int)( y - yoff ) * br ] > 0xF0 ) )
+                                f = 0x70000000;
+                            else if( ( (int)( x - xoff ) < br && b->getBuff()[ (int)( x - xoff ) + ygr ] ) || ( (int)( y + yoff ) < h && b->getBuff()[ (int)x + (int)( y + yoff ) * br ] > 0xF0 ) )
+                            {
+                                f = 0x70FFFFFF;
+                            }
+                            zRObj.alphaPixel3D( xp + dx + ygr2, f );
+                            x += xoff;
+                        }
+                        x = xs;
+                        y += yoff;
+                    }
+                }
+                else
                 {
-                    ygr2 = ( yp + dy ) * zRObj.getBreite();
-                    ygr = (int)y * br;
-                    for( dx = xs; dx < maxX; ++dx )
+                    for( int dy = ys; dy < maxY; ++dy )
                     {
-                        int f = 0;
-                        if( b->getBuff()[ (int)x + ygr ] )
-                            f = 0x20000000;
-                        else if( ( (int)( x + xoff ) < br && b->getBuff()[ (int)( x + xoff ) + ygr ] ) || ( (int)( y - yoff ) < h && b->getBuff()[ (int)x + (int)( y - yoff ) * br ] > 0xF0 ) )
-                            f = 0x70000000;
-                        else if( ( (int)( x - xoff ) < br && b->getBuff()[ (int)( x - xoff ) + ygr ] ) || ( (int)( y + yoff ) < h && b->getBuff()[ (int)x + (int)( y + yoff ) * br ] > 0xF0 ) )
+                        ygr2 = ( yp + dy ) * zRObj.getBreite();
+                        ygr = (int)y * br;
+                        for( dx = xs; dx < maxX; ++dx )
                         {
-                            f = 0x70FFFFFF;
+                            int f = 0;
+                            if( b->getBuff()[ (int)x + ygr ] )
+                                f = 0x20000000;
+                            else if( ( (int)( x + xoff ) < br && b->getBuff()[ (int)( x + xoff ) + ygr ] ) || ( (int)( y - yoff ) < h && b->getBuff()[ (int)x + (int)( y - yoff ) * br ] > 0xF0 ) )
+                                f = 0x70000000;
+                            else if( ( (int)( x - xoff ) < br && b->getBuff()[ (int)( x - xoff ) + ygr ] ) || ( (int)( y + yoff ) < h && b->getBuff()[ (int)x + (int)( y + yoff ) * br ] > 0xF0 ) )
+                            {
+                                f = 0x70FFFFFF;
+                            }
+                            zRObj.alphaPixel2D( xp + dx + ygr2, f );
+                            x += xoff;
                         }
-                        zRObj.alphaPixel( xp + dx + ygr2, f );
-                        x += xoff;
+                        x = xs;
+                        y += yoff;
                     }
-                    x = xs;
-                    y += yoff;
                 }
             }
         }

+ 12 - 0
Trie.h

@@ -167,6 +167,18 @@ namespace Framework
             }
         }
 
+        void remove( const char *addr )
+        {
+            if( !*addr )
+                map->setValue( 0 );
+            else
+            {
+                if( !map->z( *addr ) )
+                    return;
+                map->z( *addr )->remove( addr + 1 );
+            }
+        }
+
         T *get( const char *addr )
         {
             if( !*addr )

+ 9 - 0
UIMLView.cpp

@@ -474,6 +474,15 @@ Text UIMLView::addMember( Text uiml, Text parentId )
     return "";
 }
 
+// entfernt ein element
+//  id: id des Elements
+void UIMLView::removeMember( Text id )
+{
+    XML::Editor e = dom->selectChildsByAttribute( "id", id );
+    e.remove();
+    members->remove( id );
+}
+
 // Verarbeitet ein Maus Ereignis. Wird vom Framework automatisch aufgerufen.
 //  me: Das Ereignis
 void UIMLView::doMausEreignis( MausEreignis &me )

+ 3 - 0
UIMLView.h

@@ -112,6 +112,9 @@ namespace Framework
         //  uiml: Ein xml text gemät des KSG UIML standarts, welcher das neue Objekt darstellt
         //  return: id des neuen Elements
         __declspec( dllexport ) Text addMember( Text uiml, Text parentId );
+        // entfernt ein element
+        //  id: id des Elements
+        __declspec( dllexport ) void removeMember( Text id );
         // Gibt eine zeichnung zurück, welche in uiml eine bestimmte id hat
         //  id: die id der Zeichnung
         __declspec( dllexport ) Zeichnung *zZeichnung( Text id );