Click here to Skip to main content
15,914,500 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: realizing virtual functions with *this parameter Pin
Andrew Walker23-Oct-04 4:59
Andrew Walker23-Oct-04 4:59 
GeneralWinhelp vs. HTML help context Pin
digwizfox22-Oct-04 12:52
digwizfox22-Oct-04 12:52 
GeneralRe: Winhelp vs. HTML help context Pin
Gary R. Wheeler22-Oct-04 14:46
Gary R. Wheeler22-Oct-04 14:46 
GeneralRe: Winhelp vs. HTML help context Pin
digwizfox25-Oct-04 8:12
digwizfox25-Oct-04 8:12 
GeneralRe: Winhelp vs. HTML help context Pin
digwizfox25-Oct-04 13:36
digwizfox25-Oct-04 13:36 
GeneralRe: Winhelp vs. HTML help context Pin
YoSilver22-Oct-04 21:07
YoSilver22-Oct-04 21:07 
Generalplease! help me about antialiasing!!! Pin
Shiwan Sung22-Oct-04 12:37
Shiwan Sung22-Oct-04 12:37 
GeneralRe: please! help me about antialiasing!!! Pin
YoSilver22-Oct-04 21:14
YoSilver22-Oct-04 21:14 
The link:
http://alglib.manual.ru/translate.php?location=/graphics/wuline&target=cpp[^]

It is a Russian resource, I guess you don't speak Russian. So, here you are:

#include "ap.h"

/*-----------------------------------------------
User-defined routine

void setpixel(int x, int y, double c);
-----------------------------------------------*/

void drawwuline(double x1, double y1, double x2, double y2);
double myfrac(double x);

/*************************************************************************

Wu Xiaolin algorithm with fractional coordinates (a-la DX90)

*************************************************************************/
void drawwuline(double x1, double y1, double x2, double y2)
{
    double grad;
    double xd;
    double yd;
    double length;
    double xm;
    double ym;
    double xgap;
    double ygap;
    double xend;
    double yend;
    double xf;
    double yf;
    double brightness1;
    double brightness2;
    int x;
    int y;
    int ix1;
    int ix2;
    int iy1;
    int iy2;
    bool wasexchange;
    int tmpint;
    double tmpreal;

    xd = x2-x1;
    yd = y2-y1;
    if( xd==0&&yd==0 )
    {
        return;
    }
    if( fabs(xd)>fabs(yd) )
    {
        wasexchange = false;
    }
    else
    {
        wasexchange = true;
        tmpreal = x1;
        x1 = y1;
        y1 = tmpreal;
        tmpreal = x2;
        x2 = y2;
        y2 = tmpreal;
        tmpreal = xd;
        xd = yd;
        yd = tmpreal;
    }
    if( x1>x2 )
    {
        tmpreal = x1;
        x1 = x2;
        x2 = tmpreal;
        tmpreal = y1;
        y1 = y2;
        y2 = tmpreal;
        xd = x2-x1;
        yd = y2-y1;
    }
    grad = yd/xd;
    xend = floor(x1+0.5);
    yend = y1+grad*(xend-x1);
    xgap = 1-myfrac(x1+0.5);
    ix1 = floor(x1+0.5);
    iy1 = floor(yend);
    brightness1 = (1-myfrac(yend))*xgap;
    brightness2 = myfrac(yend)*xgap;
    if( wasexchange )
    {
        setpixel(iy1, ix1, brightness1);
        setpixel(iy1+1, ix1, brightness2);
    }
    else
    {
        setpixel(ix1, iy1, brightness1);
        setpixel(ix1, iy1+1, brightness2);
    }
    yf = yend+grad;
    xend = floor(x2+0.5);
    yend = y2+grad*(xend-x2);
    xgap = 1-myfrac(x2-0.5);
    ix2 = floor(x2+0.5);
    iy2 = floor(yend);
    brightness1 = (1-myfrac(yend))*xgap;
    brightness2 = myfrac(yend)*xgap;
    if( wasexchange )
    {
        setpixel(iy2, ix2, brightness1);
        setpixel(iy2+1, ix2, brightness2);
    }
    else
    {
        setpixel(ix2, iy2, brightness1);
        setpixel(ix2, iy2+1, brightness2);
    }
    for(x = ix1+1; x <= ix2-1; x++)
    {
        brightness1 = 1-myfrac(yf);
        brightness2 = myfrac(yf);
        if( wasexchange )
        {
            setpixel(floor(yf), x, brightness1);
            setpixel(floor(yf)+1, x, brightness2);
        }
        else
        {
            setpixel(x, floor(yf), brightness1);
            setpixel(x, floor(yf)+1, brightness2);
        }
        yf = yf+grad;
    }
}


double myfrac(double x)
{
    double result;

    result = x-floor(x);
    return result;
}

GeneralRe: please! help me about antialiasing!!! Pin
Shiwan Sung22-Oct-04 22:14
Shiwan Sung22-Oct-04 22:14 
GeneralOCX on IE File-&gt; New -&gt; Window Problem Pin
shinay22-Oct-04 9:57
shinay22-Oct-04 9:57 
GeneralStatic Linking Pin
hyling22-Oct-04 8:59
hyling22-Oct-04 8:59 
GeneralRe: Static Linking Pin
Alexander M.,22-Oct-04 10:10
Alexander M.,22-Oct-04 10:10 
GeneralRe: Static Linking Pin
Michael Dunn22-Oct-04 13:52
sitebuilderMichael Dunn22-Oct-04 13:52 
GeneralRe: Static Linking Pin
hyling23-Oct-04 7:34
hyling23-Oct-04 7:34 
GeneralRe: Static Linking Pin
Uwe Keim23-Oct-04 4:56
sitebuilderUwe Keim23-Oct-04 4:56 
GeneralRe: Static Linking Pin
hyling23-Oct-04 7:33
hyling23-Oct-04 7:33 
GeneralRemote Office Automation Pin
Malcolm Smart22-Oct-04 8:50
Malcolm Smart22-Oct-04 8:50 
GeneralRe: Remote Office Automation Pin
Michael P Butler23-Oct-04 9:00
Michael P Butler23-Oct-04 9:00 
GeneralTroubling creating object Pin
AmorphousP22-Oct-04 7:04
AmorphousP22-Oct-04 7:04 
GeneralRe: Troubling creating object Pin
David Crow22-Oct-04 7:40
David Crow22-Oct-04 7:40 
GeneralRe: Troubling creating object Pin
AmorphousP22-Oct-04 9:37
AmorphousP22-Oct-04 9:37 
GeneralRe: Troubling creating object Pin
Maximilien22-Oct-04 9:51
Maximilien22-Oct-04 9:51 
GeneralRe: Troubling creating object Pin
AmorphousP22-Oct-04 10:34
AmorphousP22-Oct-04 10:34 
GeneralRe: Troubling creating object Pin
David Crow22-Oct-04 9:53
David Crow22-Oct-04 9:53 
GeneralRe: Troubling creating object Pin
AmorphousP22-Oct-04 10:29
AmorphousP22-Oct-04 10:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.