Jump to content

Creating an opaque filled polygon over existing image


Balandar

Recommended Posts

I am trying to create an opaque filled polygon over an existing image that has text. The image is a map of Indiana with counties on it along with each county name. I want to "highlight" the county when it comes up in a search. Right now I have it so the county has a border drawn around it. I'd rather have an opaque filled polygon instead. But i can't get it to work right.

 

The Code: This is just an extract of the code, but I think you get the general idea. Currently it's not opaque but just a different shade of red, like a pink almost.. and it covers the text, nothing shows through the color.

 

		$image = @imagecreatefromgif("indiana_map_files/stout18.gif"); 
	imagealphablending ( $image, true );

	// choose a color for the polygon
	$col_poly = imagecolorallocate($image, 255, 0, 0);		
	imagesetthickness($image, 3);	
	$red = imagecolorresolvealpha($image, 255, 0, 0, 100);

	foreach($all_ids as $co_id){
		// draw the polygon
		$map_cords = $map_cords_array[$co_id];
		$points = count($map_cords)/2;
		if(!empty($map_cords)){

			imagefilledpolygon($image,
					 $map_cords,
					 $points,
					 $red
					 );						
		}

	}

	imagepng($image, "search_results/$new_image_name.png"); // to file

"Currently it not be opaque but just a different shade of red, like a pink almost.. and it covers the text, nothing shows through the color."

 

That's what opaque means...

http://www.google.com/search?q=define%3A+opaque

 

The text won't show through an opaque shape.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.