This week's book giveaway is in the iOS forum.
We're giving away four copies of Classic Computer Science Problems in Swift and have David Kopec on-line!
See this thread for details.
Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I flip/translate a GObject?  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The drawEngine() method creates the object I am trying to face in the opposite direction.

 
Marshal
Posts: 58829
179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you cast your Graphics object to Graphics2D, you can use the affine transform methods.

For example, scaling by -1.0 in the x-axis might give you a mirror image.

Beware
: use the method which copies the Grahpics2D object before using affine transforms. Scale is probably all right, but you can get distortions using shear. Discard the copy after the transforms. I think the copy method is called create().

Moving to our GUIs forum, where we usually discuss such questions.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!