コード例 #1
0
//----------------------------------------------------------------------------
bool WmtfViewer::OnMotion (int, int x, int y, unsigned int)
{
    if (mMouseDown)
    {
        ReadPixelValue(x, y);
        OnDisplay();
        return true;
    }
    return false;
}
コード例 #2
0
ファイル: ImViewer.cpp プロジェクト: 2asoft/GeometricTools
//----------------------------------------------------------------------------
bool ImViewer::OnSpecialKeyDown (int key, int x, int y)
{
    if (mNumDimensions != 3)
    {
        return false;
    }

    if (key == KEY_UP_ARROW)
    {
        // Up arrow pressed, go to next image slize.
        if (mZ < mBound[2] - 1)
        {
            ++mZ;
            CopySliceToScreen();
            if (mMouseDown)
            {
                ReadPixelValue(x, y);
            }
            OnDisplay();
        }
        return true;
    }

    if (key == KEY_DOWN_ARROW)
    {
        // Down arrow pressed, go to previous image slice.
        if (mZ > 0)
        {
            --mZ;
            CopySliceToScreen();
            if (mMouseDown)
            {
                ReadPixelValue(x, y);
            }
            OnDisplay();
        }
        return true;
    }

    return false;
}
コード例 #3
0
//----------------------------------------------------------------------------
bool WmtfViewer::OnMouseClick (int button, int state, int x, int y,
    unsigned int)
{
    if (button == MOUSE_LEFT_BUTTON)
    {
        if (state == MOUSE_DOWN)
        {
            mMouseDown = true;
            ReadPixelValue(x, y);
            OnDisplay();
            return true;
        }
        if (state == MOUSE_UP)
        {
            mMouseDown = false;
            ReadPixelValue(-1, -1);
            OnDisplay();
            return true;
        }
    }
    return false;
}
コード例 #4
0
//----------------------------------------------------------------------------
bool WmtfViewer::OnKeyDown (unsigned char key, int x, int y)
{
    switch (key)
    {
    case 'a':
    case 'A':
        mAlphaActive = !mAlphaActive;
        CopySliceToScreen();
        if (mMouseDown)
        {
            ReadPixelValue(x, y);
        }
        OnDisplay();
        return true;
    }

    return WindowApplication2::OnKeyDown(key, x, y);
}