'---------frankos how to do question with powerbasic
FUNCTION Exec_GetImageThumbnail (BYVAL hdc AS DWORD) AS Ext
LOCAL hStatus AS LONG
LOCAL pGraphics AS DWORD
LOCAL strFileName AS STRING
LOCAL pImage AS DWORD
LOCAL nWidth AS DWORD
LOCAL nHeight AS DWORD
LOCAL pThumbnail AS DWORD
LOCAL nThumbnailWidth AS DWORD
LOCAL nThumbnailHeight AS DWORD
'---Parse open pares
IF thinBasic_CheckOpenParens() THEN
thinBasic_ParseLong pImage
IF thinBasic_CheckComma() THEN
thinBasic_ParseLong nWidth
IF thinBasic_CheckComma() THEN
thinBasic_ParseLong nHeigth
IF thinBasic_CheckComma() THEN
thinBasic_ParseLong pThumbnail
'---At the end check if close parens was specified
IF thinBasic_CheckCloseParens() THEN
FUNCTION = GdipGetImageThumbnail(pImage, 50, 50, pThumbnail, 0, 0)
END IF
END IF
END IF
END IF
END IF
'--------this part isn't important, isn't it ? I can delete this one ---------???
hStatus = GdipCreateFromHDC(hdc, pGraphics)
' // Create an image and a thumbnail of the image.
strFileName = UCODE$("leoparden1.png")
hStatus = GdipLoadImageFromFile(STRPTR(strFileName), pImage)
hStatus = GdipGetImageThumbnail(pImage, 50, 50, pThumbnail, %NULL, %NULL)
' // Draw the original and the thumbnail images.
hStatus = GdipGetImageWidth(pImage, nWidth)
hStatus = GdipGetImageHeight(pImage, nHeight)
hStatus = GdipDrawImageRect(pGraphics, pImage, 70, 70, nWidth, nHeight)
hStatus = GdipGetImageWidth(pThumbnail, nThumbnailWidth)
hStatus = GdipGetImageHeight(pThumbnail, nThumbnailHeight)
hStatus = GdipDrawImageRect(pGraphics, pThumbnail, 200, 20, nThumbnailWidth, nThumbnailHeight)
' // Cleanup
IF pThumbnail THEN GdipDisposeImage(pThumbnail)
IF pImage THEN GdipDisposeImage(pImage)
IF pGraphics THEN GdipDeleteGraphics(pGraphics)
END FUNCTION
Bookmarks