void MdispGtkView::GrabStart() { // TODO: Add your command handler code here ///////////////////////////////////////////////////////////////////////// // MIL: Write code that will be executed on a grab start ///////////////////////////////////////////////////////////////////////// // If there is a grab in a view, halt the grab before starting a new one if(((MdispGtkApp*)dispGtkApp())->m_isGrabStarted) ((MdispGtkApp*)dispGtkApp())->m_pGrabView->GrabStop(); // Start a continuous grab in this view MdigGrabContinuous(((MdispGtkApp*)dispGtkApp())->m_MilDigitizer, m_MilImage); // Update the variable GrabIsStarted ((MdispGtkApp*)dispGtkApp())->m_isGrabStarted = true; // GrabInViewPtr is now a pointer to m_pGrabView view ((MdispGtkApp*)dispGtkApp())->m_pGrabView = this; // Document has been modified m_Modified = true; ///////////////////////////////////////////////////////////////////////// // MIL: Write code that will be executed on a grab start ///////////////////////////////////////////////////////////////////////// }
/*************************** toma2_continua ********************************** Función para la adquisición de imágenes en modo continuado. Modo enfoque. *****************************************************************************/ void toma2_continua(MIL_ID M_fb) { if (M_fb!=M_NULL) { if (! tomaContinua) MdigGrabContinuous (M_digitalizador, M_fb); tomaContinua = true; } }
bool MdispGtkView::save(const char *filename) { gboolean SaveStatus; gchar * TempPath; long FileFormat = M_MIL; gchar *tmp; // Get extension for file format determination TempPath = g_ascii_strup(filename,-1); //Set the file format to M_MIL when the filepath extension is ".MIM" if (g_str_has_suffix(TempPath,".MIM")) FileFormat = M_MIL; //Set the file format to M_TIFF when the filepath extension is ".TIF" else if (g_str_has_suffix(TempPath,".TIF")) FileFormat = M_TIFF; //Set the file format to M_BMP when the filepath extension is ".BMP" else if (g_str_has_suffix(TempPath,".BMP")) FileFormat = M_BMP; //Set the file format to M_JPEG_LOSSY when the filepath extension is ".JPG" else if (g_str_has_suffix(TempPath,".JPG")) FileFormat = M_JPEG_LOSSY; //Set the file format to M_JPEG2000_LOSSLESS when the filepath extension is ".JP2" else if (g_str_has_suffix(TempPath,".JP2")) FileFormat = M_JPEG2000_LOSSLESS; //Set the file format to M_RAW when the filepath extension is ".RAW" else if (g_str_has_suffix(TempPath,".RAW")) FileFormat = M_RAW; // Halt the grab if the current view has it [CALL TO MIL] if((((MdispGtkApp*)dispGtkApp())->m_pGrabView == this) && (((MdispGtkApp*)dispGtkApp())->m_isGrabStarted == true)) MdigHalt(((MdispGtkApp*)dispGtkApp())->m_MilDigitizer); // Save the current buffer [CALL TO MIL] tmp = g_strdup(filename); MbufExport(tmp, FileFormat,m_MilImage); g_free(tmp); // Verify if save operation was successful [CALL TO MIL] SaveStatus = (MappGetError(M_CURRENT,M_NULL) == M_NULL_ERROR); // Document has been saved if (!((((MdispGtkApp*)dispGtkApp())->m_pGrabView == this) && (((MdispGtkApp*)dispGtkApp())->m_isGrabStarted == true))) m_Modified = false; // Restart the grab if the current view had it [CALL TO MIL] if((((MdispGtkApp*)dispGtkApp())->m_pGrabView == this) && (((MdispGtkApp*)dispGtkApp())->m_isGrabStarted == true)) MdigGrabContinuous(((MdispGtkApp*)dispGtkApp())->m_MilDigitizer, m_MilImage); return SaveStatus; }
/* Main function. */ int MosMain(void) { MIL_ID MilApplication; MIL_ID MilSystem; MIL_ID MilDigitizer[2]; MIL_ID MilDisplay[2]; MIL_ID MilImageDisp[2]; /* Allocations. */ MappAlloc(M_DEFAULT, &MilApplication); MsysAlloc(MIL_TEXT("M_DEFAULT"), M_DEFAULT, M_DEFAULT, &MilSystem); MdigAlloc(MilSystem, M_DEV0, MIL_TEXT("M_DEFAULT"), M_DEFAULT, &MilDigitizer[0]); MdigAlloc(MilSystem, M_DEV1, MIL_TEXT("M_DEFAULT"), M_DEFAULT, &MilDigitizer[1]); MdispAlloc(MilSystem, M_DEFAULT, MIL_TEXT("M_DEFAULT"), M_DEFAULT, &MilDisplay[0]); MdispAlloc(MilSystem, M_DEFAULT, MIL_TEXT("M_DEFAULT"), M_DEFAULT, &MilDisplay[1]); /* Allocate 2 display buffers and clear them. */ MbufAlloc2d(MilSystem, (MIL_INT)(MdigInquire(MilDigitizer[0], M_SIZE_X, M_NULL)*GRAB_SCALE), (MIL_INT)(MdigInquire(MilDigitizer[0], M_SIZE_Y, M_NULL)*GRAB_SCALE), 8L+M_UNSIGNED, M_IMAGE+M_GRAB+M_PROC+M_DISP, &MilImageDisp[0]); MbufClear(MilImageDisp[0], 0x0); MbufAlloc2d(MilSystem, (MIL_INT)(MdigInquire(MilDigitizer[1], M_SIZE_X, M_NULL)*GRAB_SCALE), (MIL_INT)(MdigInquire(MilDigitizer[1], M_SIZE_Y, M_NULL)*GRAB_SCALE), 8L+M_UNSIGNED, M_IMAGE+M_GRAB+M_PROC+M_DISP, &MilImageDisp[1]); MbufClear(MilImageDisp[1], 0x80); /* Display the buffers. */ MdispSelect(MilDisplay[0], MilImageDisp[0]); MdispSelect(MilDisplay[1], MilImageDisp[1]); /* Grab continuously on displays at the specified scale. */ MdigControl(MilDigitizer[0], M_GRAB_SCALE, GRAB_SCALE); MdigGrabContinuous(MilDigitizer[0],MilImageDisp[0]); MdigControl(MilDigitizer[1], M_GRAB_SCALE, GRAB_SCALE); MdigGrabContinuous(MilDigitizer[1],MilImageDisp[1]); /* Print a message. */ MosPrintf(MIL_TEXT("Press <Enter> to stop continuous grab.\n")); MosGetch(); /* Halt continuous grab. */ MdigHalt(MilDigitizer[0]); MdigHalt(MilDigitizer[1]); /* Print a message. */ MosPrintf(MIL_TEXT("Press <Enter> to end.\n")); MosGetch(); /* Free allocations. */ MbufFree(MilImageDisp[0]); MbufFree(MilImageDisp[1]); MdispFree(MilDisplay[0]); MdispFree(MilDisplay[1]); MdigFree(MilDigitizer[0]); MdigFree(MilDigitizer[1]); MsysFree(MilSystem); MappFree(MilApplication); return 0; }