Try using a known bitmap config.
Dono if this is ok,... here it goes:

public Bitmap loadRGBA(String filename) throws Exception{
  File sdDir = Enviroment.getExternalStorageDirectory();  //Base
SDCard folder
  File f = new File(sdDir, filename); //relative path+filename from
SDCard
  Bitmap im = BitmapFactory.decodeFile(f.getAbsolutePath());
  im = im.copy(Config.ARGB_8888), false); //ARGB_8888 is more
compatible
  if (im==null) throw new Exception("Error generating bitmap.");
end;

!!! Now that you have your bitmap in known formar, just use it..

Bitmap dummy = loadRGBA("myDummy.jpg");
int w = dummy.getWidth();
int h = dummy.get-height();
byte[] data = new byte[w*h*4];
Buffer buf = new ByteBuffer.wrap(data);
dummy.copyPixelsToBuffer(buf);
yourComputImge(buf);
dummy.copyPixelsFrom(buf); //Updates the bitmap
//Save it, or display it

There may be some errors in code and may have some wrong names, it all
came from my bad brain.
Hope it helps

On 12 Fev, 19:15, Jim Graham <[email protected]> wrote:
> I've tried loading it as a resource into BitmapFactory, loading it from
> assets, res/drawable, res/raw (that one force closed), and God only knows
> what else (I lost track).
>
> What I'm trying to to is open a jpeg (one or more of many) as a filter
> that will be applied over the camera preview (and after the picture is
> taken, applied to the actual result).  Before I can use it, however, I
> need to resize it to match the preview size (and later the image size)
> and, using a ColorMatrix (such as the one below) to change the image to
> be somewhat transparent, and allow the user to adjust it further).
>
> Here's the matrix I think (if I've understood things correectly) will
> make the jpeg more or less transparent (I'll be playing around with the
> exact values once I get this working):
>
>    1 0 0 0 0
>    0 1 0 0 0
>    0 0 1 0 0
>    0 0 0 0.25 0
>
> I know I'm missing something obvious on loading the jpeg as a bitmap,
> but after spending a couple of days in the developers guide, whatever
> it is, I've probably seen it and missed it over and over again.....
>
> Can anyone please point me in the right direction?
>
> Thanks,
>    --jim
>
> --
> THE SCORE:  ME:  2  CANCER:  0
> 73 DE N5IAL (/4)            MiSTie #49997      < Running FreeBSD 7.0 >
> [email protected]                    ICBM/Hurr.: 30.44406N 86.59909W
>
>                    Saw something on TV about Psych-os.
>              Hmmmm, Psych OS.  Perhaps the next freeware OS....   --me
>
> Android Apps Listing athttp://www.jstrack.org/barcodes.html

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to