TrackScreenUtils.h

Go to the documentation of this file.
00001 //**************************************************************************/
00002 // Copyright (c) 1998-2006 Autodesk, Inc.
00003 // All rights reserved.
00004 // 
00005 // These coded instructions, statements, and computer programs contain
00006 // unpublished proprietary information written by Autodesk, Inc., and are
00007 // protected by Federal copyright law. They may not be disclosed to third
00008 // parties or copied or duplicated in any form, in whole or in part, without
00009 // the prior written consent of Autodesk, Inc.
00010 //**************************************************************************/
00011 #pragma once
00012 
00013 
00018 
00019 // Macros for converting track screen coords to time and back.
00023 #define TimeToScreen(t,scale,scroll) (int(floor((t)*(scale)+0.5)) - (scroll))
00024 
00028 #define ScreenToTime(s,scale,scroll) ((int)floor((s)/(scale) + (scroll)/(scale)+0.5))
00029 
00033 #define ValueToScreen(v,h,scale,scroll) (h-int(floor((v)*(scale)+0.5)) - (scroll))
00034 
00038 #define ScreenToValue(s,h,scale,scroll) ((float(h)-(float(s)+float(scroll)))/(scale))
00039 
00040 // Scales a value about an origin
00041 #define ScaleAboutOrigin(val,origin,scale) ((((val)-(origin))*(scale))+(origin))
00042