Xojo Conferences
XDCMay2019MiamiUSA

Image Resizing in Win32... (Real Studio Plugins Mailinglist archive)

Back to the thread list
Previous thread: AppleScript on CodeWarrior
Next thread: CodeWarrior vs Xcode


macosx and unix paths   -   GOLD
  Image Resizing in Win32...   -   Suikyo

Image Resizing in Win32...
Date: 08.06.05 05:52 (Wed, 08 Jun 2005 13:52:16 +0900)
From: Suikyo
This is topics in relative in "REALGraphicsDC does not work any more".

How should I do to reduce the image by using GDI?
---------------------------- code ---------------------------
REALpicture modThumbnail(REALpicture instance,int width,int height)
{
REALpictureDescription srcDesc;

//Get original-picture peroperty
REALgraphics srcGraphics = REALGetPictureGraphics(instance);
HDC srcDC = REALGraphicsDC(srcGraphics);
REALLockPictureDescription(instance, &srcDesc);
int srcWidth = srcDesc.width;
int srcHeight = srcDesc.height;
int srcDepth = srcDesc.depth;
REALUnlockPictureDescription(instance);

REALpicture memPicture = REALNewPicture( width, height, 32 );
REALgraphics memGraphics = REALGetPictureGraphics( memPicture );
HDC memDC = REALGraphicsDC( memGraphics );

#ifdef UseInternalDraw
::Rect rBounds;
rBounds.left
rBounds.top
rBounds.right=width;
rBounds.bottom=height;
//It works fine. but it is nearest-neighber algorithm.
REALDrawPicturePrimitive( memDC, instance, &rBounds, false );
return memPicture;
#else
//set stretch mode. No error.
SetStretchBltMode(memDC,STRETCH_HALFTONE);
if(GetLastError()=àROR_INVALID_PARAMETER){
DebugMessage("Failed : SetStretchBltMode");return nil;
}
//Return Brush Pos. No error.
if(SetBrushOrgEx(memDC,0,0,NULL)={
DebugMessage("Failed : SetBrushOrgEx");return nil;
}
//Execute StretchBlt. Show Message "Failed..."
if(StretchBlt(memDC,0,0,width,height,
srcDC,0,0,srcWidth,srcHeight,SRCCOPY) =OULL ){
DebugMessage("Failed : StretchBlt");
return nil;
}else{
return memPicture;
}
#endif
}
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>