可以将BitmapDescriptor转换为Bitmap吗?

时间:2017-05-22 18:50:28

标签: java android google-maps bitmap

我需要将BitmapDescriptor转换为Bitmap。

我可以使用以下代码将位图转换为BitmapDescriptor:

<?php  
 //load_data.php  
 $connect = mysqli_connect("localhost", "root", "", "test");  
 $output = '';
 if(isset($_POST["assetid"]))  
 {  
  if($_POST["assetid"] != '')
  {  
       $sql = "SELECT * FROM cq WHERE assetid = '".$_POST["assetid"]."'";

  }  
  else
  {  
       $sql = "SELECT * FROM cq WHERE assetid = 'akash'";
       // i dont want to load any database so used wrong query

  }
  $result = mysqli_query($connect, $sql);
  $quesno = 1;

  while($row = mysqli_fetch_array($result))  
  {  
       $output .= '<div class="col-sm-6">';
       $output .= '<div class="form-group">';
       $output .= '<label for="campaignname">'.$row["cqname"].'</label>';
       $output .= '<select name="cq'.$quesno.'" size="5" class="form-control" required>';
       // $output .= '<div style="border:1px solid #ccc; padding:20px; margin-bottom:20px;">'.$row["product_name"].'</div>';
       // $output .= '<tr><td>'.$row["cqname"].'<br></td>';
       $output .= '<option value="" required>Select Custom Question Answer</option>
                   <option value="'.$row["cqa1"].'">'.$row["cqa1"].'</option>
                   <option value="'.$row["cqa2"].'">'.$row["cqa2"].'</option>
                    <option value="'.$row["cqa3"].'">'.$row["cqa3"].'</option>
                    <option value="'.$row["cqa4"].'">'.$row["cqa4"].'</option>
                    <option value="'.$row["cqa5"].'">'.$row["cqa5"].'</option>
                    <option value="'.$row["cqa6"].'">'.$row["cqa6"].'</option>
                    <option value="'.$row["cqa7"].'">'.$row["cqa7"].'</option>
                    <option value="'.$row["cqa8"].'">'.$row["cqa8"].'</option>
                    <option value="'.$row["cqa9"].'">'.$row["cqa9"].'</option>
                    <option value="'.$row["cqa10"].'">'.$row["cqa10"].'</option>
                    <option value="'.$row["cqa11"].'">'.$row["cqa11"].'</option>
                    <option value="'.$row["cqa12"].'">'.$row["cqa12"].'</option>
                    <option value="'.$row["cqa13"].'">'.$row["cqa13"].'</option>
                    <option value="'.$row["cqa14"].'">'.$row["cqa14"].'</option>
                    <option value="'.$row["cqa15"].'">'.$row["cqa15"].'</option>
                    <option value="'.$row["cqa16"].'">'.$row["cqa16"].'</option>
                    <option value="'.$row["cqa17"].'">'.$row["cqa17"].'</option>
                    <option value="'.$row["cqa18"].'">'.$row["cqa18"].'</option>
                    <option value="'.$row["cqa19"].'">'.$row["cqa19"].'</option>
                    <option value="'.$row["cqa20"].'">'.$row["cqa20"].'</option>
                    <option value="'.$row["cqa21"].'">'.$row["cqa21"].'</option>

                   </select>';
       // $output .= '<tr><td colspan="10"><hr></td></tr>';
       $output .= '</div></div></div>';
       $quesno++;
  }  
  echo $output;
 }  
 ?>

但我怎么能以相反的方式做?

我需要以位图格式获取$(document).ready(function() { // submit form $("#newleadform").unbind('submit').bind('submit', function() { $(".text-danger").remove(); var form = $(this); // validation var assettitle = $("#assettitle").val(); var customquestion1 = $("#cq1").val(); var customquestion2 = $("#cq2").val(); var customquestion3 = $("#cq3").val(); var customquestion4 = $("#cq4").val(); var customquestion5 = $("#cq5").val(); var customquestion6 = $("#cq6").val(); var customquestion7 = $("#cq7").val(); var customquestion8 = $("#cq8").val(); var customquestion9 = $("#cq9").val(); var customquestion10 = $("#cq10").val(); var customquestion11 = $("#cq11").val(); var customquestion12 = $("#cq12").val(); var customquestion13 = $("#cq13").val(); var customquestion14 = $("#cq14").val(); var customquestion15 = $("#cq15").val(); if(assettitle) { //submit the form to server $.ajax({ url : '../pages/php_action/addnewlead/createlead.php', type : 'POST', data : form.serialize(), dataType : 'json', success:function(response) { // remove the error $(".form-group").removeClass('has-error').removeClass('has-success'); if(response.success == true) { $(".messages").html('<div class="alert alert-success alert-dismissible" role="alert">'+ '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+ '<strong> <span class="glyphicon glyphicon-ok-sign"></span> </strong>'+response.messages+ '</div>'); // reset the form $("#newleadform")[0].reset(); } else { $(".messages").html('<div class="alert alert-warning alert-dismissible" role="alert">'+ '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+ '<strong> <span class="glyphicon glyphicon-exclamation-sign"></span> </strong>'+response.messages+ '</div>'); } // /else } // success }); // ajax subit } /// if return false; }); // /submit form for create member }); // /add modal

1 个答案:

答案 0 :(得分:1)

我不确定,但我认为不可能

在我的应用程序中,我要求更改默认的市场颜色...我使用下面的代码得到默认标记作为位图希望它有助于你

Drawable d = DrawableUtils.resizeImageToDrawable(
                    MapViewFragment.mapViewActivity,
                    Configuration.Display.getDrawableFix(i),
                    Configuration.MapView.getWaypointIconWidth(),
                    Configuration.MapView.getWaypointIconHeight());
d.setColorFilter(color, Mode.MULTIPLY);

Bitmap b = ((BitmapDrawable) d).getBitmap();
Canvas myCanvas = new Canvas(b);

int myColor = b.getPixel(0,0);
ColorFilter filter = new LightingColorFilter(myColor, color);

如果您有任何问题可以提出