Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Camera frame model

ICameraFrameModel is derived from IFrameModel and provides image frames from a camera.

The camera image is managed by an ICamera object and wrapped by the camera frame model. Frame changes are sent to listeners, which are usually frame widgets.

Using camera frame model

  1. Create an instance of the frame widget using AEECLSID_CFrameWidget, as follows:
    ISHELL_CreateInstance(me->piShell, AEECLSID_CFrameWidget, 
                (void**)&me->piwFrame);
  2. Create an instance of the ICamera object using AEECLSID_CAMERA:
    ISHELL_CreateInstance(me->piShell, AEECLSID_CAMERA, (void**)&me->piCamera);
  3. Set the camera size and display size by calling ICamera_SetSize() and ICamera_SetDisplaySize(). For example:
    if (AEE_SUCCESS == nErr) {
       AEESize size;
       size.cx = me->rcContainer.dx;
       size.cy = me->rcContainer.dy - BUTTON_WIDTH;
       
       if (AEE_SUCCESS == nErr) {
          nErr = ICamera_SetSize(me->piCamera, &size);
          if (AEE_SUCCESS == nErr) {
             nErr = ICamera_SetDisplaySize(me->piCamera, &size);
             if (AEE_SUCCESS != nErr) {
                // error handling code
                return;
             }
          }
          else {
             // error handling code
             return; 
          }
       }
    }
  4. Create an instance of the CameraFrameModel by using AEECLSID_CCameraFrameModel, as follows:
    ISHELL_CreateInstance(me->piShell, AEECLSID_CCameraFrameModel, 
                (void**)&piModel);
  5. Set the ICamera instance on the CameraFrameModel by calling ICameraFrameModel_SetICamera().
    ICameraFrameModel_SetICamera(piModel, me->piCamera);
  6. Set the model on the frame widget by calling IWidget_SetModel(), as follows:
    nErr = IWidget_SetModel(me->piwFrame, (IModel*)(void *)piModel);
  7. Start camera by calling ICamera_Preview().
    ICamera_Preview(me->piCamera);