Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to obtain Content-Type value for a file type from the System Registry
How to play a waveform sound (a WAV file in particular)
Minimizing all running applications
Retrieving window and menu help context identifiers
Winsock: how to retrieve the protocol information corresponding to a protocol number
GDI+: converting image file to another graphics format
Reading entries from Event logs
Retrieving information specific to the current Time Zone
Retrieving System Error message strings
Accessing examples contained in this reference through Web Services
Accessing Windows Control Panel from VFP Application
Obtaining the bounding rectangle for the specified device context
PocketPC: custom RAPI class for executing routines on remote Windows CE device
Simple MAPI: how to pick an email recipient from Outlook Express address book
Determining whether or not the system is connected to the Internet
How to display picture stored in enhanced-format metafile (*.emf)
Number of clipboard formats available
Retrieving information about MS-DOS device names using QueryDosDevice (WinNT only)
Retrieving list of files on the FTP directory
Using GetNearestColor
Converting twips to pixels and vice versa
How to view icons stored in executable files (Icon Viewer) - II
Reading virtual key status values and key names
Using shared memory to exchange data between two FoxPro applications
GDI+: rotating images using matrix transformations

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Before you begin:
The code is based on custom GDI+ class. Download the class module first and save it in gdiplus.prg file.



See also:
  • GDI+: creating scaled copy of image file
  • GDI+: cropping images

  •  
    LOCAL cSourceFile, cTargetFile
    cSourceFile = "provide valid image file name"
    cTargetFile = "c:\temp\test.bmp"
     
    SET PROCEDURE TO gdiplus ADDITIVE
     
    PRIVATE gdiplus As gdiplusinit, srcImage As gdiimage,;
        dstBitmap As gdibitmap
     
    gdiplus = CREATEOBJECT("gdiplusinit")
     
    srcImage = CREATEOBJECT("gdiimage", m.cSourceFile)
    IF srcImage.himage = 0
        = MESSAGEBOX(cSourceFile + "     ",;
            48, "Invalid file format or file not found")
        RETURN
    ENDIF
     
    dstBitmap = CREATEOBJECT("gdibitmap",;
        srcImage*2, srcImage*1.5)
     
    WITH dstBitmap
        * fill background
        .graphics.FillRectangle(ARGB(71,89,73,255),;
            0, 0, .imgwidth, .imgheight)
     
        * copy as is
        .graphics.drawimage(m.srcImage, 0,0)
     
        * copy with several rotation angles
        = DrawImage(-35, 100,0)
        = DrawImage(-25, 0,0)
        = DrawImage(-5, 0,0)
        = DrawImage(25, 0,0)
     
        .SaveToFile(cTargetFile)
    ENDWITH
     
    PROCEDURE DrawImage(nAngle, dx, dy)
        LOCAL oMatrix As gdimatrix
     
        oMatrix = CREATEOBJECT("gdimatrix")
        oMatrix.Translate(srcImage.imgwidth/2, srcImage.imgheight/2)
        oMatrix.Rotate(m.nAngle)
     
        WITH dstBitmap
            .graphics.SetTransform(oMatrix)
            .graphics.drawimage(m.srcImage, dx, dy)
        ENDWITH
     
     
     

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    1179 bytes  
    Created: 2007-03-06 18:52:42  
    Modified: 2007-03-08 19:45:49  
    Visits in 7 days: 69  
    Listed functions:
    Printer friendly API declarations
    My comment:
    GdipImageRotateFlip function provides only limited rotation capabilities.
    Word Index links for this example:
    Translate this page:
      Spanish    Portuguese    German    French    Italian  
    FreeTranslation.com offers instant, free translations of text or web pages.
    User Contributed Notes:
    There are no notes on this subject.


    Copyright © 2001-2013 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

    Privacy policy
    Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.1.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (184.73.74.47)
    4 sec.Example: 'How to obtain Content-Type value for a file type from the System Registry'
    7 sec.Example: 'How to enumerate, add and delete shares on the local computer (WinNT/XP)'
    1.74 hrs.Example: 'GDI+: Creating thumbnails to preview images in a directory'
     Function: 'CryptDestroyKey'
    13.22 hrs.Example: 'Pocket PC: Folder Viewer'
     Example: 'How to retrieve configuration data for a specified printer stored in the registry (PrinterDriverData key)'
    18.96 hrs.Example: 'How to print FoxPro form'
     Example: 'Reading VFP settings from the Windows Registry'
    20.42 hrs.Example: 'Using FlashWindowEx to flash the taskbar button of the VFP application'
     Example: 'Running a regular FoxPro form while main VFP window is minimized'
    Google
    Advertise here!