00001 /************************************************************************* 00002 * $Id: dyimawin32.c,v 1.3 2005/09/22 15:14:37 yougz Exp $ 00003 ************************************************************************** 00004 This software is governed by the CeCILL license under French law and 00005 abiding by the rules of distribution of free software. You can use, 00006 modify and/ or redistribute the software under the terms of the CeCILL 00007 license as circulated by CEA, CNRS and INRIA at the following URL 00008 "http://www.cecill.info". 00009 00010 As a counterpart to the access to the source code and rights to copy, 00011 modify and redistribute granted by the license, users are provided only 00012 with a limited warranty and the software's author, the holder of the 00013 economic rights, and the successive licensors have only limited 00014 liability. 00015 00016 In this respect, the user's attention is drawn to the risks associated 00017 with loading, using, modifying and/or developing or reproducing the 00018 software by the user in light of its specific status of free software, 00019 that may mean that it is complicated to manipulate, and that also 00020 therefore means that it is reserved for developers and experienced 00021 professionals having in-depth computer knowledge. Users are therefore 00022 encouraged to load and test the software's suitability as regards their 00023 requirements in conditions enabling the security of their systems and/or 00024 data to be ensured and, more generally, to use and operate it in the 00025 same conditions as regards security. 00026 00027 The fact that you are presently reading this means that you have had 00028 knowledge of the CeCILL license and that you accept its terms. 00029 00030 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de 00031 l'Image). All rights reserved. See License.txt for details. 00032 00033 Version 1.0 05/09/2005 00034 *************************************************************************/ 00035 00036 #if defined(_MSC_VER) 00037 00038 #include "idima.h" 00039 #include "iderr.h" 00040 #include "idacr.h" 00041 00042 #include <dos.h> 00043 #include <windows.h> 00044 00045 00046 00047 /************************************************************************* 00048 * | | 00049 * REVISIONS : DATE | AUTEUR | DESCRIPTION 00050 *---------------------|--------------|------------------------------------ 00051 * 12/11/92 | Ch. Mathieu | Prise en charge de tous les 00052 * | | parametres de IdImaDisplay() 00053 * 26/11/92 | Ch. Mathieu | Fonction de zoom. 00054 **************************************************************************/ 00055 00056 /* FUNCTION DESCRIPTION **************************************************** 00057 * 00058 * IdImaDisplayColor (macro) 00059 * 00060 * RESUME: Positionne une image 8 bits avec une palette couleur sur un ecran 00061 * 00062 * DESCRIPTION: Positionne une zone d'une image 8 bits commencant en (x,y) de 00063 * largeurs (nx,ny) a la position (ox,oy) dans le display 00064 * avec une palette couleur 00065 * 00066 * UTILISEZ PLUTOT IdImaDisplayColorQ (+ simple) 00067 * 00068 * SYNTAXE: void IdImaDisplayColor (PPIMAGE_UCHAR im,int modAff ,int offsetX, int offsetY,int tailleFenX,int tailleFenY, int posX, int posY, PSIGNAL_RGB pal); 00069 * 00070 * RETOUR : type : rien 00071 * role : cf resume. 00072 * 00073 * 00074 * PARAMETRES: nom : im 00075 * type : PPIMAGE_UCHAR 00076 * role : Pointeur vers l'image source 00077 * 00078 * nom : modAff 00079 * type : int 00080 * role : param d'affichage (depend du systeme) 00081 * pair: meme fenetre impair: nouvelle fenetre 00082 * images 8 bits: 00083 * 0-1 128 gris/couleurs garantis 00084 * 2-3 256 gris/couleurs non garantis 00085 * 4-5 256 gris/couleurs garantis 00086 * images 24 bits: 00087 * 16 millions de couleurs garanties (sur Serveur True Color) 00088 * 00089 * ATTENTION : pour des 'DISPLAY' pairs les images doivent 00090 * avoir TOUTES la meme taille (NX, NY) 00091 * ATTENTION : les 'DISPLAY' pairs n'ont pas d'effet sur PC 00092 * 00093 * Voir LibIDO Graphique (UTILIW/visuseri) 00094 * si ca vous pose des pb 00095 * 00096 * 00097 * nom : offsetX,offsetY 00098 * type : int 00099 * role : offset de depart en x,y 00100 * 00101 * nom : tailleFenX,tailleFenY 00102 * type : int 00103 * role : taille en X, Y de l'image produite 00104 * 00105 * nom : posX,posY 00106 * type : int 00107 * role : position en x,y dans le display 00108 * 00109 * nom : pal 00110 * type : PSIGNAL_RGB 00111 * role : pointeur vers la palette 00112 * 00113 * FICHIER: DYIMAX.c 00114 * 00115 * EXEMPLE: 00116 * 00117 ******************************************************** END DESCRIPTION */ 00118 00119 /* FUNCTION DESCRIPTION **************************************************** 00120 * 00121 * IdImaDisplay (macro) 00122 * 00123 * RESUME: Positionne 1 zone d'1 image 8 bits en 128 niveaux de gris 00124 * 00125 * DESCRIPTION: Positionne une zone d'une image 8 bits commencant en (x,y) de 00126 * largeurs (nx,ny) a la position (ox,oy) dans le display 00127 * 00128 * UTILISEZ PLUTOT IdImaDisplayQ (+ simple) 00129 * 00130 * SYNTAXE: void IdImaDisplay (PPIMAGE_UCHAR im,int modAff ,int offsetX, int offsetY,int tailleFenX,int tailleFenY, int posX, int posY); 00131 * 00132 * RETOUR : type : rien 00133 * role : cf resume. 00134 * 00135 * PARAMETRES: nom : im 00136 * type : PPIMAGE_UCHAR 00137 * role : Pointeur vers l'image source 00138 * 00139 * nom : modAff 00140 * type : int 00141 * role : param d'affichage (depend du systeme) 00142 * pair: meme fenetre impair: nouvelle fenetre 00143 * images 8 bits: 00144 * 0-1 128 gris/couleurs garantis 00145 * 2-3 256 gris/couleurs non garantis 00146 * 4-5 256 gris/couleurs garantis 00147 * images 24 bits: 00148 * 16 millions de couleurs garanties (sur Serveur True Color) 00149 * 00150 * ATTENTION : pour des 'DISPLAY' pairs les images doivent 00151 * avoir TOUTES la meme taille (NX, NY) 00152 * ATTENTION : les 'DISPLAY' pairs n'ont pas d'effet sur PC 00153 * 00154 * Voir LibIDO Graphique (UTILIW/visuseri) 00155 * si ca vous pose des pb 00156 * 00157 * nom : offsetX,offsetY 00158 * type : int 00159 * role : offset de depart en x,y 00160 * 00161 * nom : tailleFenX,tailleFenY 00162 * type : int 00163 * role : taille en X, Y de l'image produite 00164 * 00165 * nom : posX,posY 00166 * type : int 00167 * role : position en x,y dans le display 00168 * 00169 * nom : pal 00170 * type : PSIGNAL_RGB 00171 * role : pointeur vers la palette. 00172 * 00173 * FICHIER: DYIMAX.c 00174 * 00175 * EXEMPLE: 00176 * 00177 ******************************************************** END DESCRIPTION */ 00178 00179 char buff[180]; 00180 00181 void _IdImaDisplayColor(PPIMAGE_UCHAR ims, 00182 int display, 00183 int x, int y, int nx, int ny, int ox, int oy, 00184 PSIGNAL_RGB pal) 00185 { 00186 UINT retCode; 00187 #ifdef _IWWIN95_ 00188 static int res; 00189 LPSTARTUPINFO lpstartinfo; 00190 PROCESS_INFORMATION procinfo; 00191 #endif 00192 // CAVEAT EMPTOR : all this code assumes the libido Win32 installation 00193 // process was done : 00194 // 1/ on disk C: 00195 // 2/ inside the C:\Creatis\Libido directory and that 00196 // C:\Creatis\Libido\bin\affimwin.exe is correct binary 00197 // 3/ a C:\Creatis\Libido\tmp directory exists 00198 // Those assumptions are NOT verified and no debug message is printed 00199 // on console. You've been warned... 00200 00201 char *fn; 00202 IdAcrWriteFile("_imtmp_.acr",ims); 00203 strcpy(buff,"affimwin filein=_imtmp_.acr name="); 00204 fn=IdGetFileName(ims); 00205 if(fn)strcat(buff,fn); 00206 if (pal) { 00207 IdPalWriteAsciiFile("_paltmp_.asc",pal); 00208 strcat(buff,"filepal=_paltmp_.asc"); 00209 } 00210 00211 #ifdef _IWWIN95_ 00212 lpstartinfo=(LPSTARTUPINFO)calloc(1,sizeof(STARTUPINFO)); 00213 lpstartinfo->cb=sizeof(STARTUPINFO); 00214 00215 res=CreateProcess(NULL,buff,NULL,NULL,FALSE,0,NULL,NULL, 00216 lpstartinfo,&procinfo); 00217 res=res*1; 00218 #else 00219 retCode=WinExec(buff,SW_SHOW); 00220 if(retCode<31) { 00221 strcpy(buff,"affimwin" 00222 "filein=_imtmp_.acr name="); 00223 if(fn) strcat(buff,fn); 00224 if (pal) { 00225 strcat(buff,"filepal=_paltmp_.asc"); 00226 } 00227 } 00228 #endif 00229 00230 return; 00231 } 00232 00233 00234 #endif