Programación General > Visual C++

 Voimage Imagen Desde Memoria

<< < (2/6) > >>

kezern:
Aquí adjunto el archivo VOImage.cpp
El código de la función en concreto es

--- Código: Text --- BOOL CVOImage::Load(HDC hdc, LPCTSTR pcszFileName){  if(m_hbitmap)  {  if(GetFileName().GetLength() && GetFileName() == pcszFileName)    return TRUE;  // Already Loaded   DeleteObject(m_hbitmap);  }   if(!m_hdc)  {  m_hdc = CreateCompatibleDC(hdc);   HBITMAP  hbitmap = CreateCompatibleBitmap(hdc, GetDeviceCaps(hdc, HORZRES), GetDeviceCaps(hdc, VERTRES));   SelectObject(m_hdc, hbitmap);  }   BYTE    szBuffer[4096] = {0};  HANDLE hFile = INVALID_HANDLE_VALUE; #ifdef _WIN32_WCE  HRESULT hr;   DecompressImageInfo  dii;#endif   hFile = CreateFile(pcszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );  if (hFile == INVALID_HANDLE_VALUE)  return FALSE; #ifdef _WIN32_WCE  // Fill in the 'DecompressImageInfo' structure  dii.dwSize = sizeof( DecompressImageInfo );  // Size of this structure  dii.pbBuffer = szBuffer;      // Pointer to the buffer to use for data  dii.dwBufferMax = 4096;        // Size of the buffer  dii.dwBufferCurrent = 0;      // The amount of data which is current in the buffer  dii.phBM = &m_hbitmap;        // Pointer to the bitmap returned (can be NULL)  dii.ppImageRender = NULL;      // Pointer to an IImageRender object (can be NULL)  dii.iBitDepth = GetDeviceCaps(hdc,BITSPIXEL);  // Bit depth of the output image  dii.lParam = ( LPARAM ) hFile;      // User parameter for callback functions  dii.hdc = m_hdc;        // HDC to use for retrieving palettes  dii.iScale = g_iScale;        // Scale factor (1 - 100)  dii.iMaxWidth = g_iMaxWidth;      // Maximum width of the output image  dii.iMaxHeight = g_iMaxHeight;      // Maxumum height of the output image  dii.pfnGetData = GetImageData;      // Callback function to get image data  dii.pfnImageProgress = ImageProgress;    // Callback function to notify caller of progress decoding the image  dii.crTransparentOverride = ( UINT ) -1;  // If this color is not (UINT)-1, it will override the              // transparent color in the image with this color. (GIF ONLY)   // Process and decompress the image data  hr = DecompressImageIndirect( &dii );#endif    // Clean up   CloseHandle( hFile );   HBITMAP hbitmapOld = (HBITMAP)SelectObject(m_hdc, m_hbitmap);   DeleteObject(hbitmapOld);   BITMAP  bmp;   GetObject(m_hbitmap, sizeof(BITMAP), &bmp);   m_dwWidth = bmp.bmWidth;  m_dwHeight = bmp.bmHeight;   m_strFileName = pcszFileName;  m_dwResourceID = 0;  m_hmoduleResource = 0;   return TRUE;}  Ya me he fijado en la línea de la función CreateFile pero no se cómo cambiar para que la fuente sea el buffer de memoria
Gracias por vuestra ayuda

Eternal Idol:
Tenes que ver DecompressImageIndirect que es donde se usa el archivo.


--- Código: Text ---  hFile = CreateFile(pcszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); ... dii.lParam = ( LPARAM ) hFile; ... hr = DecompressImageIndirect( &dii );  

Eternal Idol:
Si es para Windows CE y esa es una API del S.O. entonces vas a tener que buscar otra API u otro metodo ...

kezern:
He buscado la función DecompressImageIndirect en los archivos del proyecto y sólo encuentro llamadas a ella o su definición en un archivo cpp, pero no veo su código por ningún sitio. ¿Estará entonces la función compilada dentro de la dll y yo no puedo modificarla? LLevo bastante tiempo buscando librerías que me permitan mostrar una imagen jpg en el display del pocket pc y sólo había encontrado esto.

Eternal Idol:

--- Cita de: "kezern" --- He buscado la función DecompressImageIndirect en los archivos del proyecto y sólo encuentro llamadas a ella o su definición en un archivo cpp, pero no veo su código por ningún sitio. ¿Estará entonces la función compilada dentro de la dll y yo no puedo modificarla? LLevo bastante tiempo buscando librerías que me permitan mostrar una imagen jpg en el display del pocket pc y sólo había encontrado esto.
--- Fin de la cita ---
"... si ... es una API del S.O. entonces vas a tener que buscar otra API u otro metodo"

Navegación

[0] Índice de Mensajes

[#] Página Siguiente

[*] Página Anterior

Ir a la versión completa