Beispiel #1
0
bool FileFormatInstance::WriteRGBWS( const RGBColorSystem& rgbws )
{
   try
   {
      if ( (*API->FileFormat->BeginRGBWSEmbedding)( handle ) == api_false )
         return false;

      float gamma = rgbws.Gamma();
      api_bool issRGB = rgbws.IsSRGB();
      FVector x = rgbws.ChromaticityXCoordinates();
      FVector y = rgbws.ChromaticityYCoordinates();
      FVector Y = rgbws.LuminanceCoefficients();

      bool ok = (*API->FileFormat->SetImageRGBWS)( handle, gamma, issRGB, x.Begin(), y.Begin(), Y.Begin() ) != api_false;

      if ( rgbws.Gamma() != gamma ||
           rgbws.IsSRGB() != (issRGB != api_false) ||
           rgbws.ChromaticityXCoordinates() != x ||
           rgbws.ChromaticityYCoordinates() != y ||
           rgbws.LuminanceCoefficients() != Y )
      {
         APIHackingAttempt( "WriteRGBWS" );
      }

      (*API->FileFormat->EndRGBWSEmbedding)( handle );

      return ok;
   }
   catch ( ... )
   {
      (*API->FileFormat->EndRGBWSEmbedding)( handle );
      throw;
   }
}
Beispiel #2
0
bool FileFormatInstance::ReadRGBWS( RGBColorSystem& rgbws )
{
   try
   {
      rgbws = RGBColorSystem();

      if ( (*API->FileFormat->BeginRGBWSExtraction)( handle ) == api_false )
         return false;

      float gamma = rgbws.Gamma();
      api_bool issRGB = rgbws.IsSRGB();
      FVector x = rgbws.ChromaticityXCoordinates();
      FVector y = rgbws.ChromaticityYCoordinates();
      FVector Y = rgbws.LuminanceCoefficients();

      bool ok = (*API->FileFormat->GetImageRGBWS)( handle, &gamma, &issRGB, x.Begin(), y.Begin(), Y.Begin() ) != api_false;
      if ( ok )
         rgbws = RGBColorSystem( gamma, issRGB, x, y, Y );

      (*API->FileFormat->EndRGBWSExtraction)( handle );
      return ok;
   }
   catch ( ... )
   {
      (*API->FileFormat->EndRGBWSExtraction)( handle );
      throw;
   }
}
RGBWorkingSpaceInstance::RGBWorkingSpaceInstance( const MetaProcess* P, const RGBColorSystem& rgbws ) :
ProcessImplementation( P ),
Y( rgbws.LuminanceCoefficients() ),
x( rgbws.ChromaticityXCoordinates() ),
y( rgbws.ChromaticityYCoordinates() ),
gamma( rgbws.Gamma() ),
sRGB( rgbws.IsSRGB() ),
applyGlobalRGBWS( false )
{
}