OverlayFrame.java revision 9bcedf7cf3e9c981837f2d8ec98cd118efad3f01
1872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes/* 2872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * Copyright (C) 2010 The Android Open Source Project 3872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * 4872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * Licensed under the Apache License, Version 2.0 (the "License"); 5872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * you may not use this file except in compliance with the License. 6872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * You may obtain a copy of the License at 7872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * 8872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * http://www.apache.org/licenses/LICENSE-2.0 9872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * 10872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * Unless required by applicable law or agreed to in writing, software 11872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * distributed under the License is distributed on an "AS IS" BASIS, 12872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * See the License for the specific language governing permissions and 14872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * limitations under the License. 15872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes */ 16872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 1707ed66b5ae659c452cbe1ab20c3dbf1d6f546461Elliott Hughes 1807ed66b5ae659c452cbe1ab20c3dbf1d6f546461Elliott Hughespackage android.media.videoeditor; 1907ed66b5ae659c452cbe1ab20c3dbf1d6f546461Elliott Hughes 2007ed66b5ae659c452cbe1ab20c3dbf1d6f546461Elliott Hughesimport java.io.File; 2107ed66b5ae659c452cbe1ab20c3dbf1d6f546461Elliott Hughesimport java.io.FileNotFoundException; 22872d4ec7225444d9400d30f9027247deb91012fdElliott Hughesimport java.io.FileOutputStream; 23872d4ec7225444d9400d30f9027247deb91012fdElliott Hughesimport java.io.IOException; 2407ed66b5ae659c452cbe1ab20c3dbf1d6f546461Elliott Hughes 25872d4ec7225444d9400d30f9027247deb91012fdElliott Hughesimport android.graphics.Bitmap; 26872d4ec7225444d9400d30f9027247deb91012fdElliott Hughesimport android.graphics.BitmapFactory; 2700f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogersimport android.graphics.Bitmap.CompressFormat; 28872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 29872d4ec7225444d9400d30f9027247deb91012fdElliott Hughesimport java.io.DataOutputStream; 30872d4ec7225444d9400d30f9027247deb91012fdElliott Hughesimport java.nio.ByteBuffer; 31872d4ec7225444d9400d30f9027247deb91012fdElliott Hughesimport java.nio.IntBuffer; 32872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 33376a7a033d29d5f2b6e16574a340c999ff2999a0Elliott Hughes/** 34872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * This class is used to overlay an image on top of a media item. 35872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * {@hide} 36872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes */ 37872d4ec7225444d9400d30f9027247deb91012fdElliott Hughespublic class OverlayFrame extends Overlay { 385d10a87ea630b22180d3731018a70b77270c726eElliott Hughes /** 394b95e8fad803ad307fa09c11c08894544e07a731Mathieu Chartier * Instance variables 40872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes */ 415d10a87ea630b22180d3731018a70b77270c726eElliott Hughes private Bitmap mBitmap; 425d10a87ea630b22180d3731018a70b77270c726eElliott Hughes private String mFilename; 435d10a87ea630b22180d3731018a70b77270c726eElliott Hughes private String mBitmapFileName; 4468a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes 45cb69306eefc1e6e42b3eaec8b479a268222b01b6Elliott Hughes private int mOFWidth; 46cb69306eefc1e6e42b3eaec8b479a268222b01b6Elliott Hughes private int mOFHeight; 475d10a87ea630b22180d3731018a70b77270c726eElliott Hughes 485d10a87ea630b22180d3731018a70b77270c726eElliott Hughes /** 495d10a87ea630b22180d3731018a70b77270c726eElliott Hughes * An object of this type cannot be instantiated by using the default 505d10a87ea630b22180d3731018a70b77270c726eElliott Hughes * constructor 515d10a87ea630b22180d3731018a70b77270c726eElliott Hughes */ 525d10a87ea630b22180d3731018a70b77270c726eElliott Hughes @SuppressWarnings("unused") 535d10a87ea630b22180d3731018a70b77270c726eElliott Hughes private OverlayFrame() { 545d10a87ea630b22180d3731018a70b77270c726eElliott Hughes this(null, null, (String)null, 0, 0); 555d10a87ea630b22180d3731018a70b77270c726eElliott Hughes } 565d10a87ea630b22180d3731018a70b77270c726eElliott Hughes 575d10a87ea630b22180d3731018a70b77270c726eElliott Hughes /** 585d10a87ea630b22180d3731018a70b77270c726eElliott Hughes * Constructor for an OverlayFrame 595d10a87ea630b22180d3731018a70b77270c726eElliott Hughes * 605d10a87ea630b22180d3731018a70b77270c726eElliott Hughes * @param mediaItem The media item owner 615d10a87ea630b22180d3731018a70b77270c726eElliott Hughes * @param overlayId The overlay id 625d10a87ea630b22180d3731018a70b77270c726eElliott Hughes * @param bitmap The bitmap to be used as an overlay. The size of the 635d10a87ea630b22180d3731018a70b77270c726eElliott Hughes * bitmap must equal to the size of the media item to which it is 645d10a87ea630b22180d3731018a70b77270c726eElliott Hughes * added. The bitmap is typically a decoded PNG file. 655d10a87ea630b22180d3731018a70b77270c726eElliott Hughes * @param startTimeMs The overlay start time in milliseconds 665d10a87ea630b22180d3731018a70b77270c726eElliott Hughes * @param durationMs The overlay duration in milliseconds 675d10a87ea630b22180d3731018a70b77270c726eElliott Hughes * 685d10a87ea630b22180d3731018a70b77270c726eElliott Hughes * @throws IllegalArgumentException if the file type is not PNG or the 695d10a87ea630b22180d3731018a70b77270c726eElliott Hughes * startTimeMs and durationMs are incorrect. 705d10a87ea630b22180d3731018a70b77270c726eElliott Hughes */ 715d10a87ea630b22180d3731018a70b77270c726eElliott Hughes public OverlayFrame(MediaItem mediaItem, String overlayId, Bitmap bitmap, 725d10a87ea630b22180d3731018a70b77270c726eElliott Hughes long startTimeMs,long durationMs) { 735d10a87ea630b22180d3731018a70b77270c726eElliott Hughes super(mediaItem, overlayId, startTimeMs, durationMs); 74cb69306eefc1e6e42b3eaec8b479a268222b01b6Elliott Hughes mBitmap = bitmap; 75cb69306eefc1e6e42b3eaec8b479a268222b01b6Elliott Hughes mFilename = null; 765d10a87ea630b22180d3731018a70b77270c726eElliott Hughes mBitmapFileName = null; 77cb69306eefc1e6e42b3eaec8b479a268222b01b6Elliott Hughes } 785d10a87ea630b22180d3731018a70b77270c726eElliott Hughes 795d10a87ea630b22180d3731018a70b77270c726eElliott Hughes /** 80cb69306eefc1e6e42b3eaec8b479a268222b01b6Elliott Hughes * Constructor for an OverlayFrame. This constructor can be used to 81cb69306eefc1e6e42b3eaec8b479a268222b01b6Elliott Hughes * restore the overlay after it was saved internally by the video editor. 82cb69306eefc1e6e42b3eaec8b479a268222b01b6Elliott Hughes * 835d10a87ea630b22180d3731018a70b77270c726eElliott Hughes * @param mediaItem The media item owner 845d10a87ea630b22180d3731018a70b77270c726eElliott Hughes * @param overlayId The overlay id 85872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * @param filename The file name that contains the overlay. 86872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * @param startTimeMs The overlay start time in milliseconds 8768a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes * @param durationMs The overlay duration in milliseconds 8868a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes * 895d10a87ea630b22180d3731018a70b77270c726eElliott Hughes * @throws IllegalArgumentException if the file type is not PNG or the 9068a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes * startTimeMs and durationMs are incorrect. 915d10a87ea630b22180d3731018a70b77270c726eElliott Hughes */ 9268a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes OverlayFrame(MediaItem mediaItem, String overlayId, String filename, 9368a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes long startTimeMs,long durationMs) { 945d10a87ea630b22180d3731018a70b77270c726eElliott Hughes super(mediaItem, overlayId, startTimeMs, durationMs); 955d10a87ea630b22180d3731018a70b77270c726eElliott Hughes mBitmapFileName = filename; 9668a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes mBitmap = BitmapFactory.decodeFile(mBitmapFileName); 9768a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes mFilename = null; 9868a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes } 9968a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes 10068a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes /** 10168a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes * Get the overlay bitmap. 10268a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes * 10368a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes * @return Get the overlay bitmap 10468a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes */ 10568a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes public Bitmap getBitmap() { 10668a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes return mBitmap; 10768a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes } 10868a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes 10968a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes /** 11068a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes * Get the overlay bitmap. 11168a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes * 11268a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes * @return Get the overlay bitmap as png file. 11368a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes */ 11468a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes String getBitmapImageFileName() { 11568a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes return mBitmapFileName; 11668a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes } 11768a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes /** 11868a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes * Set the overlay bitmap. 11968a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes * 12068a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes * @param bitmap The overlay bitmap. 12168a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes */ 12268a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes public void setBitmap(Bitmap bitmap) { 12368a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes mBitmap = bitmap; 124872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes if (mFilename != null) { 125872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes /** 126872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * Delete the file 127cb69306eefc1e6e42b3eaec8b479a268222b01b6Elliott Hughes */ 12850b35e2fd1a68cd1240e4a9d9f363e11764957d1Ian Rogers new File(mFilename).delete(); 129068193c6dd77e2204344ed75d1a25a4bc28fd7f4Elliott Hughes /** 130872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * Invalidate the filename 131872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes */ 132872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes mFilename = null; 133872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes } 134872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 135f52935278fca8c7aa220543eef4544e3d1105d91Brian Carlstrom /** 13650b35e2fd1a68cd1240e4a9d9f363e11764957d1Ian Rogers * Invalidate the transitions if necessary 137f52935278fca8c7aa220543eef4544e3d1105d91Brian Carlstrom */ 138872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes getMediaItem().invalidateTransitions(mStartTimeMs, mDurationMs); 139872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes } 140376a7a033d29d5f2b6e16574a340c999ff2999a0Elliott Hughes 14168a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes /** 142872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * Get the file name of this overlay 143872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes */ 144f52935278fca8c7aa220543eef4544e3d1105d91Brian Carlstrom String getFilename() { 14568a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes return mFilename; 14668a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes } 14768a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes 14868a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes /* 14968a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes * Set the file name of this overlay 15068a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes */ 15168a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes void setFilename(String filename) { 152f52935278fca8c7aa220543eef4544e3d1105d91Brian Carlstrom mFilename = filename; 15368a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes } 15468a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes /** 15568a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes * Save the overlay to the project folder 15668a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes * 157f52935278fca8c7aa220543eef4544e3d1105d91Brian Carlstrom * @param path The path where the overlay will be saved 15868a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes * 15968a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes * @return The filename 16068a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes * @throws FileNotFoundException if the bitmap cannot be saved 16168a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes * @throws IOException if the bitmap file cannot be saved 16268a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes */ 16368a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes String save(String path) throws FileNotFoundException, IOException { 16468a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes if (mFilename != null) { 16568a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes return mFilename; 16668a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes } 16768a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes 16868a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes // Create the compressed PNG file 16968a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes mBitmapFileName = path + "/" + "Overlay" + getId() + ".png"; 17068a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes if (!(new File(mBitmapFileName).exists())) { 17168a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes final FileOutputStream out = new FileOutputStream (mBitmapFileName); 17268a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes mBitmap.compress(CompressFormat.PNG, 100, out); 17368a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes out.flush(); 17468a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes out.close(); 17568a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes } 17668a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes 17768a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes mOFWidth = mBitmap.getWidth(); 17868a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes mOFHeight = mBitmap.getHeight(); 17968a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes 18068a5e3c9115f9ba396563ce3b72df9cb036bc665Elliott Hughes mFilename = path + "/" + "Overlay" + getId() + ".rgb"; 181872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes if (!(new File(mFilename).exists())) { 182872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes /** 183376a7a033d29d5f2b6e16574a340c999ff2999a0Elliott Hughes * Save the image to a file ; as a rgb 184376a7a033d29d5f2b6e16574a340c999ff2999a0Elliott Hughes */ 185376a7a033d29d5f2b6e16574a340c999ff2999a0Elliott Hughes final FileOutputStream fl = new FileOutputStream(mFilename); 186376a7a033d29d5f2b6e16574a340c999ff2999a0Elliott Hughes final DataOutputStream dos = new DataOutputStream(fl); 187376a7a033d29d5f2b6e16574a340c999ff2999a0Elliott Hughes 188f8349361a16a4e2796efe9f3586b994e8d4834e4Elliott Hughes /** 189872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * populate the rgb file with bitmap data 190872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes */ 191376a7a033d29d5f2b6e16574a340c999ff2999a0Elliott Hughes final int [] framingBuffer = new int[mOFWidth]; 192376a7a033d29d5f2b6e16574a340c999ff2999a0Elliott Hughes ByteBuffer byteBuffer = ByteBuffer.allocate(framingBuffer.length * 4); 193376a7a033d29d5f2b6e16574a340c999ff2999a0Elliott Hughes IntBuffer intBuffer; 194376a7a033d29d5f2b6e16574a340c999ff2999a0Elliott Hughes 195376a7a033d29d5f2b6e16574a340c999ff2999a0Elliott Hughes byte[] array = byteBuffer.array(); 196f8349361a16a4e2796efe9f3586b994e8d4834e4Elliott Hughes int tmp = 0; 197872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes while(tmp < mOFHeight) { 198872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes mBitmap.getPixels(framingBuffer,0,mOFWidth,0,tmp,mOFWidth,1); 199376a7a033d29d5f2b6e16574a340c999ff2999a0Elliott Hughes intBuffer = byteBuffer.asIntBuffer(); 200376a7a033d29d5f2b6e16574a340c999ff2999a0Elliott Hughes intBuffer.put(framingBuffer,0,mOFWidth); 2010dfbb7ead0b6da92911b4bc78114ff0f0f9b4129jeffhao dos.write(array); 202c604d731730b43231f63040c8db1d58304da0cf3Ian Rogers tmp += 1; 20300f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers } 20400f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers fl.flush(); 205872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes fl.close(); 206a21039c3ae2b20e44ceb2735251c04d0aac89afdElliott Hughes } 207872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes return mFilename; 208872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes } 2090dfbb7ead0b6da92911b4bc78114ff0f0f9b4129jeffhao 210c604d731730b43231f63040c8db1d58304da0cf3Ian Rogers /** 211a21039c3ae2b20e44ceb2735251c04d0aac89afdElliott Hughes * Get the OverlayFrame Height 212f8349361a16a4e2796efe9f3586b994e8d4834e4Elliott Hughes */ 213f8349361a16a4e2796efe9f3586b994e8d4834e4Elliott Hughes int getOverlayFrameHeight() { 214a77f0f68a59870ff027dad654fe31eb3fdaf3d5djeffhao return mOFHeight; 215f8349361a16a4e2796efe9f3586b994e8d4834e4Elliott Hughes } 216f8349361a16a4e2796efe9f3586b994e8d4834e4Elliott Hughes 217872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes /** 218c604d731730b43231f63040c8db1d58304da0cf3Ian Rogers * Get the OverlayFrame Width 219a21039c3ae2b20e44ceb2735251c04d0aac89afdElliott Hughes */ 22064f574f474aa77c72778640ab21f8cfa72546812Elliott Hughes int getOverlayFrameWidth() { 22164f574f474aa77c72778640ab21f8cfa72546812Elliott Hughes return mOFWidth; 22264f574f474aa77c72778640ab21f8cfa72546812Elliott Hughes } 223872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 224872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes /* 225872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * Set the OverlayFrame Height 226872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes */ 227872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes void setOverlayFrameHeight(int height) { 228872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes mOFHeight = height; 229872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes } 230872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes 231376a7a033d29d5f2b6e16574a340c999ff2999a0Elliott Hughes /* 23281d425b0b232962441616f8b14f73620bffef5e5Ian Rogers * Set the OverlayFrame Width 23381d425b0b232962441616f8b14f73620bffef5e5Ian Rogers */ 234761928d24e4e7ed7776b52243eaf9095ad35f448Elliott Hughes void setOverlayFrameWidth(int width) { 235376a7a033d29d5f2b6e16574a340c999ff2999a0Elliott Hughes mOFWidth = width; 236872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes } 2375d10a87ea630b22180d3731018a70b77270c726eElliott Hughes /** 238872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes * Delete the overlay file 239872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes */ 240872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes void invalidate() { 2415d10a87ea630b22180d3731018a70b77270c726eElliott Hughes if (mFilename != null) { 242872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes new File(mFilename).delete(); 243872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes mFilename = null; 244872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes mBitmap.recycle(); 245376a7a033d29d5f2b6e16574a340c999ff2999a0Elliott Hughes mBitmap = null; 246872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes } 247872d4ec7225444d9400d30f9027247deb91012fdElliott Hughes } 248add037df2399821eb048a5d9146a9d2174bcd1bdJeff Hao} 249add037df2399821eb048a5d9146a9d2174bcd1bdJeff Hao