Graphics--Exporting Graphics, drawing multiple objects at once and what not

• To: mathgroup at smc.vnet.net
• Subject: [mg70915] Graphics--Exporting Graphics, drawing multiple objects at once and what not
• From: spilja at gmail.com
• Date: Wed, 1 Nov 2006 03:56:04 -0500 (EST)

```Hi!

I'm doing a school project and as a part of it I need to create a series of graphics (we're doing the game Set and I'm making the cards). Every card consists of 1 to 3 identical objects, so I wanted to use the For loop to draw the symbols (ie rectangle). Here's how I did it

brojel = 3;
y = 0;
For[i = 1, i &#8804; brojel,
Show[Graphics[{Hue[0.55],
Rectangle[{0, y}, {4, y + 1.5}],
RGBColor[1, 1, 1], Rectangle[{0.2, y + 0.2}, {3.8, y + 1.3}]}],
AspectRatio -> Automatic, ImageSize -> 100];
i++, y = y + 2.5];

where brojel is the number of elements, and y is used for the coordinates. Now while this generates a graphics I'm quite pleased with, it generates 3 graphic objects (and it's obvious why, running the For loop runs the Show[Graphics[]] 3 times). Now, is there a way that I can use the For loop in the Graphics function, so the output would be 3 rectangles, but as a single object, like this code does:

rct = Graphics[{Hue[0.55], Rectangle[{0, 0}, {4, 1.5}],
Rectangle[{0, 2.5}, {4, 4}],
Rectangle[{0, 5}, {4, 6.5}],
RGBColor[1, 1, 1], Rectangle[{0.2, 0.2}, {3.8, 1.3}],
Rectangle[{0.2, 2.7}, {3.8, 3.8}],
Rectangle[{0.2, 5.2}, {3.8, 6.3}]}];
Show[rct, AspectRatio -> Automatic, ImageSize -> {150, 170}];
?

And how could I export those rectangles as a single file?

Another problem I stumbled upon is exporting. I need to export each of these cards in a GIF or a BMP, retaining the ratios and using a fixed resolution (ie 150x170). For an example I took the image of a equilateral triangle and tried to export it using the Export function, but what I got was not an equilateral triangle. Also, I tried to export an image of 3 rectangles (not from the first code because I didn't know how to export that), but I the rectangles looked somewhat different than those that were displayed in Mathematica. Also, changing the coordinates of the rectangles had no effect on the exported image whatsoever.

Any help would do, thx.

edit: I'm sorry, this was supposed to be in the graphics forum but the forum redirected it? :-/

Link to the forum page for this post:
http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Special:Forum_ViewTopic&pid=14930#p14930
Posted through http://www.mathematica-users.org [[postId=14930]]

```

• Prev by Date: Re: RE: Labelled ticks at the origin
• Next by Date: Re: new procedure for converting a new recursive polynomial set into matrices
• Previous by thread: Re: RE: Labelled ticks at the origin
• Next by thread: Re: new procedure for converting a new recursive polynomial set into matrices