Note that there are some explanatory texts on larger screens.

plurals
  1. POLoading images to specific coordinates in SCanvasView
    primarykey
    data
    text
    <p>I am creating an android application and am working with canvas bitmaps (specifically the Samsung SPen SDK). I currently have the functionality I want working working, but the way the loading is implemented makes the run-time too long.</p> <p><strong>What I have:</strong> </p> <p><strong>Saving:</strong> I am saving the canvas as a bitmap and splitting this bitmap into X smaller bitmaps of a specific size (saving only the sections with writing in them). There is no problem with the efficiency of this section.</p> <p><strong>Loading:</strong>: </p> <ol> <li>I then take the X number of smaller bitmaps and combine them to reform the original bitmap using <code>canvas.drawBitmap(imgs[x][y], xCoordinate, yCoordinate, null)</code> for all of the images that have writing in them(<code>imgs[][]</code> = array of bitmaps).</li> <li>I then display this in the foreground of the canvas using the <code>setclearImageBitmap(BitmapName)</code> function in the SCanvasView class. This works fine besides the fact that loading the one large image into the foreground is taking ~90% of the run time. </li> </ol> <p>private void loadCanvasImage(){ Bitmap bmOverlay = Bitmap.createBitmap(mSCanvas.getWidth(), mSCanvas.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bmOverlay); int yCo = 0; for(int yCount=0; yCount }</p> <p><strong>Question</strong>: I am wondering if there is a more efficient way to do this. Potentially by implementing this idea:</p> <h2>By adding multiple bitmaps to the canvas view (preferably foreground) at specific x,y coordinates (This may make it faster since the smaller bitmaps without writing on them will not have to be displayed).</h2> <p>Another method I failed to implement was to set the SCanvasView to the canvas containing the one large bitmap that I recreated. I did this by trying to override the onDraw(Canvas) method, and passing the canvas result of <code>canvas.drawBitmap(imgs[x][y], xCoordinate, yCoordinate, null)</code></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload