Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Painting a half circle

Posted on 2001-09-18
17
Medium Priority
?
485 Views
Last Modified: 2012-05-04
i would like to paint a text into a colored rectangle which have on the side a half filled circle.

****************
******TEXT********
******TEXT**********
******TEXT**********
******************
****************

Did you know what i mean ?
The rectangle can i make with a Table, but how the circle ? have i to use a image ? What is about the color ?
Should work under IE5.0
0
Comment
Question by:Andi4553
  • 7
  • 3
  • 2
  • +3
17 Comments
 
LVL 4

Expert Comment

by:Gibble
ID: 6490702
An image is the best approach.  But you can also do that with PHP.

--With an image
<table>
<tr>
<td style="background:red;">Some Text</td>
<td><img src="redhalfcircle.gif"/></td>
</tr>
</table>

0
 
LVL 19

Expert Comment

by:cheekycj
ID: 6490703
To have the most consistant look and feel.. using an image would be the best approach.

CJ
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 6490704
Posted at the SAME time! LOL
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:Gibble
ID: 6490713
I beat you :P
hehe thats pretty good, we need to get seconds in there!
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6490732
You will need to create the half circle as an image.

Then put it in a layer and put the text in another layer
on top of the image like this:

<div style="position:absolute;top:???;left:???;z-index:1;width:???;height:???">
   <img border="0" src="halfcircle.gif" width="???" height="???">
</div>

<div style="position:absolute;top:???;left:???;z-index:10;width:???;height:???">
   text<br>
   text<br>
   text<br>
</div>

You will need to determine the values for top, left, width, and height
to get the alighnment you want.  The div with the text could also be
further styled to control its background color and text color.

Cd&
0
 
LVL 4

Expert Comment

by:Gibble
ID: 6490760
Way to make it complicated CD& :P
0
 
LVL 19

Expert Comment

by:webwoman
ID: 6490993
I'd do the whole thing as an image... any decent drawing program allows you to wrap/align text, and you'd have total control over how it looked.

Doing it with scripting of some kind should work -- but you won't have the same control over how things wrap or what font is used as you would with a graphic.

So it pretty much hinges on how crucial the look is and what tools you have available.
0
 
LVL 19

Expert Comment

by:webwoman
ID: 6491002
Unless, of course, we're reading this completely wrong.

What side would the text be next too? If the text is next to the flat side of the half-circle, you could use a table, put the graphic in one cell and the text in the other, and align the text so it sat against the flat of the semi-circle. You'd still run into a text size concern, but that could be pretty well controlled with CSS.

If, however, you want the text to wrap the CIRCULAR side, that's different. Then you would be better off using a drawing program and making one graphic with the circle and the text.
0
 

Author Comment

by:Andi4553
ID: 6491117
The text should be assigned to the flat side.
i also want to change the color of the background (if using a table of the Cell Background) and change the image, for the circle (making for every color an image)
Is there a better way ?
0
 
LVL 4

Expert Comment

by:Gibble
ID: 6491154
PHP if you have it would probably be easiest then...it can create images on the fly.

This of course is assuming you have access to put PHP on the server.
0
 

Author Comment

by:Andi4553
ID: 6491237
Yes i have PHP Support but i am not able to programm it.
If you can help me, it would be great !
0
 
LVL 4

Expert Comment

by:Gibble
ID: 6491463
Ok you will also need to see if the graphics modules for PHP are installed, I will get back to you with a test you can run hopefully within the hour, I am quite busy here so you will have to be patient, sry.
0
 
LVL 4

Accepted Solution

by:
Gibble earned 400 total points
ID: 6491711
You will place this in your page
<IMG SRC="image.php?label=Button1"><br>
<IMG SRC="image.php?label=Button2"><br>
<IMG SRC="image.php?label=Button3"><br>

image.php will look like this:
<?
  //Tell the browser its a gif
  Header( "Content-type: image/gif");

  //Create the image 200x200 pixels
  $image = imagecreate(400,200);

  //Lets setup the colors to use
  $maroon = ImageColorAllocate($image,100,0,0);
  $white = ImageColorAllocate($image,255,255,255);

  //Lets draw our image
  ImageFilledRectangle($image, 0, 0, 350, 200, $maroon);
  ImageArc($image, 350, 100, 50, 50, 0, 360, $maroon);
  ImageFillToBorder($image, 351, 100, $maroon, $maroon);
  ImageString($image, 5, 100, 10, $label, $white);

  //Lets place it on the screen
  ImageGIF($image);

  //And then destroy the image that we are storing in memory:
  ImageDestroy($image);
?>

This should work, But since I don't have a PHP machine near me, I can't test it :P

Try it and lets see what happens!
0
 
LVL 1

Expert Comment

by:iamkalyang
ID: 6499128
if the half circle needs to be dynamically generated, ther is a approach, but it does not produce the accurate one..

what can be done is

split the area into a tiny cells using tables which contain may small columns.. hence dynamically as per ur wish u can paint them..

it works fine, ifused with rect and sq.. we used it for generating poll results..

try it out..

all the best
0
 
LVL 4

Expert Comment

by:Gibble
ID: 6499914
iamkalyang,
Be careful doing this with NS as it has trouble with tables, too many columns and rows and it slows down considerably.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6855018
This question has been abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.

Cd&
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6892885
It is time to clean this abandoned question up.  

I am putting it on a clean up list for CS.

<recommendation>
points to Gibble

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question