android 添加水印效果的实现
16lz
2023-05-28
Bitmap photo = BitmapFactory.decodeResource(r, res);Bitmap icon = Bitmap.createBitmap(width, hight, Bitmap.Config.ARGB_8888); //建立一个空的BItMapCanvas canvas = new Canvas(icon);//初始化画布 绘制的图像到icon上Paint photoPaint = new Paint(); //建立画笔photoPaint.setDither(true); //获取跟清晰的图像采样photoPaint.setFilterBitmap(true);//过滤一些Rect src = new Rect(0, 0, photo.getWidth(), photo.getHeight());//创建一个指定的新矩形的坐标Rect dst = new Rect(0, 0, width, hight);//创建一个指定的新矩形的坐标canvas.drawBitmap(photo, src, dst, photoPaint);//将photo 缩放或则扩大到 dst使用的填充区photoPaintPaint textPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DEV_KERN_TEXT_FLAG);//设置画笔textPaint.setTextSize(20.0f);//字体大小textPaint.setTypeface(Typeface.DEFAULT_BOLD);//采用默认的宽度textPaint.setColor(Color.RED);//采用的颜色textPaint.setShadowLayer(3f, 1, 1,r.getColor(android.R.color.background_dark));//影音的设置canvas.drawText(str, 20, 26, textPaint);//绘制上去 字,开始未知x,y采用那只笔绘制
更多相关文章
- Android(安卓)matrix 控制图片的旋转、缩放、移动
- Android中dispatchDraw分析
- 锁屏界面
- android OpenGL ES2.0编程初学
- android和j2me之清屏(clearScreen)
- [置顶] android 图标的绘制
- android和j2me之清屏(clearScreen)
- Android绘制简单折线图的步骤
- android 虚拟摇杆绘制