예제 #1
0
int
ShellCmdArgFloat::operator()(const char * & arg, CmdLine & cmd)
{
   CmdArgFloat  float_arg(*this);
   const char * save_arg = arg;
   int  badval = float_arg(arg, cmd);
   if (save_arg && !badval)  set(save_arg);
   return  badval;
}
예제 #2
0
파일: pcpage.c 프로젝트: hackqiang/gs
/*
 * ESC & l <yoff_dp> Z
 *
 * Note that this shifts the logical page, but does NOT change its size nor
 * does it reset any logical-page related parameters.
 */
static int
set_top_offset_registration(pcl_args_t * pargs, pcl_state_t * pcs)
{
    pcs->xfm_state.top_offset_cp = float_arg(pargs) * 10;
    update_xfm_state(pcs, 0);
    return 0;
}
예제 #3
0
static int
set_vert_motion_index(pcl_args_t * pargs, pcl_state_t * pcs)
{
    /* LMI :== 48.0 / lpi;  ie 0.16 = 48/300;
     * convert to pcl_coord_scale (7200), roundup the float prior to truncation.
     */
    coord vcp = (coord) ((fabs(float_arg(pargs)) * 7200.0 / 48.0) + 0.5);
    bool cursor_at_home = pcl_cursor_at_home_pos(pcs);

#ifdef HP_VERT_MOTION_NEW
    if (vcp <= pcs->xfm_state.pd_size.y)
#endif
        pcs->vmi_cp = vcp;

    /* If the cursor has not been set, the new default position should
       reflect the change in vmi.  This behavior is quite unusual and
       probably is not the way HP intended PCL devices to behave.  In
       the spec it is reported the VMI should take effect if the
       printer is on the first line but we've found moving the x
       coordinate (horizontal position) cause the command to not take
       effect. */
    if (cursor_at_home)
        pcl_home_cursor(pcs);
    return 0;
}
예제 #4
0
/*
 * ESC & k <x> H
 *
 * Set horizontal motion index.
 */
static int
set_horiz_motion_index(pcl_args_t * pargs, pcl_state_t * pcs)
{
    /* HMI in 120 units converted to 7200 units with roundup */
    pcs->hmi_cp = (coord) ((fabs(float_arg(pargs)) * 60.0) + 0.5);
    return 0;
}
예제 #5
0
static inline float
motion_args(pcl_args_t * pargs, bool truncate)
{
    float arg = float_arg(pargs);

    if (truncate)
        arg = floor(arg);
    return arg;
}
예제 #6
0
/*
 * ESC * t # I
 *
 * Set gamma correction
 */
static int
set_gamma_correction(pcl_args_t * pargs, pcl_state_t * pcs)
{
    float gamma = float_arg(pargs);

    if (pcs->personality == pcl5e || pcs->raster_state.graphics_mode)
        return 0;
    if ((gamma < 0.0) || (gamma > (float)((1L << 15) - 1)))
        return 0;
    else
        return pcl_palette_set_gamma(pcs, gamma);
}
예제 #7
0
/*
 * ESC * t # V
 *
 * Set destination raster height, in decipoints. This implementation follows that
 * of the HP Color LaserJet 5/5M in that it ignores the sign of the operand; the
 * DeskJet 1600 C/CM has different behavior. Note that the stored value is in
 * centi-points, while the operand is in deci-points.
 *
 * Though it is not noted in the "PCL 5 Color Technical Reference Manual", this
 * command is ignored in graphics mode.
 */
  static int
set_dest_raster_height(
    pcl_args_t *    pargs,
    pcl_state_t *   pcs
)
{
    if (!pcs->raster_state.graphics_mode) {	
	if ( arg_is_present(pargs) ) {
	    uint    dh = 10 * fabs(float_arg(pargs));

	    pcs->raster_state.dest_height_cp = dh;
	    pcs->raster_state.dest_height_set = (dh != 0);
	}
	else
	    pcs->raster_state.dest_height_set = false;
    }
    return 0;
}
예제 #8
0
/*
 * ESC * t # H
 *
 * Set destination raster width, in decipoints. This implementation follows that
 * of the HP Color LaserJet 5/5M in that it ignores the sign of the operand; the
 * DeskJet 1600 C/CM has different behavior. Note that the stored value is in
 * centi-points, while the operand is in deci-points.
 *
 * Though it is not noted in the "PCL 5 Color Technical Reference Manual", this
 * command is ignored in graphics mode.
 */
  static int
set_dest_raster_width(
    pcl_args_t *    pargs,
    pcl_state_t *   pcs
)
{
    if (!pcs->raster_state.graphics_mode) {
	if ( arg_is_present(pargs) ) {
	    uint    dw = 10 * fabs(float_arg(pargs));

	    pcs->raster_state.dest_width_cp = dw;
	    pcs->raster_state.dest_width_set = (dw != 0);
	}
	else
	    pcs->raster_state.dest_width_set = false;
    }
    return 0;
}