Picture 1: Using Screen Capture of Micro Station in Built Tool, We Got This Quality of Image

Picture 1: Using Screen Capture of Micro Station in Built Tool, We Got This Quality of Image

<p>Picture 1: Using Screen capture of Micro Station in built tool, we got this quality of image.</p><p>Picture 2: Using the below given code chdlg.mc of Bentley, we are able to get this quality of image. (Quality of image is lost when compared to the picture 1). How to retain the same quality of image ???.</p><p>I tried:</p><p>1) Using different parameters of mdlImage_extMapToRGB with mdlImage_createFileFromRGB.</p><p>2) Using different parameters of mdlImage_extCreateFileFromMap</p><p>Parameters include Image file type, Image colour mode, compression types ..etc</p><p>/*------+ | | chdlg.mc | +------*/ /*------+ | | STATUS: WORKING | DATE: 1/28/2002 2:02:24 PM | | This example illustrates how to capture the screen before file closes. | +------*/ /*------+ | | Include Files | +------*/ #include <mdl.h> #include <cexpr.h> #include <cmdlist.h> #include <image.h> #include <mdlerrs.h> #include <stdlib.h> #include <string.h></p><p>#include <dlogman.fdf> #include <msfilutl.h> #include <msimage.fdf> #include <msimage.fdf> #include <msinput.fdf> #include <msinput.fdf> #include <msmisc.fdf> #include <msoutput.fdf> #include <msrsrc.fdf> #include <msstate.fdf> #include <mssystem.fdf> #include <msvar.fdf> #include <msvar.fdf> #include <msview.fdf></p><p>/*------+ | | Public variables | +------*/ /*------+ | | External variables | +------*/ /*------+ | | Function Definitions | +------*/ /*------+ | | Function Declarations | +------*/ /*------+ | | name exitApplication | | author BSI 12/1998 | +------*/ Private void exitApplication ( boolean silently /* => Unload this application silently */ ) { /*------Queue a command to unload the application with/without displaying a notification message. ------*/ mdlDialog_cmdNumberQueue (FALSE, (silently) ? CMD_MDL_SILENTUNLOAD : CMD_MDL_UNLOAD, mdlSystem_getCurrTaskID (), TRUE);</p><p>/* Start the default command */ mdlState_startDefaultCommand (); }</p><p>/*------+ | | name openResources | | author BSI 12/1998 | +------*/ Private void openResources ( void ) { RscFileHandle rscH; /* A resource file handle */</p><p> if (mdlResource_openFile (&rscH, NULL, RSC_READONLY) != SUCCESS) { mdlOutput_error ("Unable to load Resource File."); } }</p><p>/*------+ | | name buildOutFileName | | author BSI 1/2001 | +------*/ Public int buildOutFileName ( char *fileNameWithPath, /* <= File name with full path size to MAXFILELENGTH*/ char *extension /* => File Extension to append size to MAXEXTENSIONLENGTH*/ ) { char filename[MAXFILELENGTH], device[MAXDEVICELENGTH], dir[MAXDIRLENGTH], currentExt[MAXEXTENSIONLENGTH];</p><p>/* Obtain the name of the current deign file */ mdlFile_parseName (tcb->dgnfilenm, device, dir, filename, currentExt); /* Build new file with current DGN name and specified extension */ mdlFile_buildName (fileNameWithPath, device, dir, filename, extension);</p><p>/* Verify successful build of file name with path */ if (*fileNameWithPath == NULL) { return !SUCCESS; }</p><p> return SUCCESS; }</p><p>/*------+ | | name saveDLG | | author BSI 01/2002 | +------*/ void saveDLG ( char *filenameP, /* => name of file */ int state /* => SYSTEM_NEWFILE_CLOSE, SYSTEM_NEWFILE_COMPLETE */ ) { byte *inputMap; byte redMap [256]; byte grnMap [256]; byte bluMap [256]; Point2d palletSize; MSWindow *windowP = NULL; MSWindow *lastWindowP = NULL; DialogBox *dlgP = NULL; Rectangle rectangle; char fileName [MAXFILELENGTH +1]; int size = 0; int fileType = 0;</p><p> if (state == SYSTEM_NEWFILE_CLOSE) {</p><p>/* Prompt user to save or not */ if (mdlDialog_openMessageBox (DIALOGID_MsgBoxYesNo, "Do you want to save?", MSGBOX_ICON_QUESTION) == ACTIONBUTTON_YES) {</p><p>/* Get last view */ lastWindowP = mdlWindow_viewWindowGet (tcb->lstvw); mdlWindow_maximize (lastWindowP);</p><p>/* Bring window to front */ mdlWindow_toFront (lastWindowP);</p><p>//lastWindowP = mdlDialog_find (DIALOGID_MsgBoxYesNo, NULL); mdlWindow_windowEventsProcessAll();</p><p>/* Close the tools settings bialog box */ dlgP = mdlDialog_find (DIALOGID_ToolSettings, "MGSHOOK"); mdlWindow_hide (dlgP, FALSE, FALSE); </p><p>/* Update view */ mdlView_updateSingle (tcb->lstvw);</p><p>/* Get the window rectangle */ windowP = mdlWindow_viewWindowGet (tcb->lstvw); mdlWindow_contentRectGetGlobal (&rectangle, windowP);</p><p>/* Rectangle to capture. */ palletSize.x = rectangle.corner.x - rectangle.origin.x + 1; palletSize.y = rectangle.corner.y - rectangle.origin.y + 1;</p><p>/* Capture the screen */ mdlImage_captureScreenMap (&inputMap, &rectangle, statedata.current.screenNumber);</p><p>/* Get the screen palette */ mdlImage_getScreenPalette (redMap, grnMap, bluMap, &size, tcb- >lstvw);</p><p>/* Build file name */ buildOutFileName (fileName, "jpg");</p><p>// Get file type fileType = mdlImage_typeFromExtension (fileName);</p><p>// Convert to an RGB mdlImage_extMapToRGB (&inputMap, /* <= image buffer (RGB) */ inputMap, /* => image map */ &palletSize, /* => image size */ redMap, /* => red palette entries */ grnMap, /* => green palette entries */ bluMap, /* => blue palette entries */ FALSE, /* => pack bytes (run length encode) */ NULL); /* => stop function (or NULL) */</p><p>// Create the file mdlImage_createFileFromRGB (fileName, /* => name of file */ fileType, /* => type of file (see image.h) */ COLORMODE_RGB, /* => color mode (see image.h) */ &palletSize, /* => size of image */ inputMap, /* => RGB values for each pixel */ NULL); /* => stop function (or NULL) */</p><p>/* Show the tools settings. */ mdlDialog_show (dlgP);</p><p>/* Free memory */ if (inputMap) free (inputMap); }</p><p>} }</p><p>/*------+ | | name main | | author BSI 01/2002 | +------*/ Private int main ( int argc, /* => Number of arguments passed in argv */ char *argv[] /* => Array of pointers to arguments */ ) { /* Open our application for use with the Resource Manager */ openResources ();</p><p> mdlSystem_setFunction (SYSTEM_NEW_DESIGN_FILE, saveDLG);</p><p> return SUCCESS; }</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    7 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us