@@ -171,58 +171,68 @@ public void stopAllSounds() {
171171 }
172172
173173 /**
174- * Sets the tint for the current costume with rgb.
174+ * Sets the tint for the sprite with rgb.
175175 *
176176 * @see ScratchImage#setTint(float, float, float)
177177 */
178178 public void setTint (int r , int g , int b ) {
179179 if (costumes .size () == 0 ) return ;
180180
181- this .costumes .get (this .currentCostume ).setTint (r , g , b );
181+ for (ScratchImage costume : this .costumes ) {
182+ costume .setTint (r ,g ,b );
183+ }
182184 }
183185
184186 /**
185- * Sets the tint for the current costume with a hue.
187+ * Sets the tint for the sprite with a hue.
186188 *
187189 * @see ScratchImage#setTint(float)
188190 */
189191 public void setTint (float h ) {
190192 if (costumes .size () == 0 ) return ;
191193
192- this .costumes .get (this .currentCostume ).setTint (h );
194+ for (ScratchImage costume : this .costumes ) {
195+ costume .setTint (h );
196+ }
193197 }
194198
195199 /**
196- * Changes the tint for the current costume .
200+ * Changes the tint for the sprite .
197201 *
198202 * @see ScratchImage#changeTint(float)
199203 */
200204 public void changeTint (float step ) {
201205 if (costumes .size () == 0 ) return ;
202206
203- this .costumes .get (this .currentCostume ).changeTint (step );
207+ for (ScratchImage costume : this .costumes ) {
208+ costume .changeTint (step );
209+ }
204210 }
205211
206212 /**
207- * Sets the transparency of the current costume .
213+ * Sets the transparency of the sprite .
208214 *
209215 * @see ScratchImage#setTransparency(float)
210216 */
211217 public void setTransparency (float transparency ) {
212218 if (costumes .size () == 0 ) return ;
213219
214- this .costumes .get (this .currentCostume ).setTransparency (transparency );
220+ for (ScratchImage costume : this .costumes ) {
221+ costume .setTransparency (transparency );
222+ }
215223 }
216224
217225 /**
218- * Changes the transparency for the current costume .
226+ * Changes the transparency for the sprite .
219227 *
220228 * @see ScratchImage#changeTransparency(float)
221229 */
222230 public void changeTransparency (float step ) {
223231 if (costumes .size () == 0 ) return ;
224232
225- this .costumes .get (this .currentCostume ).changeTransparency (step );
233+ for (ScratchImage costume : this .costumes ) {
234+ costume .changeTransparency (step );
235+ }
226236 }
227237
228238 /**
@@ -427,6 +437,26 @@ public void changeY(float y) {
427437 this .y += y ;
428438 }
429439
440+ /**
441+ * Return the width of the current costume or the pen size, when no costume is available.
442+ * @return the width of the sprite
443+ */
444+ public int getWidth () {
445+ if (costumes .size () == 0 ) return (int ) this .getPen ().getSize ();
446+
447+ return this .costumes .get (this .currentCostume ).getImage ().width ;
448+ }
449+
450+ /**
451+ * Return the height of the current costume or the pen size, when no costume is available.
452+ * @return the height of the sprite
453+ */
454+ public int getHeight () {
455+ if (costumes .size () == 0 ) return (int ) this .getPen ().getSize ();
456+
457+ return this .costumes .get (this .currentCostume ).getImage ().height ;
458+ }
459+
430460 /**
431461 * Return the default timer
432462 * @return the default timer
0 commit comments