Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java me 记录库和手机拍摄的照片_Java Me_Photo_Lwuit_Rms_Recordstore - Fatal编程技术网

Java me 记录库和手机拍摄的照片

Java me 记录库和手机拍摄的照片,java-me,photo,lwuit,rms,recordstore,Java Me,Photo,Lwuit,Rms,Recordstore,当用户用手机拍照时,我希望Lwiit获得一张特定的照片,添加到记录库中,然后检索该照片。如何做到这一点?不适合存储照片。因为RMS设计用于少量存储。你不能处理大量的数据。您最好能从手机存储器或存储卡中读取数据。还有,如何在没有应用程序的情况下拍摄当前拍摄的照片 编辑: 您可以为开发应用程序并将其存储在RMS中(但不是大量),也可以通过调用将其存储在服务器中。好的,我让应用程序通过以下命令启动相机: mPlayer = Manager.createPlayer("capture://video")

当用户用手机拍照时,我希望Lwiit获得一张特定的照片,添加到记录库中,然后检索该照片。如何做到这一点?

不适合存储照片。因为RMS设计用于少量存储。你不能处理大量的数据。您最好能从手机存储器或存储卡中读取数据。还有,如何在没有应用程序的情况下拍摄当前拍摄的照片

编辑:


您可以为开发应用程序并将其存储在RMS中(但不是大量),也可以通过调用将其存储在服务器中。

好的,我让应用程序通过以下命令启动相机:

mPlayer = Manager.createPlayer("capture://video");
mPlayer.realize();

mVideoControl = (VideoControl) mPlayer.getControl("VideoControl");

Canvas canvas = new CameraCanvas(this, mVideoControl);
canvas.addCommand(mBackCommand);
canvas.addCommand(mCaptureCommand);
canvas.setCommandListener(this);
mDisplay.setCurrent(canvas);
mPlayer.start();
public void capture() {
        try {
            // Get the image.
            byte[] raw = mVideoControl.getSnapshot(null);
//                    "encoding=png&width=320&height=240");
            bytelen = raw.length;
            Image image = Image.createImage(raw, 0, raw.length);

            Image thumb = createThumbnail(image);

            // Place it in the main form.
            if (mMainForm.size() > 0 && mMainForm.get(0) instanceof StringItem) {
                mMainForm.delete(0);
            }
            mMainForm.append(thumb);

            // Flip back to the main form.
            mDisplay.setCurrent(mMainForm);

            // Shut down the player.
            mPlayer.close();
            mPlayer = null;
            mVideoControl = null;
        } catch (MediaException me) {
            handleException(me);
        }
    }
在mCaptureCommand的actionPerformed中:

mPlayer = Manager.createPlayer("capture://video");
mPlayer.realize();

mVideoControl = (VideoControl) mPlayer.getControl("VideoControl");

Canvas canvas = new CameraCanvas(this, mVideoControl);
canvas.addCommand(mBackCommand);
canvas.addCommand(mCaptureCommand);
canvas.setCommandListener(this);
mDisplay.setCurrent(canvas);
mPlayer.start();
public void capture() {
        try {
            // Get the image.
            byte[] raw = mVideoControl.getSnapshot(null);
//                    "encoding=png&width=320&height=240");
            bytelen = raw.length;
            Image image = Image.createImage(raw, 0, raw.length);

            Image thumb = createThumbnail(image);

            // Place it in the main form.
            if (mMainForm.size() > 0 && mMainForm.get(0) instanceof StringItem) {
                mMainForm.delete(0);
            }
            mMainForm.append(thumb);

            // Flip back to the main form.
            mDisplay.setCurrent(mMainForm);

            // Shut down the player.
            mPlayer.close();
            mPlayer = null;
            mVideoControl = null;
        } catch (MediaException me) {
            handleException(me);
        }
    }
createThumbnail的代码:

private Image createThumbnail(Image image) {
        int sourceWidth = image.getWidth();
        int sourceHeight = image.getHeight();

        int thumbWidth = 64;
        int thumbHeight = -1;

        if (thumbHeight == -1) {
            thumbHeight = thumbWidth * sourceHeight / sourceWidth;
        }

        Image thumb = Image.createImage(thumbWidth, thumbHeight);
        Graphics g = thumb.getGraphics();

        for (int y = 0; y < thumbHeight; y++) {
            for (int x = 0; x < thumbWidth; x++) {
                g.setClip(x, y, 1, 1);
                int dx = x * sourceWidth / thumbWidth;
                int dy = y * sourceHeight / thumbHeight;
                g.drawImage(image, x - dx, y - dy, Graphics.LEFT | Graphics.TOP);
            }
        }
        Image immutableThumb = Image.createImage(thumb);
        return immutableThumb;
    }
私有图像创建缩略图(图像){
int sourceWidth=image.getWidth();
int sourceHeight=image.getHeight();
int thumbWidth=64;
int thumbHeight=-1;
如果(拇指高度==-1){
thumbHeight=thumbWidth*sourceHeight/sourceWidth;
}
Image thumb=Image.createImage(拇指宽度、拇指高度);
Graphics g=thumb.getGraphics();
对于(int y=0;y

现在我不知道调用createThumbnail方法时图像存储在哪里,也就是在调用Image.createImage之后:有两个createImage调用,一个在capture()方法中,一个在createThumbnail()方法中。但我真正的问题是知道创建的映像的位置,以及如何将其与银行客户记录存储id关联。

您打算通过应用程序拍摄照片吗?@bhakki:不,照片是由用户手动拍摄的。那么,为什么要将其存储到RMS中?只是从手机存储器或存储卡中获取。@bhakki:但是如何建立照片和记录存储id之间的关系呢?例如,有一家银行客户的档案库,信贷代理将为该客户的汽车拍照,作为抵押证明。那么,如何建立这种关系呢?如何为图像指定文件名呢?例如,在我上面的代码中:Image immutableThumb=Image.createImage(thumb);如何为该映像指定名称,或者该映像在创建时是否获得系统生成的名称?如果是的话,如何得到这个?这是因为我想使用JSR75(FileConnection)来创建与映像关联的物理文件。尽管在使用JSR75(Connector.open())时,我们必须为要操作的文件提供一个名称。那么如何获得图像的名称呢?