我正在开发一个 android 应用程序并尝试将 RasterImage 转换为 Bitmap Image 以绘制具有给定点的线。但我在转换时遇到了例外。我正在为此使用 LEADTOOLS DICOM SDK 版本 18。下面是我正在使用的代码
private void drawingfunction(float x, float y, float xend, float yend, int color) {
try{
RasterImage _loadedImage;
RaterImageViewer secondviewer;
Bitmap newpic;
newpic=RasterImageConverter.convertToBitmap(_loadedImage2, ConvertToImageOptions.NONE.getValue());
newpic = Bitmap.createBitmap(_loadedImage2.getWidth(), _loadedImage2.getHeight(), Config.ARGB_8888);
Canvas c = new Canvas(newpic);
c = new Canvas(newpic);
secondviewer.draw(c);
Paint p = new Paint();
p.setColor(color);
c.drawLine(x, y, xend, yend, p);
secondviewer.setImageBitmap(newpic);
}
catch(Exception ex)
{
Toast.makeText(getApplicationContext(),ex.toString(),Toast.LENGTH_SHORT).show();
}
}