<< Click to Display Table of Contents > 

Scanner Card Interface > Example Code > Bitmap Marking

Bitmap Marking
Previous pageReturn to chapter overviewNext page

DevicePixelLine:

Device initialization and stream start/end for Bitmap Marking is the same as for regular operations. The regular marking speed is used as bitmap marking speed.

m_optic_module.ScSetDeviceSpeed(scComStandardDeviceStyleIDMarkSpeed,20000);

 

For each bitmap line the laser has to be positioned at the starting point of the line. Then pixel data has to be generated, abstracted here to the fictional fetchPixelLineData function that generates 300 pixels.  This is done in a loop until the bitmap is completed. In marking on the fly applications it might be necessary to perform movement operations after each line.

for(int i=0;i<lines,i++) {

 m_optic_module.ScMoveLaserState = 0;
 m_optic_module.ScMoveAbs(-15000.0,-15000.0 + i * 100);

 

 fetchPixelLineData(pixelLine,i);
 m_optic_module.ScDevicePixelLine(pixelLine,300,6,0,0);

}

 

Afterwards stream end and flush etc. are the same as for regular marking.

RasterPixelLine:

Raster mode needs scComStandardDeviceStyleFlagOutputFlagEnableUSC2PixelOutput set:

long device_flags;

m_optic_module->ScGetDeviceEnableFlags(scComStandardDeviceEnableFlagGroupOutputFlags,&device_flags);

device_flags = device_flags | scComStandardDeviceStyleFlagOutputFlagEnableUSC2PixelOutput;

m_optic_module->ScSetDeviceEnableFlags(scComStandardDeviceEnableFlagGroupOutputFlags,(ScComStandardDeviceEnableFlagConstants)device_flags);

 

The sc_com_raster_info structure needs to be generated and filled.

sc_com_raster_info ri;

ZeroMemory(&ri,sizeof(sc_com_raster_info));

ri.m_version = 1;

ri.m_mode |= scComStandardDeviceRasterModeFlagBiDir;

 

ri.m_origin_x = 0;

ri.m_origin_y = 0;

ri.m_dir_x = 1;

ri.m_dir_y = 0;

ri.m_pixel_step = 6;

ri.m_limit_value = (250/255.);

ri.m_line_step = 6;

ri.m_acceleration_time = 300;

ri.m_deceleration_time = 300;

ri.m_wait_delay_0 = 1000;

ri.m_wait_delay_1 = 0;

ri.m_jump_speed = 100000;

ri.m_line_offset = 250;

 

Set the frequency for bitmap marking, in this sample in YAG mode:

m_optic_module->ScSetDeviceTimer(scComStandardDeviceStyleIDQSwitchPeriod, pixel_period);

 

Raster mode start is signaled:

long res;

m_optic_module->ScSetDeviceData(scComStandardDeviceDataIDRasterStart,sizeof(sc_com_raster_info),(byte *)&ri,&res);

 

Then pixel data is generated and output:

float *pulses = new float[300];

 

for(int i=0;i<100;i++) {

 // generate dummy pixels, in real cases this would be image data

 for(int j=0;j<300;j++) {

   pulses[j] = j / 300.0;

 }

 m_optic_module->ScRasterPixelLine(pulses,pixel_count_x,pixel_period);

}

 

delete pulses;

 

Signal raster end:

m_optic_module->ScSetDeviceData(scComStandardDeviceDataIDRasterEnd,sizeof(sc_com_raster_info),(byte *)&ri,&res);