|
@@ -7,7 +7,6 @@
|
|
|
|
|
|
#endif
|
|
#endif
|
|
#include "Bild.h"
|
|
#include "Bild.h"
|
|
-#ifdef WIN32
|
|
|
|
#include "DateiSystem.h"
|
|
#include "DateiSystem.h"
|
|
#include "Scroll.h"
|
|
#include "Scroll.h"
|
|
#include "Rahmen.h"
|
|
#include "Rahmen.h"
|
|
@@ -16,7 +15,7 @@
|
|
#include "ToolTip.h"
|
|
#include "ToolTip.h"
|
|
#include "Text.h"
|
|
#include "Text.h"
|
|
#include "AlphaFeld.h"
|
|
#include "AlphaFeld.h"
|
|
-#else
|
|
|
|
|
|
+#ifndef WIN32
|
|
#include <math.h>
|
|
#include <math.h>
|
|
#include <stdlib.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <string.h>
|
|
@@ -670,6 +669,237 @@ void Bild::drawLinieVAlpha( int x, int y, int len, int f ) // zeichnet eine vert
|
|
rend = 1;
|
|
rend = 1;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void Bild::drawLinieBordered( Punkt a, Punkt b, int bc, int fc )
|
|
|
|
+{
|
|
|
|
+ if( alpha[ alphaAnzahl ] == 0xFF )
|
|
|
|
+ return;
|
|
|
|
+ if( alpha[ alphaAnzahl ] )
|
|
|
|
+ {
|
|
|
|
+ drawLinieBorderedAlpha( a, b, bc, fc );
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ a += drawOff[ doa ];
|
|
|
|
+ b += drawOff[ doa ];
|
|
|
|
+ char outCode1 = getOutCode( a );
|
|
|
|
+ char outCode2 = getOutCode( b );
|
|
|
|
+ bool ok = 0;
|
|
|
|
+ while( 1 )
|
|
|
|
+ {
|
|
|
|
+ int xMax = dSizeA[ doa ].x - 1;
|
|
|
|
+ int yMax = dSizeA[ doa ].y - 1;
|
|
|
|
+ if( !( outCode1 | outCode2 ) )
|
|
|
|
+ {
|
|
|
|
+ ok = 1;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ else if( outCode1 & outCode2 )
|
|
|
|
+ break;
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ int x = 0, y = 0;
|
|
|
|
+ char outCodeOut = outCode1 ? outCode1 : outCode2;
|
|
|
|
+ if( outCodeOut & 8 )
|
|
|
|
+ {
|
|
|
|
+ x = (int)( a.x + ( b.x - a.x ) * ( yMax - a.y ) / ( b.y - a.y ) + 0.5 );
|
|
|
|
+ y = yMax;
|
|
|
|
+ }
|
|
|
|
+ else if( outCodeOut & 4 )
|
|
|
|
+ {
|
|
|
|
+ x = (int)( a.x + ( b.x - a.x ) * ( dPosA[ doa ].y - a.y ) / ( b.y - a.y ) + 0.5 );
|
|
|
|
+ y = dPosA[ doa ].y;
|
|
|
|
+ }
|
|
|
|
+ else if( outCodeOut & 2 )
|
|
|
|
+ {
|
|
|
|
+ y = (int)( a.y + ( b.y - a.y ) * ( xMax - a.x ) / ( b.x - a.x ) + 0.5 );
|
|
|
|
+ x = xMax;
|
|
|
|
+ }
|
|
|
|
+ else if( outCodeOut & 1 )
|
|
|
|
+ {
|
|
|
|
+ y = (int)( a.y + ( b.y - a.y ) * ( dPosA[ doa ].x - a.x ) / ( b.x - a.x ) + 0.5 );
|
|
|
|
+ x = dPosA[ doa ].x;
|
|
|
|
+ }
|
|
|
|
+ if( outCodeOut == outCode1 )
|
|
|
|
+ {
|
|
|
|
+ a.x = x;
|
|
|
|
+ a.y = y;
|
|
|
|
+ outCode1 = getOutCode( a );
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ b.x = x;
|
|
|
|
+ b.y = y;
|
|
|
|
+ outCode2 = getOutCode( b );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if( ok )
|
|
|
|
+ {
|
|
|
|
+ int xlen = b.x - a.x, axlen = abs( xlen );
|
|
|
|
+ int ylen = b.y - a.y, aylen = abs( ylen );
|
|
|
|
+ double xf = (double)xlen / ( aylen ? aylen : 1 );
|
|
|
|
+ double yf = (double)ylen / ( axlen ? axlen : 1 );
|
|
|
|
+ if( axlen > aylen )
|
|
|
|
+ xf = xf < 0 ? -1 : 1;
|
|
|
|
+ else
|
|
|
|
+ yf = yf < 0 ? -1 : 1;
|
|
|
|
+ double x = (double)a.x, y = (double)a.y;
|
|
|
|
+ int maxP = (int)( sqrt( 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 )
|
|
|
|
+ {
|
|
|
|
+ ++count;
|
|
|
|
+ this->fc[ (int)( (int)( x + 0.5 ) + (int)( y + 0.5 ) * size.x ) ] = fc;
|
|
|
|
+ if( (int)( (int)( x - 0.5 ) + (int)( y + 0.5 ) * size.x ) < maxPixel &&
|
|
|
|
+ this->fc[ (int)( (int)( x - 0.5 ) + (int)( y + 0.5 ) * size.x ) ] != fc )
|
|
|
|
+ this->fc[ (int)( (int)( x - 0.5 ) + (int)( y + 0.5 ) * size.x ) ] = bc;
|
|
|
|
+ if( (int)( (int)( x + 1.5 ) + (int)( y + 0.5 ) * size.x ) < maxPixel &&
|
|
|
|
+ this->fc[ (int)( (int)( x + 1.5 ) + (int)( y + 0.5 ) * size.x ) ] != fc )
|
|
|
|
+ this->fc[ (int)( (int)( x + 1.5 ) + (int)( y + 0.5 ) * size.x ) ] = bc;
|
|
|
|
+ if( (int)( (int)( x + 0.5 ) + (int)( y - 0.5 ) * size.x ) < maxPixel &&
|
|
|
|
+ this->fc[ (int)( (int)( x + 0.5 ) + (int)( y - 0.5 ) * size.x ) ] != fc )
|
|
|
|
+ this->fc[ (int)( (int)( x + 0.5 ) + (int)( y - 0.5 ) * size.x ) ] = bc;
|
|
|
|
+ if( (int)( (int)( x + 0.5 ) + (int)( y + 1.5 ) * size.x ) < maxPixel &&
|
|
|
|
+ this->fc[ (int)( (int)( x + 0.5 ) + (int)( y + 1.5 ) * size.x ) ] != fc )
|
|
|
|
+ this->fc[ (int)( (int)( x + 0.5 ) + (int)( y + 1.5 ) * size.x ) ] = bc;
|
|
|
|
+ x += xf, y += yf;
|
|
|
|
+ }
|
|
|
|
+ rend = 1;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void Bild::drawLinieBorderedAlpha( Punkt a, Punkt b, int bc, int fc )
|
|
|
|
+{
|
|
|
|
+ if( alpha[ alphaAnzahl ] == 0xFF )
|
|
|
|
+ return;
|
|
|
|
+ a += drawOff[ doa ];
|
|
|
|
+ b += drawOff[ doa ];
|
|
|
|
+ char outCode1 = getOutCode( a );
|
|
|
|
+ char outCode2 = getOutCode( b );
|
|
|
|
+ bool ok = 0;
|
|
|
|
+ while( 1 )
|
|
|
|
+ {
|
|
|
|
+ int xMax = dSizeA[ doa ].x - 1;
|
|
|
|
+ int yMax = dSizeA[ doa ].y - 1;
|
|
|
|
+ if( !( outCode1 | outCode2 ) )
|
|
|
|
+ {
|
|
|
|
+ ok = 1;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ else if( outCode1 & outCode2 )
|
|
|
|
+ break;
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ int x = 0, y = 0;
|
|
|
|
+ char outCodeOut = outCode1 ? outCode1 : outCode2;
|
|
|
|
+ if( outCodeOut & 8 )
|
|
|
|
+ {
|
|
|
|
+ x = (int)( a.x + ( b.x - a.x ) * ( yMax - a.y ) / ( b.y - a.y ) + 0.5 );
|
|
|
|
+ y = yMax;
|
|
|
|
+ }
|
|
|
|
+ else if( outCodeOut & 4 )
|
|
|
|
+ {
|
|
|
|
+ x = (int)( a.x + ( b.x - a.x ) * ( dPosA[ doa ].y - a.y ) / ( b.y - a.y ) + 0.5 );
|
|
|
|
+ y = dPosA[ doa ].y;
|
|
|
|
+ }
|
|
|
|
+ else if( outCodeOut & 2 )
|
|
|
|
+ {
|
|
|
|
+ y = (int)( a.y + ( b.y - a.y ) * ( xMax - a.x ) / ( b.x - a.x ) + 0.5 );
|
|
|
|
+ x = xMax;
|
|
|
|
+ }
|
|
|
|
+ else if( outCodeOut & 1 )
|
|
|
|
+ {
|
|
|
|
+ y = (int)( a.y + ( b.y - a.y ) * ( dPosA[ doa ].x - a.x ) / ( b.x - a.x ) + 0.5 );
|
|
|
|
+ x = dPosA[ doa ].x;
|
|
|
|
+ }
|
|
|
|
+ if( outCodeOut == outCode1 )
|
|
|
|
+ {
|
|
|
|
+ a.x = x;
|
|
|
|
+ a.y = y;
|
|
|
|
+ outCode1 = getOutCode( a );
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ b.x = x;
|
|
|
|
+ b.y = y;
|
|
|
|
+ outCode2 = getOutCode( b );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if( ok )
|
|
|
|
+ {
|
|
|
|
+ int xlen = b.x - a.x, axlen = abs( xlen );
|
|
|
|
+ int ylen = b.y - a.y, aylen = abs( ylen );
|
|
|
|
+ double xf = (double)xlen / ( aylen ? aylen : 1 );
|
|
|
|
+ double yf = (double)ylen / ( axlen ? axlen : 1 );
|
|
|
|
+ if( axlen > aylen )
|
|
|
|
+ xf = xf < 0 ? -1 : 1;
|
|
|
|
+ else
|
|
|
|
+ yf = yf < 0 ? -1 : 1;
|
|
|
|
+ double x = (double)a.x, y = (double)a.y;
|
|
|
|
+ if( alpha[ alphaAnzahl ] )
|
|
|
|
+ {
|
|
|
|
+ unsigned char *cf = (unsigned char*)&fc;
|
|
|
|
+ cf[ 3 ] = (unsigned char)( ( cf[ 3 ] > alpha[ alphaAnzahl ] ) * ( cf[ 3 ] - alpha[ alphaAnzahl ] ) );
|
|
|
|
+ }
|
|
|
|
+ int maxP = (int)( sqrt( xlen * xlen + ylen * ylen ) + 0.5 );
|
|
|
|
+ int alpha = ( ( fc >> 24 ) & 0xFF );
|
|
|
|
+ int alpha2 = ( ( bc >> 24 ) & 0xFF );
|
|
|
|
+ int na = ( 0x100 - alpha );
|
|
|
|
+ int na2 = ( 0x100 - alpha2 );
|
|
|
|
+ int i1 = ( alpha * ( fc & 0xFF00FF ) ) >> 8;
|
|
|
|
+ int i2 = ( alpha * ( fc & 0x00FF00 ) ) >> 8;
|
|
|
|
+ int j1 = ( alpha2 * ( bc & 0xFF00FF ) ) >> 8;
|
|
|
|
+ int j2 = ( alpha2 * ( bc & 0x00FF00 ) ) >> 8;
|
|
|
|
+ int count = 0;
|
|
|
|
+ int maxPixel = size.x * size.y;
|
|
|
|
+ while( !( (int)( x + 0.5 ) == b.x && (int)( y + 0.5 ) == b.y ) && count < maxP )
|
|
|
|
+ {
|
|
|
|
+ ++count;
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+ x += xf, y += yf;
|
|
|
|
+ }
|
|
|
|
+ count = 0;
|
|
|
|
+ while( !( (int)( x + 0.5 ) == b.x && (int)( y + 0.5 ) == b.y ) && count < maxP )
|
|
|
|
+ {
|
|
|
|
+ ++count;
|
|
|
|
+ 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;
|
|
|
|
+ x += xf, y += yf;
|
|
|
|
+ }
|
|
|
|
+ rend = 1;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
void Bild::drawLinie( Punkt a, Punkt b, int fc ) // zeichnet eine Linie von Punkt( x1, y1 ) nach Punke( x2, y2 )
|
|
void Bild::drawLinie( Punkt a, Punkt b, int fc ) // zeichnet eine Linie von Punkt( x1, y1 ) nach Punke( x2, y2 )
|
|
{
|
|
{
|
|
if( alpha[ alphaAnzahl ] == 0xFF )
|
|
if( alpha[ alphaAnzahl ] == 0xFF )
|
|
@@ -1838,7 +2068,7 @@ void Bild::replaceColorWithAlpha( int color )
|
|
int ygr = y * size.x;
|
|
int ygr = y * size.x;
|
|
for( int x = dx + xx; x < bb; x++ )
|
|
for( int x = dx + xx; x < bb; x++ )
|
|
{
|
|
{
|
|
- unsigned char *cf = (unsigned char*)&(fc[ x + ygr ]);
|
|
|
|
|
|
+ unsigned char *cf = ( unsigned char* )&( fc[ x + ygr ] );
|
|
int abstand = (int)sqrt( ( r - cf[ 2 ] ) * ( r - cf[ 2 ] ) + ( g - cf[ 1 ] ) * ( g - cf[ 1 ] ) + ( b - cf[ 0 ] ) * ( b - cf[ 0 ] ) );
|
|
int abstand = (int)sqrt( ( r - cf[ 2 ] ) * ( r - cf[ 2 ] ) + ( g - cf[ 1 ] ) * ( g - cf[ 1 ] ) + ( b - cf[ 0 ] ) * ( b - cf[ 0 ] ) );
|
|
if( abstand > 255 )
|
|
if( abstand > 255 )
|
|
abstand = 255;
|
|
abstand = 255;
|
|
@@ -2001,7 +2231,6 @@ Bild *Bild::release()
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-#ifdef WIN32
|
|
|
|
// Inhalt der BildZ Klasse aus Bild.h
|
|
// Inhalt der BildZ Klasse aus Bild.h
|
|
// Konstruktor
|
|
// Konstruktor
|
|
BildZ::BildZ()
|
|
BildZ::BildZ()
|
|
@@ -2056,7 +2285,7 @@ void BildZ::setBild( Bild *b )
|
|
|
|
|
|
bool BildZ::tick( double tickVal ) // tick
|
|
bool BildZ::tick( double tickVal ) // tick
|
|
{
|
|
{
|
|
- return __super::tick( tickVal );
|
|
|
|
|
|
+ return ZeichnungHintergrund::tick( tickVal );
|
|
}
|
|
}
|
|
|
|
|
|
void BildZ::doMausEreignis( MausEreignis &me ) // ruft Mak auf
|
|
void BildZ::doMausEreignis( MausEreignis &me ) // ruft Mak auf
|
|
@@ -2125,7 +2354,7 @@ void BildZ::render( Bild &zRObj ) // zeichnet nach zRObj
|
|
{
|
|
{
|
|
if( hatStyle( Style::Sichtbar ) )
|
|
if( hatStyle( Style::Sichtbar ) )
|
|
{
|
|
{
|
|
- __super::render( zRObj );
|
|
|
|
|
|
+ ZeichnungHintergrund::render( zRObj );
|
|
lockZeichnung();
|
|
lockZeichnung();
|
|
if( !zRObj.setDrawOptions( innenPosition, innenSize ) )
|
|
if( !zRObj.setDrawOptions( innenPosition, innenSize ) )
|
|
{
|
|
{
|
|
@@ -2137,17 +2366,17 @@ void BildZ::render( Bild &zRObj ) // zeichnet nach zRObj
|
|
int x = 0;
|
|
int x = 0;
|
|
int y = 0;
|
|
int y = 0;
|
|
int br = innenSize.x;
|
|
int br = innenSize.x;
|
|
- int hö = innenSize.y;
|
|
|
|
|
|
+ int hi = innenSize.y;
|
|
if( !( vertikalScrollBar && hatStyle( Style::VScroll ) ) && !( horizontalScrollBar && hatStyle( Style::HScroll ) ) )
|
|
if( !( vertikalScrollBar && hatStyle( Style::VScroll ) ) && !( horizontalScrollBar && hatStyle( Style::HScroll ) ) )
|
|
{
|
|
{
|
|
if( hatStyle( Style::Alpha ) )
|
|
if( hatStyle( Style::Alpha ) )
|
|
- zRObj.alphaBild( x, y, br, hö, *bild );
|
|
|
|
|
|
+ zRObj.alphaBild( x, y, br, hi, *bild );
|
|
else
|
|
else
|
|
- zRObj.drawBild( x, y, br, hö, *bild );
|
|
|
|
|
|
+ zRObj.drawBild( x, y, br, hi, *bild );
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- if( !zRObj.setDrawOptions( x, y, br, hö ) )
|
|
|
|
|
|
+ if( !zRObj.setDrawOptions( x, y, br, hi ) )
|
|
{
|
|
{
|
|
zRObj.releaseDrawOptions();
|
|
zRObj.releaseDrawOptions();
|
|
unlockZeichnung();
|
|
unlockZeichnung();
|
|
@@ -2218,7 +2447,7 @@ BildZ *BildZ::release()
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+#ifdef WIN32
|
|
Bild *Framework::ladeBild( char *pfad, Text *zError )
|
|
Bild *Framework::ladeBild( char *pfad, Text *zError )
|
|
{
|
|
{
|
|
Text p = pfad;
|
|
Text p = pfad;
|