Wrong direction in gradient format (1671)

Hi, i get wrong visual representation fo gradient format in saved file even tho i set the same values as in original file, am thinking that here is a problem when i read gradientDirection, you can see the picture and code below.
pic: gradient.PNG (10.7 KB)
file: FillEffect.pptx.zip (20.7 KB)

String path = "FillEffect.pptx";

Presentation presentation = new Presentation(path);
ISlide slide = presentation.getSlides().get_Item(0);
AutoShape shape = (AutoShape) slide.getShapes().get_Item(0);
IParagraph paragraph = shape.getTextFrame().getParagraphs().get_Item(0);
IPortionCollection portions = paragraph.getPortions();
IPortion portion = portions.get_Item(0);

IGradientFormatEffectiveData gradientFormat = portion.createPortionFormatEffective().getFillFormat()
	.getGradientFormat();
int direction = gradientFormat.getGradientDirection();
byte gradientShape = gradientFormat.getGradientShape();
IGradientStopCollectionEffectiveData stops = gradientFormat.getGradientStops();

Portion newPortion = new Portion("Text2");
IFillFormat fillFormat = newPortion.getPortionFormat().getFillFormat();
fillFormat.setFillType(FillType.Gradient);
IGradientFormat newPortionGradient = fillFormat.getGradientFormat();
newPortionGradient.setGradientDirection(direction);
newPortionGradient.setGradientShape(gradientShape);
newPortionGradient.getGradientStops().add(stops.get_Item(0).getPosition(), stops.get_Item(0).getColor());
newPortionGradient.getGradientStops().add(stops.get_Item(1).getPosition(), stops.get_Item(1).getColor());


portions.clear();
portions.add(newPortion);
presentation.save("saved.pptx", SaveFormat.Pptx);

can you please check this out?
Thanks,
Zeljko.

@Zeljko,

I have worked with presentation file shared by you and have been able to observe the issue specified. An issue with ID SLIDESJAVA-37007 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

Thank you @mudassir.fayyaz

Can you please help me figure out what direction correspond to what enum? Check the picture
picture: direction.png (8.7 KB)

|FromCenter|
|FromCorner1|
|FromCorner2|
|FromCorner3|
|FromCorner4|

From center is clear, but can you tell me what corners are 1 2 3 4?

Thanks,
Zeljko.

@Zeljko,

I suggest you to please try using below sample code with attached presentation for better elaboration of Gradient direction types.

public static void GetGradientDirections()
{
 String path="C:\\Aspose Data\\";
 
 Presentation pres=new Presentation(path+"Test Gradient Directions.pptx");
 ISlide slide=pres.getSlides().get_Item(0);
 
 for(int i=0;i<slide.getShapes().size();i++)
 {
     
  IAutoShape ashp=(IAutoShape)  slide.getShapes().get_Item(i);
  
  System.out.println("Shape Text: "+ashp.getTextFrame().getText());
        
  if(ashp.getFillFormat().getFillType()==FillType.Gradient)
  {
      
   System.out.println("Shape Gradient Direction: "+ashp.getFillFormat().getGradientFormat().getGradientDirection());
      
  }
     
 }
}

The following output shall be obtained:

Shape Text: From Bottom Right Corner
Shape Gradient Direction: 3 : FromCorner4
Shape Text: From Bottom Left Corner
Shape Gradient Direction: 1: FromCorner1
Shape Text: From Center
Shape Gradient Direction: 4 : FromCenter
Shape Text: From Top Right Corner
Shape Gradient Direction: 2: FromCorner3
Shape Text: From Top Left Corner
Shape Gradient Direction: 0: FromCorner1

Test Gradient Directions.zip (30.5 KB)

The issues you have found earlier (filed as SLIDESJAVA-37007) have been fixed in this update.