Results 1 to 7 of 7

Thread: create circle image HELP!!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2010
    Posts
    164

    create circle image HELP!!

    hi all,
    I need of your help!!!
    I want to create an image dot.png that is circle filled with white color.
    I used followin code:
    Code:
    Dim bmp As Bitmap = New Bitmap(64, 64)
    Dim g As Graphics = Graphics.FromImage(bmp)
    g.FillEllipse(Brushes.White, 8, 8, 48, 48)
    bmp.Save("d:\dot.png")
    I would like to obtain following image:


    meanwhile I obtain following image:


    So the result in google earth is different. I would like to obtain following result (obatined with dot_good):


    meanwhile i obtain following one:


    it seems that dot_good has shaped border but i cannot obtain it with my code.

    Can someone help me?

    thanks in advenced

    Gio

  2. #2
    Hyperactive Member
    Join Date
    Jul 2011
    Posts
    278

    Re: create circle image HELP!!

    Okay, I quickly wanted to test this before responding so made an associated program as below:

    vb net Code:
    1. Dim startx As Integer
    2.     Dim starty As Integer
    3.     Dim currentx As Integer
    4.     Dim currenty As Integer
    5.  
    6.     Private Sub DrawCircle()
    7.         Dim e As System.Drawing.Graphics
    8.         e = PictureBox1.CreateGraphics
    9.         e.CompositingQuality = Drawing2D.CompositingQuality.HighQuality
    10.         e.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
    11.         e.FillEllipse(Brushes.Lime, startx, starty, currentx, currenty)
    12.     End Sub
    13.  
    14.     Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
    15.         Call DrawCircle()
    16.         startx = startx + 5
    17.         starty = starty + 5
    18.         currentx = currentx + 5
    19.         currenty = currenty + 5
    20.     End Sub
    21.  
    22.     Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    23.         Timer1.Enabled = True
    24.     End Sub

    The above creates a continuous line of circles overlapping and growing larger on each tick of a timer within PictureBox1.

    I'm not entirely sure what you're after, you seem to have posted two similar issues.

    To make a smooth border like the first white circle use:

    vbnet Code:
    1. Dim bmp As Bitmap = New Bitmap(64, 64)
    2. Dim g As Graphics = Graphics.FromImage(bmp)
    3. g.CompositingQuality = Drawing2D.CompositingQuality.HighQuality
    4. g.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
    5. g.FillEllipse(Brushes.White, 8, 8, 48, 48)
    6. bmp.Save("d:\dot.png")

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2010
    Posts
    164

    Re: create circle image HELP!!

    Quote Originally Posted by OhGreen View Post
    Okay, I quickly wanted to test this before responding so made an associated program as below:

    .....

    To make a smooth border like the first white circle use:

    vbnet Code:
    1. Dim bmp As Bitmap = New Bitmap(64, 64)
    2. Dim g As Graphics = Graphics.FromImage(bmp)
    3. g.CompositingQuality = Drawing2D.CompositingQuality.HighQuality
    4. g.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
    5. g.FillEllipse(Brushes.White, 8, 8, 48, 48)
    6. bmp.Save("d:\dot.png")
    Hi OhGreen,
    thanks for your replay. You focused my issue.
    The dot.png is used to obtain image on google earth
    Anyway created dot with your code is not enought with smooth border as I obtain following image:


    So I visualize always an image on Google earth with tube effect.
    Meanwhile with dot_good i obtain an image without tube effect:


    Any suggestion?

    thanks again
    gio

  4. #4
    Hyperactive Member
    Join Date
    Jul 2011
    Posts
    278

    Re: create circle image HELP!!

    Okay first off is that background image saved on your computer and loaded into a picturebox?

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2010
    Posts
    164

    Re: create circle image HELP!!

    Quote Originally Posted by OhGreen View Post
    Okay first off is that background image saved on your computer and loaded into a picturebox?
    the image is a screenshot of kml file. In kml file I have following code:
    Code:
    <IconStyle>
    			<color>ff0000ff</color>
    			<scale>0.4</scale>
    			<Icon> <href>dot.png</href> </Icon>
    			<hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
    		</IconStyle>
    and the kml file is placed on same dir where there is dot.png.

  6. #6
    Hyperactive Member
    Join Date
    Jul 2011
    Posts
    278

    Re: create circle image HELP!!

    You have a screenshot of the kml, you then load that screenshot into a picturebox?

    What do you mean by "dir"? and what is dot.png?

    I realise English may not be your first language but please try to explain your situation/problem in a bit more detail, remember all I know is what you tell me.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Oct 2010
    Posts
    164

    Re: create circle image HELP!!

    Quote Originally Posted by OhGreen View Post
    You have a screenshot of the kml, you then load that screenshot into a picturebox?

    What do you mean by "dir"? and what is dot.png?

    I realise English may not be your first language but please try to explain your situation/problem in a bit more detail, remember all I know is what you tell me.
    yes, you are right, my english is not my native language but I try to explain better.

    I developed a tool that creates kml file. Output is i.e. :
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
    <Document>
    	<name>test.kml</name>
    	<Style id="s_ff0000ff">
    		<IconStyle>
    			<color>ff0000ff</color>
    			<scale>0.4</scale>
    			<Icon> <href>dot.png</href> </Icon>
    			<hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
    		</IconStyle>
    		<LabelStyle> <color>ff0000ff</color> <scale>0.6</scale> </LabelStyle>
    		<ListStyle></ListStyle>
    	</Style>
    	<StyleMap id="m_ff0000ff"> <styleUrl>#s_ff0000ff</styleUrl> </StyleMap>
    	<Style id="s_ff00ff00">
    		<IconStyle>
    			<color>ff00ff00</color>
    			<scale>0.4</scale>
    			<Icon> <href>dot.png</href> </Icon>
    			<hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
    		</IconStyle>
    		<LabelStyle> <color>ff00ff00</color> <scale>0.6</scale> </LabelStyle>
    		<ListStyle></ListStyle>
    	</Style>
    	<StyleMap id="m_ff00ff00"> <styleUrl>#s_ff00ff00</styleUrl> </StyleMap>
    	<Folder>
    		<name>test.kml</name>
    		<open>0</open>
    		<Placemark>
    			<styleUrl>#s_ff0000ff</styleUrl>
    			<Point>
    				<coordinates>7.84053,43.8547,0</coordinates>
    			</Point>
    		</Placemark>
    		<Placemark>
    			<styleUrl>#s_ff00ff00</styleUrl>
    			<Point>
    				<coordinates>7.8404,43.8547,0</coordinates>
    			</Point>
    		</Placemark>
    		<Placemark>
    			<styleUrl>#s_ff00ff00</styleUrl>
    			<Point>
    				<coordinates>7.84042,43.8547,0</coordinates>
    			</Point>
    		</Placemark>
    		</Folder>
     </Document>
    </kml>
    You can save it and open with google earth.

    How it works:
    google earth(GE) reads this kml file and it creates points on some place specified by longitude and latitude. In my example I considered only two points. GE needs of an image *.png (in this case dot.png) to draw point on map so I must specify in kml file where GE can find dot.png; if I don't specify the path where there is dot.png, I cannot see anything on google earth. So I need to place dot.png in the same directory where there is test.kml.
    My goal is to insert in my tool a portion of code in order to create dot.png image. I used your code and it correctly creates this image but I don't see colors of points as specified in image reported above but I see the image with tube effect.
    The dot.png good is obtained by another professional tool (Mapinfo) and I would like to reproduce exactly it.

    I hope to be clear
    gio

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width