<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                為了添加相框,可以新建一個bitmap,依此實例化一個canvas。然后再上面依次畫上原圖和相框。 在onPictureTaken()函數里,得到原始bitmap后,得到相框,然后調用融合函數。 Bitmap frame = BitmapFactory.decodeResource(getResources(), R.drawable.border); Bitmap monBM = montageBitmap(frame, sizeBitmap, 200, 200); ~~~ /*將像框和圖片進行融合,返回一個Bitmap*/ public Bitmap montageBitmap(Bitmap frame, Bitmap src, int x, int y){ int w = src.getWidth(); int h = src.getHeight(); Bitmap sizeFrame = Bitmap.createScaledBitmap(frame, w, h, true); Bitmap newBM = Bitmap.createBitmap(w, h, Config.ARGB_8888); Canvas canvas = new Canvas(newBM); canvas.drawBitmap(src, x, y, null); canvas.drawBitmap(sizeFrame, 0, 0, null); return newBM; } ~~~ 程序中frame代表相框,src代表原圖,大小為600*800.首先將相框的大小縮放到600*800,然后實例化一個canvas。記住先畫原圖。這里面有個x、y坐標。 這里是這個api的注釋: ~~~ public void drawBitmap (Bitmap bitmap, float left, float top, Paint paint) Added in API level 1 Draw the specified bitmap, with its top/left corner at (x,y), using the specified paint, transformed by the current matrix. Note: if the paint contains a maskfilter that generates a mask which extends beyond the bitmap's original width/height (e.g. BlurMaskFilter), then the bitmap will be drawn as if it were in a Shader with CLAMP mode. Thus the color outside of the original width/height will be the edge color replicated. If the bitmap and canvas have different densities, this function will take care of automatically scaling the bitmap to draw at the same density as the canvas. Parameters bitmap The bitmap to be drawn left The position of the left side of the bitmap being drawn top The position of the top side of the bitmap being drawn paint The paint used to draw the bitmap (may be null) ~~~ 看上面的解釋,貌似不清楚這個x y坐標到底是誰的坐標,是原圖的 還是canvas的?而且如果要畫的圖超過canvas的大小怎么辦?經過實際測試,參考[這里](http://book.51cto.com/art/201204/328278.htm),這個x、y坐標是指canvas上的,也就是以canvas上的點(x,y)為頂點,來畫圖bitmap。如果bitmap的大小超過canvas的大小,就不顯示了。下面兩組測試圖片可以清楚看到。 第一組測試照片(x,y)=(20, 20): 原圖: ![](https://box.kancloud.cn/2016-01-19_569e21ada0a5f.jpg) 原圖+相框: ![](https://box.kancloud.cn/2016-01-19_569e21aded9a5.jpg) 第二組(x,y)=(200, 200): 原圖: ![](https://box.kancloud.cn/2016-01-19_569e21ae3ae92.jpg) 原圖+相框:? ![](https://box.kancloud.cn/2016-01-19_569e21ae78567.jpg) 可以看到,當傳進去的坐標較小時看不出來啥差別。事實上,如果將兩個坐標都設為(0,0),看到的是兩個同樣大小的照片層疊的效果。這就看對相框如何定義了。如果要求不遮擋原圖,則需要把原圖縮放到rect大小,這個rect是指相框里面的空白(透明)部分大小。然后從canvas的透明部分的左上頂點開始畫縮放后的原圖。 [http://blog.csdn.net/lgl125/article/details/7866930](http://blog.csdn.net/lgl125/article/details/7866930)這個鏈接是給原圖加邊框的,但不是相框!可以參考。 ??????????????????????????????????????????????????????????????????????????????? -----------------------------------------------------------------本文系原創,轉載請注明作者:yanzi1225627
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看