public static Bitmap blur(Context context, Bitmap image) {
int width = Math.round(image.getWidth());
int height = Math.round(image.getHeight());
Bitmap inputBitmap = Bitmap.createScaledBitmap(image, width, height, false);
Bitmap outputBitmap = Bitmap.createBitmap(inputBitmap);
RenderScript rs = RenderScript.create(context);
ScriptIntrinsicBlur theIntrinsic = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
Allocation tmpIn = Allocation.createFromBitmap(rs, inputBitmap);
Allocation tmpOut = Allocation.createFromBitmap(rs, outputBitmap);
theIntrinsic.setRadius(25);
theIntrinsic.setInput(tmpIn);
theIntrinsic.forEach(tmpOut);
tmpOut.copyTo(outputBitmap);
return outputBitmap;
}
public static Bitmap overlayBitmap(Bitmap bitmapBackground, Bitmap bitmapImage) {
Bitmap resized_bitmap = Bitmap.createScaledBitmap(bitmapImage, (int) (bitmapBackground.getWidth()*0.8), bitmapBackground.getWidth(),true);
Bitmap bmOverlay = Bitmap.createBitmap(bitmapBackground.getWidth(), bitmapBackground.getHeight(), bitmapBackground.getConfig());
Canvas canvas = new Canvas(bmOverlay);
canvas.drawBitmap(bitmapBackground, new Matrix(), null);
canvas.drawBitmap(resized_bitmap,bitmapBackground.getWidth()/5,bitmapBackground.getHeight()/5, null);
return bmOverlay;
}
答案 0 :(得分:0)
如果您只想在输入中授权alpha numerique,这是我的建议:
<input type="text" id="yazi" value="" onkeypress="return alpha(event)"/>
<button onclick="ElaveEt();">OK</button>
<div id="list"></div>
</div>
<script>
function ElaveEt() {
if (document.getElementById("yazi").value.length > 0) {
objYazi = document.getElementById("yazi");
objList = document.getElementById("list");
objList.innerHTML = objList.innerHTML + '<div id="Step">'+ objYazi.value + '<button onclick="YaziniSil();" >Sil</button>' + '<div>';
//document.getElementById("list").innerHTML = document.getElementById("list").innerHTML + '<br>' + document.getElementById("yazi").value;
document.getElementById("yazi").value = null;
} else {
alert('Boş xana əlavə oluna bilməz!')
}
}
function YaziniSil() {
document.getElementById("Step").remove();
}
function alpha(e) {
var k;
document.all ? k = e.keyCode : k = e.which;
return ((k > 64 && k < 91) || (k > 96 && k < 123) || k == 8 || k == 32 || (k >= 48 && k <= 57));
}
</script>