Message Boards Message Boards

0
|
4684 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

[?] Create a graphic object to manipulate?

I would like to be able to save a set of graphics primitives as a single object that I can resize, rotate, blur, etc. I can see no way to do this. Region Union does not like the colors, for example.

here is some code:

Graphics[{Red, Disk[{-0.625, -1.208}, 0.106], 
  Disk[{0.625, -1.208}, 0.106], White, Disk[{0, 0}, 1], 
  Polygon[{{0.208, -0.916}, {0.1458, -2.21}, {-0.1458, -2.21}, \
{-0.208, -0.916}, {0.208, -0.916}}], Disk[{0, -2.15}, 0.1458], 
  Rectangle[{-.625, -1.833}, {0.625, -1.667}], 
  Rectangle[{ -0.75, -3.458}, {-0.5, -1.208}], 
  Rectangle[{ 0.5, -3.458}, {0.75, -1.208}]}, Background -> Black, 
 PlotRange -> {{-2, 2}, {-5, 3}}]

This makes a possibly recognizable object.

enter image description here

I don't want to rasterize the image, because I may want to scale it or use different colors, etc.

Any help would be appreciated.

2 Replies

Perfect. I was trying to work one level up, which (obviously) did not work.

Many Thanks.

George,

If you set your contents of the Graphic to gr:

gr = {Red, Disk[{-0.625, -1.208}, 0.106], 
   Disk[{0.625, -1.208}, 0.106], White, Disk[{0, 0}, 1], 
   Polygon[{{0.208, -0.916}, {0.1458, -2.21}, {-0.1458, -2.21}, \
{-0.208, -0.916}, {0.208, -0.916}}], Disk[{0, -2.15}, 0.1458], 
   Rectangle[{-.625, -1.833}, {0.625, -1.667}], 
   Rectangle[{-0.75, -3.458}, {-0.5, -1.208}], 
   Rectangle[{0.5, -3.458}, {0.75, -1.208}]};

and create the original object:

obj = Graphics[gr, Background -> Black,  PlotRange -> {{-2, 2}, {-5, 3}}]

You can do the scaling and rotating:

Graphics[Rotate[gr, 10 Degree], Background -> Black, 
 PlotRange -> {{-2, 2}, {-5, 3}}, ImageSize -> 140]

or change things:

Graphics[Rotate[gr /. Red -> Green, 10 Degree], Background -> Black, 
 PlotRange -> {{-2, 2}, {-5, 3}}, ImageSize -> 140]

to get

enter image description here

Is this what you are looking for?

Regards

Neil

POSTED BY: Neil Singer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract