Пример #1
0
        /// <summary>
        /// Return max normal pressure supported by tablet.
        /// </summary>
        /// <param name="getNormalPressure_I">TRUE=> normal pressure;
        /// FALSE=> tangential pressure (not supported on all tablets)</param>
        /// <returns>maximum pressure value or zero on error</returns>
        public static Int32 GetMaxPressure(bool getNormalPressure_I = true)
        {
            WintabAxis pressureAxis = new WintabAxis();
            IntPtr     buf          = CMemUtils.AllocUnmanagedBuf(pressureAxis);

            EWTIDevicesIndex devIdx = (getNormalPressure_I ?
                                       EWTIDevicesIndex.DVC_NPRESSURE : EWTIDevicesIndex.DVC_TPRESSURE);

            try
            {
                int size = (int)CWintabFuncs.WTInfoA(
                    (uint)EWTICategoryIndex.WTI_DEVICES,
                    (uint)devIdx, buf);

                pressureAxis = CMemUtils.MarshalUnmanagedBuf <WintabAxis>(buf, size);
            }
            catch (Exception ex)
            {
                MessageBox.Show("FAILED GetMaxPressure: " + ex.ToString());
            }

            CMemUtils.FreeUnmanagedBuf(buf);

            return(pressureAxis.axMax);
        }
Пример #2
0
        /// <summary>
        /// Return the WintabAxis object for the specified dimension.
        /// </summary>
        /// <param name="dimension_I">Dimension to fetch (eg: x, y)</param>
        /// <returns></returns>
        public static WintabAxis GetTabletAxis(EAxisDimension dimension_I)
        {
            WintabAxis axis = new WintabAxis();
            IntPtr     buf  = CMemUtils.AllocUnmanagedBuf(axis);

            try
            {
                int size = (int)CWintabFuncs.WTInfo(
                    (uint)EWTICategoryIndex.WTI_DEVICES,
                    (uint)dimension_I, buf);

                axis = CMemUtils.MarshalUnmanagedBuf <WintabAxis>(buf, size);
            }
            finally
            {
                CMemUtils.FreeUnmanagedBuf(buf);
            }

            return(axis);
        }
Пример #3
0
        /// <summary>
        /// Returns the WintabAxis object for specified device and dimension.
        /// </summary>
        /// <param name="devIndex_I">Device index (-1 = virtual device)</param>
        /// <param name="dim_I">Dimension: AXIS_X, AXIS_Y or AXIS_Z</param>
        /// <returns></returns>
        public static WintabAxis GetDeviceAxis(Int32 devIndex_I, EAxisDimension dim_I)
        {
            WintabAxis axis = new WintabAxis();
            IntPtr     buf  = WMemUtils.AllocUnmanagedBuf(axis);

            try {
                int size = (int)WNativeMethods.WTInfo(
                    (uint)(EWTICategoryIndex.WTI_DEVICES + devIndex_I),
                    (uint)dim_I, buf);

                // If size == 0, then returns a zeroed struct.
                axis = WMemUtils.MarshalUnmanagedBuf <WintabAxis>(buf, size);
            } catch (Exception ex) {
                throw new Exception("FAILED GetDeviceAxis: " + ex.ToString());
            }

            WMemUtils.FreeUnmanagedBuf(buf);

            return(axis);
        }
Пример #4
0
        /// <summary>
        /// Returns the WintabAxis object for specified device and dimension.
        /// </summary>
        /// <param name="devIndex_I">Device index (-1 = virtual device)</param>
        /// <param name="dim_I">Dimension: AXIS_X, AXIS_Y or AXIS_Z</param>
        /// <returns></returns>
        public static WintabAxis GetDeviceAxis(Int32 devIndex_I, EAxisDimension dim_I)
        {
            WintabAxis axis = new WintabAxis();
            IntPtr     buf  = CMemUtils.AllocUnmanagedBuf(axis);

            try
            {
                int size = (int)CWintabFuncs.WTInfo(
                    (uint)(EWTICategoryIndex.WTI_DEVICES + devIndex_I),
                    (uint)dim_I, buf);

                // If size == 0, then returns a zeroed struct.
                axis = CMemUtils.MarshalUnmanagedBuf <WintabAxis>(buf, size);
            }
            finally
            {
                CMemUtils.FreeUnmanagedBuf(buf);
            }

            return(axis);
        }
Пример #5
0
        /// <summary>
        /// Return the WintabAxis object for the specified dimension.
        /// </summary>
        /// <param name="dimension_I">Dimension to fetch (eg: x, y)</param>
        /// <returns></returns>
        public static WintabAxis GetTabletAxis(EAxisDimension dimension_I)
        {
            WintabAxis axis = new WintabAxis();
            IntPtr     buf  = CMemUtils.AllocUnmanagedBuf(axis);

            try
            {
                int size = (int)CWintabFuncs.WTInfoA(
                    (uint)EWTICategoryIndex.WTI_DEVICES,
                    (uint)dimension_I, buf);

                axis = CMemUtils.MarshalUnmanagedBuf <WintabAxis>(buf, size);
            }
            catch (Exception ex)
            {
                MessageBox.Show("FAILED GetMaxPressure: " + ex.ToString());
            }

            CMemUtils.FreeUnmanagedBuf(buf);

            return(axis);
        }
Пример #6
0
        /// <summary>
        /// Return max normal pressure supported by tablet.
        /// </summary>
        /// <param name="getNormalPressure_I">TRUE=> normal pressure;
        /// FALSE=> tangential pressure (not supported on all tablets)</param>
        /// <returns>maximum pressure value or zero on error</returns>
        public static Int32 GetMaxPressure(bool getNormalPressure_I = true)
        {
            WintabAxis pressureAxis = new WintabAxis();
            IntPtr     buf          = CMemUtils.AllocUnmanagedBuf(pressureAxis);

            EWTIDevicesIndex devIdx = (getNormalPressure_I ?
                                       EWTIDevicesIndex.DVC_NPRESSURE : EWTIDevicesIndex.DVC_TPRESSURE);

            try
            {
                int size = (int)CWintabFuncs.WTInfo(
                    (uint)EWTICategoryIndex.WTI_DEVICES,
                    (uint)devIdx, buf);

                pressureAxis = CMemUtils.MarshalUnmanagedBuf <WintabAxis>(buf, size);
            }
            finally
            {
                CMemUtils.FreeUnmanagedBuf(buf);
            }

            return(pressureAxis.axMax);
        }
Пример #7
0
        /// <summary>
        /// Return the WintabAxis object for the specified dimension.
        /// </summary>
        /// <param name="dimension_I">Dimension to fetch (eg: x, y)</param>
        /// <returns></returns>
        public static WintabAxis GetTabletAxis(EAxisDimension dimension_I)
        {
            WintabAxis axis = new WintabAxis();
            IntPtr buf = CMemUtils.AllocUnmanagedBuf(axis);

            try
            {
                int size = (int)CWintabFuncs.WTInfoA(
                    (uint)EWTICategoryIndex.WTI_DEVICES,
                    (uint)dimension_I, buf);

                axis = CMemUtils.MarshalUnmanagedBuf<WintabAxis>(buf, size);
            }
            catch (Exception ex)
            {
                MessageBox.Show("FAILED GetMaxPressure: " + ex.ToString());
            }

            CMemUtils.FreeUnmanagedBuf(buf);

            return axis;
        }
Пример #8
0
        /// <summary>
        /// Return max normal pressure supported by tablet.
        /// </summary>
        /// <param name="getNormalPressure_I">TRUE=> normal pressure; 
        /// FALSE=> tangential pressure (not supported on all tablets)</param>
        /// <returns>maximum pressure value or zero on error</returns>
        public static Int32 GetMaxPressure(bool getNormalPressure_I = true)
        {
            WintabAxis pressureAxis = new WintabAxis();
            IntPtr buf = CMemUtils.AllocUnmanagedBuf(pressureAxis);

            EWTIDevicesIndex devIdx = (getNormalPressure_I ?
                EWTIDevicesIndex.DVC_NPRESSURE : EWTIDevicesIndex.DVC_TPRESSURE);

            try
            {
                int size = (int)CWintabFuncs.WTInfoA(
                    (uint)EWTICategoryIndex.WTI_DEVICES,
                    (uint)devIdx, buf);

                pressureAxis = CMemUtils.MarshalUnmanagedBuf<WintabAxis>(buf, size);
            }
            catch (Exception ex)
            {
                MessageBox.Show("FAILED GetMaxPressure: " + ex.ToString());
            }

            CMemUtils.FreeUnmanagedBuf(buf);

            return pressureAxis.axMax;
        }
Пример #9
0
        /// <summary>
        /// Returns the WintabAxis object for specified device and dimension.
        /// </summary>
        /// <param name="devIndex_I">Device index (-1 = virtual device)</param>
        /// <param name="dim_I">Dimension: AXIS_X, AXIS_Y or AXIS_Z</param>
        /// <returns></returns>
        public static WintabAxis GetDeviceAxis(Int32 devIndex_I, EAxisDimension dim_I)
        {
            WintabAxis axis = new WintabAxis();
            IntPtr buf = CMemUtils.AllocUnmanagedBuf(axis);

            try
            {
                int size = (int)CWintabFuncs.WTInfoA(
                    (uint)(EWTICategoryIndex.WTI_DEVICES + devIndex_I), 
                    (uint)dim_I, buf);

                // If size == 0, then returns a zeroed struct.
                axis = CMemUtils.MarshalUnmanagedBuf<WintabAxis>(buf, size);
            }
            catch (Exception ex)
            {
                MessageBox.Show("FAILED GetDeviceAxis: " + ex.ToString());
            }

            CMemUtils.FreeUnmanagedBuf(buf);

            return axis;
        }