Lines 137-152
Link Here
|
137 |
anchor = tx.createTransformedShape(anchor).getBounds2D(); |
137 |
anchor = tx.createTransformedShape(anchor).getBounds2D(); |
138 |
} |
138 |
} |
139 |
|
139 |
|
|
|
140 |
// PowerPoint rotates shapes relative to the geometric center |
141 |
double centerX = anchor.getCenterX(); |
142 |
double centerY = anchor.getCenterY(); |
143 |
|
144 |
AffineTransform txs = new AffineTransform(tx); |
145 |
Rectangle2D anchor1 = graphics.getTransform().createTransformedShape(anchor).getBounds2D(); |
146 |
|
140 |
// rotation |
147 |
// rotation |
141 |
double rotation = getRotation(); |
148 |
double rotation = getRotation(); |
142 |
if (rotation != 0.) { |
149 |
if (rotation != 0.) { |
143 |
// PowerPoint rotates shapes relative to the geometric center |
|
|
144 |
double centerX = anchor.getX() + anchor.getWidth() / 2; |
145 |
double centerY = anchor.getY() + anchor.getHeight() / 2; |
146 |
|
147 |
graphics.translate(centerX, centerY); |
150 |
graphics.translate(centerX, centerY); |
148 |
graphics.rotate(Math.toRadians(rotation)); |
151 |
graphics.rotate(Math.toRadians(rotation)); |
149 |
graphics.translate(-centerX, -centerY); |
152 |
graphics.translate(-centerX, -centerY); |
|
|
153 |
|
154 |
txs.translate(centerX, centerY); |
155 |
txs.rotate(Math.toRadians(rotation)); |
156 |
txs.translate(-centerX, -centerY); |
150 |
} |
157 |
} |
151 |
|
158 |
|
152 |
//flip horizontal |
159 |
//flip horizontal |
Lines 154-159
Link Here
|
154 |
graphics.translate(anchor.getX() + anchor.getWidth(), anchor.getY()); |
161 |
graphics.translate(anchor.getX() + anchor.getWidth(), anchor.getY()); |
155 |
graphics.scale(-1, 1); |
162 |
graphics.scale(-1, 1); |
156 |
graphics.translate(-anchor.getX(), -anchor.getY()); |
163 |
graphics.translate(-anchor.getX(), -anchor.getY()); |
|
|
164 |
|
165 |
txs.translate(anchor.getX() + anchor.getWidth(), anchor.getY()); |
166 |
txs.scale(-1, 1); |
167 |
txs.translate(-anchor.getX(), -anchor.getY()); |
157 |
} |
168 |
} |
158 |
|
169 |
|
159 |
//flip vertical |
170 |
//flip vertical |
Lines 161-167
Link Here
|
161 |
graphics.translate(anchor.getX(), anchor.getY() + anchor.getHeight()); |
172 |
graphics.translate(anchor.getX(), anchor.getY() + anchor.getHeight()); |
162 |
graphics.scale(1, -1); |
173 |
graphics.scale(1, -1); |
163 |
graphics.translate(-anchor.getX(), -anchor.getY()); |
174 |
graphics.translate(-anchor.getX(), -anchor.getY()); |
|
|
175 |
|
176 |
txs.translate(anchor.getX(), anchor.getY() + anchor.getHeight()); |
177 |
txs.scale(1, -1); |
178 |
txs.translate(-anchor.getX(), -anchor.getY()); |
164 |
} |
179 |
} |
|
|
180 |
|
181 |
// scale to bounding box (bug #53176) |
182 |
Rectangle2D anchor2 = txs.createTransformedShape(getAnchor()).getBounds2D(); |
183 |
anchor2 = graphics.getTransform().createTransformedShape(anchor2).getBounds2D(); |
184 |
|
185 |
double scaleX2 = anchor1.getWidth() == 0. ? 1.0 : anchor2.getWidth() / anchor1.getWidth(); |
186 |
double scaleY2 = anchor1.getHeight() == 0. ? 1.0 : anchor2.getHeight() / anchor1.getHeight(); |
187 |
|
188 |
graphics.translate(centerX, centerY); |
189 |
graphics.scale(scaleX2, scaleY2); |
190 |
graphics.translate(-centerX, -centerY); |
165 |
} |
191 |
} |
166 |
|
192 |
|
167 |
/** |
193 |
/** |