Click here to Skip to main content
6,629,885 members and growing! (24,581 online)
Email Password   helpLost your password?
Desktop Development » Miscellaneous » General     Intermediate

CCurveDlg - Curve Interpolation

By Janssens Johan

A Photoshop-like curve dialog.
VC6Win2K, MFC, Dev
Posted:15 Sep 2001
Views:71,633
Bookmarked:24 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
11 votes for this article.
Popularity: 3.18 Rating: 3.05 out of 5
1 vote, 25.0%
1
1 vote, 25.0%
2
1 vote, 25.0%
3

4
1 vote, 25.0%
5

Sample Image - CurveDlg.gif

Introduction

Welcome to CCurveDlg, a Freeware MFC Curve Class

Its appearance is similar to the curves dialog as seen in the Adobe Photoshop. The classes are split up into a document/view architecture.

  • CCurveWnd, derived from CWnd, for the visual representation of the curve. This class takes care of drawing and user interaction.
  • CCurveObject, derived from CObject for the data representation of the curve. This class holds the curve data, and does all calculation calls, to perform the curve interpolation.

The actual calculation is done with the help of the XlXtrFun.dll. This is actually an Excel extension DLL or XLL, but I have written a wrapper class CCurveDllImpl for it, so it can easily be used in VC++. For more info regarding this DLL, check their website.

Usage

Adding a CCurveWnd is simple, just follow the next steps:

  1. Add the following files to your project workspace:
    • CurveWnd.h and CurveWnd.cpp
    • CurveObject.h, CurveObject.cpp and CurveObjectDef.h
    • CurveDllImpl.h and CurveDllImpl.cpp.
  2. Copy the XlXtrFun.dll to your project directory

    You should also ensure that the 3 cursors (namely, IDC_ARRBLCK, IDC_ARRWHITE and IDC_ARRBLCKCROSS) are copied over into your rc file and renamed properly.

  3. Add the following include statement to your project stdafx.h file
    #include "resource.h"
  4. Then add a CCurveWnd member to your own CDialog class:
    CCurveWnd m_cCurveWnd;

    In your CDialog::OnInitDialog(), you need to create the CurveWnd:

     m_cCurveWnd.Create("", 
     CRect(25, 55, 235, 265), this, 2001, true);

    The Create method is defined as follows:

    BOOL Create(LPCTSTR lpszCurveName,   //Points to a null-terminated 
    
                                         //character string that 
    
                                         //contains the window name
    
                const RECT &rect,        // The size and position 
    
                                         //of the window, in client 
    
                                         //coordinates of pParentWnd
    
                CWnd* pWndParent,        // The parent window
    
                UINT nID,                // The ID of the child window
    
                BOOL CreateCurveObj)     // Set to true if the create 
    
                                         // function has to
    
                                         // create a curve object

Note: If you set CreateCurveObj = false and you don't create a curve object manually by calling CCurveWnd::CreateCurveObject(CString strCurve), the application may assert.

If you want the CurveWnd to draw a parabolic curve, you have to add the following code:

CCurveObject* pCurve = m_cCurveWnd.GetCurveObject();
pCurve->m_bParabolic = true;

The GetCurveObject method is defined as follows:

CCurveObject* GetCurveObject(); // Returns a pointer to the curveobject

Basically that will do the job.

API Functions

Full description of the API functions is not yet available, I haven't had the time to write it. But I will come up with the first update of the code, so until then just email me if u have problems and questions.

History

  • v1.0 (16 september 2001)

    CCurveDlg first released.

Planned Enhancements

If you have any suggested improvements, please let me know so that I can incorporate them into the next release.

Special Thanks

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Janssens Johan


Member

Occupation: Web Developer
Location: Russian Federation Russian Federation

Other popular Miscellaneous articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 13 of 13 (Total in Forum: 13) (Refresh)FirstPrevNext
GeneralI've ripped all of my hair out.. :( Pinmemberaquawicket11:38 24 May '07  
GeneralHow to get output from input [modified] Pinmemberaquawicket9:24 22 May '07  
GeneralRe: How to get output from input Pinmemberaquawicket13:19 22 May '07  
QuestionVC++ Source Code to draw a parabola and find the location of co-ordinates and display them in a list box. Pinmemberavins1234568:25 21 Oct '06  
Generalhow to insert point(x,y) in your code PinmemberDAR TO19:33 9 Jan '05  
Generalthere is another way (to access the excel curve calculations) Pinmemberspare_me21:44 19 Jul '04  
GeneralDeveloping CCurveDllImpl PinmemberMichael Robbins5:24 24 Oct '03  
GeneralProgram only runs under WinNT/2000 PinmemberJanssens Johan13:19 17 Sep '01  
GeneralRe: Program only runs under WinNT/2000 PinmemberPaolo Messina7:32 20 Sep '01  
GeneralXlXtrFun.dll can't be loaded PinmemberMatthias Mann7:37 17 Sep '01  
GeneralRe: XlXtrFun.dll can't be loaded PinmemberJanssens Johan11:47 17 Sep '01  
GeneralTypo in link PinmemberRavi Bhavnani5:03 17 Sep '01  
GeneralRe: Typo in link PinmemberJanssens Johan12:07 17 Sep '01  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 15 Sep 2001
Editor: Smitha Vijayan
Copyright 2001 by Janssens Johan
Everything else Copyright © CodeProject, 1999-2009
Web21 | Advertise on the Code Project