gradienttools.cxx (07540651) | gradienttools.cxx (7024eca9) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 348 unchanged lines hidden (view full) --- 357 fAngle, 358 false); 359 } 360 361 double getLinearGradientAlpha(const B2DPoint& rUV, const ODFGradientInfo& rGradInfo) 362 { 363 const B2DPoint aCoor(rGradInfo.getBackTextureTransform() * rUV); 364 | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 348 unchanged lines hidden (view full) --- 357 fAngle, 358 false); 359 } 360 361 double getLinearGradientAlpha(const B2DPoint& rUV, const ODFGradientInfo& rGradInfo) 362 { 363 const B2DPoint aCoor(rGradInfo.getBackTextureTransform() * rUV); 364 |
365 if(aCoor.getX() < 0.0 || aCoor.getX() > 1.0) 366 { 367 return 0.0; 368 } | 365 // Ignore Y, this is not needed at all for Y-Oriented gradients 366 // if(aCoor.getX() < 0.0 || aCoor.getX() > 1.0) 367 // { 368 // return 0.0; 369 // } |
369 370 if(aCoor.getY() <= 0.0) 371 { | 370 371 if(aCoor.getY() <= 0.0) 372 { |
372 return 0.0; | 373 return 0.0; // start value for inside |
373 } 374 375 if(aCoor.getY() >= 1.0) 376 { | 374 } 375 376 if(aCoor.getY() >= 1.0) 377 { |
377 return 1.0; | 378 return 1.0; // end value for outside |
378 } 379 380 const sal_uInt32 nSteps(rGradInfo.getSteps()); 381 382 if(nSteps) 383 { 384 return floor(aCoor.getY() * nSteps) / double(nSteps - 1); 385 } 386 387 return aCoor.getY(); 388 } 389 390 double getAxialGradientAlpha(const B2DPoint& rUV, const ODFGradientInfo& rGradInfo) 391 { 392 const B2DPoint aCoor(rGradInfo.getBackTextureTransform() * rUV); 393 | 379 } 380 381 const sal_uInt32 nSteps(rGradInfo.getSteps()); 382 383 if(nSteps) 384 { 385 return floor(aCoor.getY() * nSteps) / double(nSteps - 1); 386 } 387 388 return aCoor.getY(); 389 } 390 391 double getAxialGradientAlpha(const B2DPoint& rUV, const ODFGradientInfo& rGradInfo) 392 { 393 const B2DPoint aCoor(rGradInfo.getBackTextureTransform() * rUV); 394 |
394 if(aCoor.getX() < 0.0 || aCoor.getX() > 1.0) 395 { 396 return 0.0; 397 } | 395 // Ignore Y, this is not needed at all for Y-Oriented gradients 396 //if(aCoor.getX() < 0.0 || aCoor.getX() > 1.0) 397 //{ 398 // return 0.0; 399 //} |
398 399 const double fAbsY(fabs(aCoor.getY())); 400 401 if(fAbsY >= 1.0) 402 { | 400 401 const double fAbsY(fabs(aCoor.getY())); 402 403 if(fAbsY >= 1.0) 404 { |
403 return 0.0; | 405 return 1.0; // use end value when outside in Y |
404 } 405 406 const sal_uInt32 nSteps(rGradInfo.getSteps()); 407 408 if(nSteps) 409 { 410 return floor(fAbsY * nSteps) / double(nSteps - 1); 411 } --- 65 unchanged lines hidden --- | 406 } 407 408 const sal_uInt32 nSteps(rGradInfo.getSteps()); 409 410 if(nSteps) 411 { 412 return floor(fAbsY * nSteps) / double(nSteps - 1); 413 } --- 65 unchanged lines hidden --- |