void agg_renderer<T>::end_style_processing(feature_type_style const& st) { if (style_level_compositing_) { bool blend_from = false; if (st.image_filters().size() > 0) { blend_from = true; mapnik::filter::filter_visitor<image_32> visitor(*current_buffer_); BOOST_FOREACH(mapnik::filter::filter_type const& filter_tag, st.image_filters()) { boost::apply_visitor(visitor, filter_tag); } } if (st.comp_op()) { composite(pixmap_.data(),current_buffer_->data(), *st.comp_op(), st.get_opacity(), 0, 0, false); //compositeTexture(styleTexture_, mainTexture_, static_cast<composite_mode_e>(*st.comp_op())); } else if (blend_from || st.get_opacity() < 1) { composite(pixmap_.data(),current_buffer_->data(), src_over, st.get_opacity(), 0, 0, false); } // apply any 'direct' image filters mapnik::filter::filter_visitor<image_32> visitor(pixmap_); BOOST_FOREACH(mapnik::filter::filter_type const& filter_tag, st.direct_image_filters()) { boost::apply_visitor(visitor, filter_tag); } }
static cairo_int_status_t lerp (void *dst, cairo_surface_t *src, cairo_surface_t *mask, int src_x, int src_y, int mask_x, int mask_y, int dst_x, int dst_y, unsigned int width, unsigned int height) { cairo_int_status_t status; /* we could avoid some repetition... */ status = composite (dst, CAIRO_OPERATOR_DEST_OUT, mask, NULL, mask_x, mask_y, 0, 0, dst_x, dst_y, width, height); if (unlikely (status)) return status; status = composite (dst, CAIRO_OPERATOR_ADD, src, mask, src_x, src_y, mask_x, mask_y, dst_x, dst_y, width, height); if (unlikely (status)) return status; return CAIRO_STATUS_SUCCESS; }
static void drawMatches( Node *querynode, std::vector<Match*> &matches, const std::vector<bool> &inliers ) { std::vector<Camera*> cameras; std::vector<cv::Mat> images; cv::Mat queryim = querynode->camera->image; for ( int j = 0; j < matches.size(); j++ ) { if ( !inliers.empty() ) { if ( !inliers[j] ) continue; } Match *match = matches[j]; Feature *feature = match->feature1; Feature *queryfeature = match->feature2; bool found = false; cv::Mat image; for ( int k = 0; k < cameras.size(); k++ ) { if ( feature->camera == cameras[k] ) { found = true; image = images[k]; break; } } if ( image.empty() ) { cameras.push_back( feature->camera ); cv::Mat im = feature->camera->image; int height = ( queryim.size().height > im.size().height ) ? queryim.size().height : im.size().height; cv::Mat composite( cv::Size( im.size().width+queryim.size().width, height ), CV_8UC1 ); queryim.copyTo( composite( cv::Rect(cv::Point2i(0,0), queryim.size() ) ) ); im.copyTo( composite( cv::Rect(cv::Point2i(queryim.size().width,0), im.size() ) ) ); images.push_back( composite ); image = images.back(); } cv::Point2i impt1( queryfeature->location[0], queryfeature->location[1] ); cv::Point2i impt2( queryim.size().width+feature->location[0], feature->location[1] ); cv::line( image, impt1, impt2, cv::Scalar(0) ); } for ( int j = 0; j < cameras.size(); j++ ) { char name[256]; sprintf( name, "Output/%s_%s_matches.jpg", querynode->name.c_str(), cameras[j]->name.c_str() ); cv::imwrite( name, images[j] ); } }
void DepthOfField::apply (RenderDevice* rd, shared_ptr<Texture> color, shared_ptr<Texture> depth, const shared_ptr<Camera>& camera, Vector2int16 trimBandThickness) { if ((camera->depthOfFieldSettings().model() == DepthOfFieldModel::NONE) || ! camera->depthOfFieldSettings().enabled()) { const shared_ptr<Framebuffer>& f = rd->framebuffer(); const shared_ptr<Framebuffer::Attachment>& a = f->get(Framebuffer::COLOR0); if (isNull(f) || (a->texture() != color)) { Texture::copy(color, a->texture(), 0, 0, Vector2int16(0, 0), CubeFace::POS_X, CubeFace::POS_X, rd, false); } // Exit abruptly because DoF is disabled return; } alwaysAssertM(color, "Color buffer may not be NULL"); alwaysAssertM(depth, "Depth buffer may not be NULL"); if (isNull(m_artistCoCShader)) { reloadShaders(); } resizeBuffers(color, trimBandThickness); computeCoC(rd, color, depth, camera, trimBandThickness); blurPass(rd, m_packedBuffer, m_horizontalFramebuffer, m_horizontalShader, camera); blurPass(rd, m_tempBlurBuffer, m_verticalFramebuffer, m_verticalShader, camera); composite(rd, m_packedBuffer, m_blurBuffer, trimBandThickness); }
void MCStack::updatewindow(MCRegionRef p_region) { if (m_window_shape == nil || m_window_shape -> is_sharp) { InvalidateRgn((HWND)window -> handle . window, (HRGN)p_region, FALSE); UpdateWindow((HWND)window -> handle . window); } else { if (m_window_shape -> handle == nil) m_window_shape -> handle = MCscreen -> createpixmap(m_window_shape -> width, m_window_shape -> height, 0, False); Pixmap t_pixmap; t_pixmap = (Pixmap)m_window_shape -> handle; if (t_pixmap == nil) return; if (s_update_pixmap == nil) { MCWindowsLayeredStackSurface t_surface(t_pixmap, m_window_shape); redrawwindow(&t_surface, (MCRegionRef)p_region); } else MCscreen -> copyarea(s_update_pixmap, t_pixmap, 32, 0, 0, s_update_rect . width, s_update_rect . height, s_update_rect . x, s_update_rect . y, GXcopy); composite(); } }
void operator() (image_gray32f & dst) const { composite(dst, util::get<image_gray32f>(src_), mode_, opacity_, dx_, dy_ #ifdef MAPNIK_STATS_RENDER , log_stream_ #endif ); }
void MCStack::device_updatewindow(MCRegionRef p_region) { if (m_window_shape == nil || m_window_shape -> is_sharp) { InvalidateRgn((HWND)window -> handle . window, (HRGN)p_region, FALSE); UpdateWindow((HWND)window -> handle . window); } else { MCRectangle t_device_rect; t_device_rect = MCGRectangleGetIntegerBounds(MCResUserToDeviceRect(MCRectangleMake(0, 0, m_window_shape->width, m_window_shape->height))); HBITMAP t_bitmap = nil; void *t_bits = nil; if (m_window_shape -> handle == nil) { if (!create_temporary_dib(((MCScreenDC*)MCscreen)->getdsthdc(), t_device_rect.width, t_device_rect.height, t_bitmap, t_bits)) return; m_window_shape -> handle = t_bitmap; } else { t_bitmap = (HBITMAP)m_window_shape -> handle; BITMAP t_bitmap_struct; GetObjectA(t_bitmap, sizeof(BITMAP), &t_bitmap_struct); t_bits = t_bitmap_struct.bmBits; } MCGRaster t_raster; t_raster.width = t_device_rect.width; t_raster.height = t_device_rect.height; t_raster.pixels = t_bits; t_raster.stride = t_raster.width * sizeof(uint32_t); t_raster.format = kMCGRasterFormat_ARGB; MCGRaster t_mask; /* UNCHECKED */ MCWin32GetWindowShapeAlphaMask(m_window_shape, t_mask); MCWindowsLayeredStackSurface t_surface(t_raster, &t_mask); if (t_surface.Lock()) { if (s_update_callback == nil) device_redrawwindow(&t_surface, (MCRegionRef)p_region); else s_update_callback(&t_surface, (MCRegionRef)p_region, s_update_context); t_surface.Unlock(); composite(); } } }
void agg_renderer<T>::process(raster_symbolizer const& sym, mapnik::feature_impl & feature, proj_transform const& prj_trans) { raster_ptr const& source = feature.get_raster(); if (source) { // If there's a colorizer defined, use it to color the raster in-place raster_colorizer_ptr colorizer = sym.get_colorizer(); if (colorizer) colorizer->colorize(source,feature); box2d<double> target_ext = box2d<double>(source->ext_); prj_trans.backward(target_ext, PROJ_ENVELOPE_POINTS); box2d<double> ext = t_.forward(target_ext); int start_x = static_cast<int>(ext.minx()); int start_y = static_cast<int>(ext.miny()); int end_x = static_cast<int>(ceil(ext.maxx())); int end_y = static_cast<int>(ceil(ext.maxy())); int raster_width = end_x - start_x; int raster_height = end_y - start_y; if (raster_width > 0 && raster_height > 0) { image_data_32 target_data(raster_width,raster_height); raster target(target_ext, target_data); scaling_method_e scaling_method = sym.get_scaling_method(); double filter_radius = sym.calculate_filter_factor(); double offset_x = ext.minx() - start_x; double offset_y = ext.miny() - start_y; if (!prj_trans.equal()) { reproject_and_scale_raster(target, *source, prj_trans, offset_x, offset_y, sym.get_mesh_size(), filter_radius, scaling_method); } else { if (scaling_method == SCALING_BILINEAR8){ scale_image_bilinear8<image_data_32>(target.data_,source->data_, offset_x, offset_y); } else { double scaling_ratio = ext.width() / source->data_.width(); scale_image_agg<image_data_32>(target.data_, source->data_, scaling_method, scaling_ratio, offset_x, offset_y, filter_radius); } } composite(current_buffer_->data(), target.data_, sym.comp_op(), sym.get_opacity(), start_x, start_y, true); } } }
CompositeInstruction* SimpleAnimator::createBounceEffect(float bounceDistance, float timePerBounce, int numberOfBounce) { CompositeInstruction* ci = composite(true); for(int i = 0 ; i < numberOfBounce ; i++) { ci->move(sf::Vector2f(0, -bounceDistance), timePerBounce/2); ci->move(sf::Vector2f(0, bounceDistance), timePerBounce/2); } return ci; }
VImage VImage::composite( VImage other, VipsBlendMode mode, VOption *options ) { VImage v[2] = { *this, other }; std::vector<VImage> ivec( v, v + VIPS_NUMBER( v ) ); int m[1] = { static_cast<int>( mode ) }; std::vector<int> mvec( m, m + VIPS_NUMBER( m ) ); return( composite( ivec, mvec, options ) ); }
void agg_renderer<T0,T1>::process(raster_symbolizer const& sym, mapnik::feature_impl & feature, proj_transform const& prj_trans) { render_raster_symbolizer( sym, feature, prj_trans, common_, [&](image_rgba8 & target, composite_mode_e comp_op, double opacity, int start_x, int start_y) { composite(*current_buffer_, target, comp_op, opacity, start_x, start_y); } ); }
int main(int argc, char** argv) { const std::string filename = (argc > 1)? argv[1] : ""; auto img = cv::imread(filename,1); if(img.empty()){ std::cerr << "faild to open image file" << std::endl; return -1; } //グレースケールにしないと認識に使えないっぽい cv::Mat gray; cv::cvtColor(img,gray,CV_BGR2GRAY); //分類器 const std::string cascade_name = "/usr/share/opencv/haarcascades/haarcascade_frontalface_alt.xml"; cv::CascadeClassifier cascade; cascade.load(cascade_name); //顔の座標を検出、保存 std::vector<cv::Rect> faces; cascade.detectMultiScale(gray, faces, 1.1,2, CV_HAAR_SCALE_IMAGE, cv::Size(30,30)); //サスケェ const auto sasuke = cv::imread("./sasukee.png"); if(sasuke.empty()){ std::cerr << "faild to open SASUKE image file.\n" << "make sure that sasukee.png in this directory.\n" << "Try \"make image\" to get image file" << std::endl; return -1; } const cv::Mat cropped_sasuke(sasuke,cv::Rect(60,0,393,320)); for(auto r : faces){ cv::Point top_left; top_left.x = cv::saturate_cast<int>(r.x); top_left.y = cv::saturate_cast<int>(r.y); composite(img , top_left, r.width,r.height,cropped_sasuke); } //表示 cv::namedWindow("result",CV_WINDOW_AUTOSIZE|CV_WINDOW_FREERATIO); cv::imshow("result",img); cv::waitKey(0); }
Layer::Layer() { superlayer = NULL; _cornerRadius = 0; _backgroundColor = whiteColor; _borderColor = clearColor; _borderWidth = 0; _opacity = 1.0f; _visible = true; _backgroundContentMode = LayerContentModeScaleToFill; addDefaultKeyAccessors(); addDefaultActions(); composite(false); needsRedraw(); }
//----------------------------------------------------------------------------- //application draw -- virtual function //----------------------------------------------------------------------------- void Pcaster::draw() { //fprintf(stderr, "**** %s:%s() ****\n", __FILE__, __func__); if(pcaster_options::timing) { m_loger->flush_log(); if(m_fid > 0) m_loger->log(Log_Timer::LOG_InterFrame); else m_loger->start_timer(); } construct_ofp(); //ofp-based compositing schedule computed if(pcaster_options::timing){ glFinish(); m_loger->log(Log_Timer::LOG_OFP); } render(); if(pcaster_options::timing){ glFinish(); MPI_Barrier(MPI_COMM_WORLD); m_loger->log(Log_Timer::LOG_Render); } pack_pixels(); if(pcaster_options::timing){ MPI_Barrier(MPI_COMM_WORLD); m_loger->log(Log_Timer::LOG_Pack); } exchange_pixels(); if(pcaster_options::timing){ MPI_Barrier(MPI_COMM_WORLD); m_loger->log(Log_Timer::LOG_Exch); } composite(); if(pcaster_options::timing){ MPI_Barrier(MPI_COMM_WORLD); m_loger->log(Log_Timer::LOG_Comp); } m_fid++; }
void agg_renderer<T>::setup(Map const &m) { boost::optional<color> const& bg = m.background(); if (bg) { if (bg->alpha() < 255) { mapnik::color bg_color = *bg; bg_color.premultiply(); pixmap_.set_background(bg_color); } else { pixmap_.set_background(*bg); } } boost::optional<std::string> const& image_filename = m.background_image(); if (image_filename) { // NOTE: marker_cache returns premultiplied image, if needed boost::optional<mapnik::marker_ptr> bg_marker = mapnik::marker_cache::instance().find(*image_filename,true); if (bg_marker && (*bg_marker)->is_bitmap()) { mapnik::image_ptr bg_image = *(*bg_marker)->get_bitmap_data(); int w = bg_image->width(); int h = bg_image->height(); if ( w > 0 && h > 0) { // repeat background-image both vertically and horizontally unsigned x_steps = unsigned(std::ceil(width_/double(w))); unsigned y_steps = unsigned(std::ceil(height_/double(h))); for (unsigned x=0;x<x_steps;++x) { for (unsigned y=0;y<y_steps;++y) { composite(pixmap_.data(),*bg_image, src_over, 1.0f, x*w, y*h, false); } } } } } MAPNIK_LOG_DEBUG(agg_renderer) << "agg_renderer: Scale=" << m.scale(); }
void agg_renderer<T>::process(raster_symbolizer const& sym, mapnik::feature_ptr const& feature, proj_transform const& prj_trans) { raster_ptr const& source=feature->get_raster(); if (source) { // If there's a colorizer defined, use it to color the raster in-place raster_colorizer_ptr colorizer = sym.get_colorizer(); if (colorizer) colorizer->colorize(source,*feature); box2d<double> target_ext = box2d<double>(source->ext_); prj_trans.backward(target_ext, PROJ_ENVELOPE_POINTS); box2d<double> ext=t_.forward(target_ext); int start_x = (int)ext.minx(); int start_y = (int)ext.miny(); int end_x = (int)ceil(ext.maxx()); int end_y = (int)ceil(ext.maxy()); int raster_width = end_x - start_x; int raster_height = end_y - start_y; double err_offs_x = ext.minx() - start_x; double err_offs_y = ext.miny() - start_y; if (raster_width > 0 && raster_height > 0) { double scale_factor = ext.width() / source->data_.width(); image_data_32 target_data(raster_width,raster_height); raster target(target_ext, target_data); reproject_raster(target, *source, prj_trans, err_offs_x, err_offs_y, sym.get_mesh_size(), sym.calculate_filter_factor(), scale_factor, sym.get_scaling()); composite(current_buffer_->data(), target.data_, sym.comp_op(), sym.get_opacity(), start_x, start_y, false, false); } } }
/* SceneElement */ void Viewport::draw() { composite(); }
void agg_renderer<T>::process(raster_symbolizer const& sym, mapnik::feature_impl & feature, proj_transform const& prj_trans) { raster_ptr const& source = feature.get_raster(); if (source) { // If there's a colorizer defined, use it to color the raster in-place raster_colorizer_ptr colorizer = sym.get_colorizer(); if (colorizer) colorizer->colorize(source,feature); box2d<double> target_ext = box2d<double>(source->ext_); prj_trans.backward(target_ext, PROJ_ENVELOPE_POINTS); box2d<double> ext = t_.forward(target_ext); int start_x = static_cast<int>(std::floor(ext.minx()+.5)); int start_y = static_cast<int>(std::floor(ext.miny()+.5)); int end_x = static_cast<int>(std::floor(ext.maxx()+.5)); int end_y = static_cast<int>(std::floor(ext.maxy()+.5)); int raster_width = end_x - start_x; int raster_height = end_y - start_y; if (raster_width > 0 && raster_height > 0) { raster target(target_ext, raster_width,raster_height); scaling_method_e scaling_method = sym.get_scaling_method(); double filter_radius = sym.calculate_filter_factor(); bool premultiply_source = !source->premultiplied_alpha_; boost::optional<bool> is_premultiplied = sym.premultiplied(); if (is_premultiplied) { if (*is_premultiplied) premultiply_source = false; else premultiply_source = true; } if (premultiply_source) { agg::rendering_buffer buffer(source->data_.getBytes(), source->data_.width(), source->data_.height(), source->data_.width() * 4); agg::pixfmt_rgba32 pixf(buffer); pixf.premultiply(); } if (!prj_trans.equal()) { double offset_x = ext.minx() - start_x; double offset_y = ext.miny() - start_y; reproject_and_scale_raster(target, *source, prj_trans, offset_x, offset_y, sym.get_mesh_size(), filter_radius, scaling_method); } else { if (scaling_method == SCALING_BILINEAR8) { scale_image_bilinear8<image_data_32>(target.data_, source->data_, 0.0, 0.0); } else { double image_ratio_x = ext.width() / source->data_.width(); double image_ratio_y = ext.height() / source->data_.height(); scale_image_agg<image_data_32>(target.data_, source->data_, scaling_method, image_ratio_x, image_ratio_y, 0.0, 0.0, filter_radius); } } composite(current_buffer_->data(), target.data_, sym.comp_op(), sym.get_opacity(), start_x, start_y, false); } } }
PassOwnPtr<Keyframe::PropertySpecificKeyframe> AnimatableValueKeyframe::createPropertySpecificKeyframe(CSSPropertyID property) const { return adoptPtr(new PropertySpecificKeyframe(offset(), &easing(), propertyValue(property), composite())); }
PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::createPropertySpecificKeyframe(CSSPropertyID property) const { return adoptPtrWillBeNoop(new PropertySpecificKeyframe(offset(), easing(), propertyValue(property), composite())); }
PassRefPtr<Keyframe::PropertySpecificKeyframe> AnimatableValueKeyframe::createPropertySpecificKeyframe(PropertyHandle property) const { return PropertySpecificKeyframe::create(offset(), &easing(), propertyValue(property.cssProperty()), composite()); }
PassOwnPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::createPropertySpecificKeyframe(PropertyHandle property) const { if (property.isCSSProperty()) return adoptPtr(new CSSPropertySpecificKeyframe(offset(), &easing(), cssPropertyValue(property.cssProperty()), composite())); if (property.isPresentationAttribute()) return adoptPtr(new CSSPropertySpecificKeyframe(offset(), &easing(), presentationAttributeValue(property.presentationAttribute()), composite())); ASSERT(property.isSVGAttribute()); return adoptPtr(new SVGPropertySpecificKeyframe(offset(), &easing(), svgPropertyValue(property.svgAttribute()), composite())); }
int main(int argc, char *argv[]) { struct cmdlineInfo cmdline; FILE * underlayFileP; FILE * overlayFileP; FILE * alphaFileP; struct pam underlayPam; struct pam overlayPam; struct pam alphaPam; struct pam composedPam; int originLeft, originTop; pnm_init(&argc, argv); parseCommandLine(argc, argv, &cmdline); overlayFileP = pm_openr(cmdline.overlayFilespec); pnm_readpaminit(overlayFileP, &overlayPam, PAM_STRUCT_SIZE(allocation_depth)); if (cmdline.alphaFilespec) { alphaFileP = pm_openr(cmdline.alphaFilespec); pnm_readpaminit(alphaFileP, &alphaPam, PAM_STRUCT_SIZE(allocation_depth)); if (overlayPam.width != alphaPam.width || overlayPam.height != alphaPam.height) pm_error("Opacity map and overlay image are not the same size"); } else alphaFileP = NULL; underlayFileP = pm_openr(cmdline.underlyingFilespec); pnm_readpaminit(underlayFileP, &underlayPam, PAM_STRUCT_SIZE(allocation_depth)); computeOverlayPosition(underlayPam.width, underlayPam.height, overlayPam.width, overlayPam.height, cmdline, &originLeft, &originTop); composedPam.size = sizeof(composedPam); composedPam.len = PAM_STRUCT_SIZE(allocation_depth); composedPam.allocation_depth = 0; composedPam.file = pm_openw(cmdline.outputFilespec); determineOutputType(&composedPam, &underlayPam, &overlayPam); pnm_setminallocationdepth(&underlayPam, composedPam.depth); pnm_setminallocationdepth(&overlayPam, composedPam.depth); composite(originLeft, originTop, &underlayPam, &overlayPam, alphaFileP ? &alphaPam : NULL, cmdline.alphaInvert, cmdline.opacity, &composedPam, cmdline.linear); if (alphaFileP) pm_close(alphaFileP); pm_close(overlayFileP); pm_close(underlayFileP); pm_close(composedPam.file); /* If the program failed, it previously aborted with nonzero completion code, via various function calls. */ return 0; }
int main(int argc, const char *argv[]) { struct cmdlineInfo cmdline; FILE * underlayFileP; FILE * overlayFileP; FILE * alphaFileP; struct pam underlayPam; struct pam overlayPam; struct pam alphaPam; struct pam composedPam; int originLeft, originTop; pm_proginit(&argc, argv); parseCommandLine(argc, argv, &cmdline); overlayFileP = pm_openr(cmdline.overlayFilespec); overlayPam.comment_p = NULL; pnm_readpaminit(overlayFileP, &overlayPam, PAM_STRUCT_SIZE(opacity_plane)); if (overlayPam.len < PAM_STRUCT_SIZE(opacity_plane)) pm_error("Libnetpbm is too old. This program requires libnetpbm from " "Netpbm 10.56 (September 2011) or newer"); if (!overlayPam.visual) pm_error("Overlay image has tuple type '%s', which is not a " "standard visual type. We don't know how to compose.", overlayPam.tuple_type); initAlphaFile(cmdline, &overlayPam, &alphaFileP, &alphaPam); underlayFileP = pm_openr(cmdline.underlyingFilespec); underlayPam.comment_p = NULL; pnm_readpaminit(underlayFileP, &underlayPam, PAM_STRUCT_SIZE(opacity_plane)); assert(underlayPam.len >= PAM_STRUCT_SIZE(opacity_plane)); if (!overlayPam.visual) pm_error("Overlay image has tuple type '%s', which is not a " "standard visual type. We don't know how to compose.", overlayPam.tuple_type); computeOverlayPosition(underlayPam.width, underlayPam.height, overlayPam.width, overlayPam.height, cmdline, &originLeft, &originTop); composedPam.size = PAM_STRUCT_SIZE(opacity_plane); composedPam.len = PAM_STRUCT_SIZE(allocation_depth); composedPam.allocation_depth = 0; composedPam.file = pm_openw(cmdline.outputFilespec); composedPam.comment_p = NULL; determineOutputType(&underlayPam, &overlayPam, &composedPam); pnm_setminallocationdepth(&underlayPam, composedPam.depth); pnm_setminallocationdepth(&overlayPam, composedPam.depth); composite(originLeft, originTop, &underlayPam, &overlayPam, alphaFileP ? &alphaPam : NULL, cmdline.alphaInvert, cmdline.opacity, &composedPam, cmdline.linear, cmdline.mixtransparency); if (alphaFileP) pm_close(alphaFileP); pm_close(overlayFileP); pm_close(underlayFileP); pm_close(composedPam.file); /* If the program failed, it previously aborted with nonzero completion code, via various function calls. */ return 0; }
int main(int argc, char *argv[]) { int n = 10; int ierr = 0; double reltol = 1.0e-14; double abstol = 1.0e-14; int MyPID = 0; try { // Initialize MPI #ifdef HAVE_MPI MPI_Init(&argc,&argv); #endif // Create a communicator for Epetra objects #ifdef HAVE_MPI Epetra_MpiComm Comm( MPI_COMM_WORLD ); #else Epetra_SerialComm Comm; #endif MyPID = Comm.MyPID(); // Create the map Epetra_Map map(n, 0, Comm); bool verbose = false; // Check for verbose output if (argc>1) if (argv[1][0]=='-' && argv[1][1]=='v') verbose = true; // Seed the random number generator in Teuchos. We create random // bordering matrices and it is possible different processors might generate // different matrices. By setting the seed, this shouldn't happen. Teuchos::ScalarTraits<double>::seedrandom(12345); // Create and initialize the parameter vector LOCA::ParameterVector pVector; pVector.addParameter("Param 1", 1.69); pVector.addParameter("Param 2", -9.7); pVector.addParameter("Param 3", 0.35); pVector.addParameter("Param 4", -0.78); pVector.addParameter("Param 5", 2.53); // Create parameter list Teuchos::RCP<Teuchos::ParameterList> paramList = Teuchos::rcp(new Teuchos::ParameterList); Teuchos::ParameterList& nlParams = paramList->sublist("NOX"); Teuchos::ParameterList& nlPrintParams = nlParams.sublist("Printing"); nlPrintParams.set("MyPID", MyPID); if (verbose) nlPrintParams.set("Output Information", NOX::Utils::Error + NOX::Utils::Details + NOX::Utils::OuterIteration + NOX::Utils::InnerIteration + NOX::Utils::Warning + NOX::Utils::TestDetails + NOX::Utils::StepperIteration + NOX::Utils::StepperDetails); else nlPrintParams.set("Output Information", NOX::Utils::Error); // Create global data object Teuchos::RCP<LOCA::GlobalData> globalData = LOCA::createGlobalData(paramList); Epetra_Vector clone_vec(map); NOX::Epetra::Vector nox_clone_vec(clone_vec); Teuchos::RCP<NOX::Abstract::Vector> x = nox_clone_vec.clone(NOX::ShapeCopy); x->random(); Teuchos::RCP<NOX::Abstract::MultiVector> dx1 = nox_clone_vec.createMultiVector(3); Teuchos::RCP<NOX::Abstract::MultiVector> dx2 = nox_clone_vec.createMultiVector(1); Teuchos::RCP<NOX::Abstract::MultiVector> dx3 = nox_clone_vec.createMultiVector(2); Teuchos::RCP<NOX::Abstract::MultiVector> dx4 = nox_clone_vec.createMultiVector(2); dx1->random(); dx2->random(); dx3->init(0.0); dx4->random(); Teuchos::RCP<NOX::Abstract::MultiVector> dx_all = dx1->clone(NOX::DeepCopy); dx_all->augment(*dx2); dx_all->augment(*dx3); dx_all->augment(*dx4); NOX::Abstract::MultiVector::DenseMatrix dp1(dx1->numVectors(), pVector.length()); NOX::Abstract::MultiVector::DenseMatrix dp2(dx2->numVectors(), pVector.length()); NOX::Abstract::MultiVector::DenseMatrix dp3(dx3->numVectors(), pVector.length()); NOX::Abstract::MultiVector::DenseMatrix dp4(dx4->numVectors(), pVector.length()); dp1.random(); dp2.random(); dp3.random(); dp4.random(); NOX::Abstract::MultiVector::DenseMatrix dp_all(dx_all->numVectors(), pVector.length()); for (int j=0; j<dp_all.numCols(); j++) { for (int i=0; i<dp1.numRows(); i++) dp_all(i,j) = dp1(i,j); for (int i=0; i<dp2.numRows(); i++) dp_all(dp1.numRows()+i,j) = dp2(i,j); for (int i=0; i<dp3.numRows(); i++) dp_all(dp1.numRows()+dp2.numRows()+i,j) = dp3(i,j); for (int i=0; i<dp4.numRows(); i++) dp_all(dp1.numRows()+dp2.numRows()+dp3.numRows()+i,j) = dp4(i,j); } std::vector< Teuchos::RCP<LOCA::MultiContinuation::ConstraintInterface> > constraintObjs(4); Teuchos::RCP<LinearConstraint> linear_constraint; linear_constraint = Teuchos::rcp(new LinearConstraint(dx1->numVectors(), pVector, nox_clone_vec)); linear_constraint->setDgDx(*dx1); linear_constraint->setDgDp(dp1); linear_constraint->setIsZeroDX(false); constraintObjs[0] = linear_constraint; linear_constraint = Teuchos::rcp(new LinearConstraint(dx2->numVectors(), pVector, nox_clone_vec)); linear_constraint->setDgDx(*dx2); linear_constraint->setDgDp(dp2); linear_constraint->setIsZeroDX(false); constraintObjs[1] = linear_constraint; linear_constraint = Teuchos::rcp(new LinearConstraint(dx3->numVectors(), pVector, nox_clone_vec)); linear_constraint->setDgDx(*dx3); linear_constraint->setDgDp(dp3); linear_constraint->setIsZeroDX(true); constraintObjs[2] = linear_constraint; linear_constraint = Teuchos::rcp(new LinearConstraint(dx4->numVectors(), pVector, nox_clone_vec)); linear_constraint->setDgDx(*dx4); linear_constraint->setDgDp(dp4); linear_constraint->setIsZeroDX(false); constraintObjs[3] = linear_constraint; // Check some statistics on the solution NOX::TestCompare testCompare(globalData->locaUtils->out(), *(globalData->locaUtils)); LOCA::MultiContinuation::CompositeConstraint composite(globalData, constraintObjs); composite.setX(*x); LinearConstraint combined(dx_all->numVectors(), pVector, nox_clone_vec); combined.setDgDx(*dx_all); combined.setDgDp(dp_all); combined.setX(*x); // // test computeConstraints() // composite.computeConstraints(); combined.computeConstraints(); int numConstraints = dx_all->numVectors(); const NOX::Abstract::MultiVector::DenseMatrix& g_composite = composite.getConstraints(); const NOX::Abstract::MultiVector::DenseMatrix& g_combined = combined.getConstraints(); ierr += testCompare.testMatrix( g_composite, g_combined, reltol, abstol, "CompositeConstraint::computeConstraints()"); // // test computeDP() // std::vector<int> paramIDs(3); paramIDs[0] = 1; paramIDs[1] = 2; paramIDs[2] = 4; NOX::Abstract::MultiVector::DenseMatrix dgdp_composite( numConstraints, paramIDs.size()+1); NOX::Abstract::MultiVector::DenseMatrix dgdp_combined( numConstraints, paramIDs.size()+1); dgdp_composite.putScalar(0.0); dgdp_combined.putScalar(0.0); composite.computeDP(paramIDs, dgdp_composite, false); combined.computeDP(paramIDs, dgdp_combined, false); ierr += testCompare.testMatrix( dgdp_composite, dgdp_combined, reltol, abstol, "CompositeConstraint::computeDP()"); // // test multiplyDX() // composite.computeDX(); combined.computeDX(); int numMultiply = 5; Teuchos::RCP<NOX::Abstract::MultiVector> A = nox_clone_vec.createMultiVector(numMultiply); A->random(); NOX::Abstract::MultiVector::DenseMatrix composite_multiply(numConstraints, numMultiply); NOX::Abstract::MultiVector::DenseMatrix combined_multiply(numConstraints, numMultiply); composite.multiplyDX(2.65, *A, composite_multiply); combined.multiplyDX(2.65, *A, combined_multiply); ierr += testCompare.testMatrix(composite_multiply, combined_multiply, reltol, abstol, "CompositeConstraint::multiplyDX()"); // // test addDX() (No Trans) // int numAdd = 5; NOX::Abstract::MultiVector::DenseMatrix B1(numConstraints, numAdd); B1.random(); NOX::Abstract::MultiVector::DenseMatrix B2(numAdd, numConstraints); B2.random(); Teuchos::RCP<NOX::Abstract::MultiVector> composite_add1 = nox_clone_vec.createMultiVector(numAdd); composite_add1->random(); Teuchos::RCP<NOX::Abstract::MultiVector> composite_add2 = nox_clone_vec.createMultiVector(numAdd); composite_add2->random(); Teuchos::RCP<NOX::Abstract::MultiVector> combined_add1 = composite_add1->clone(NOX::DeepCopy); Teuchos::RCP<NOX::Abstract::MultiVector> combined_add2 = composite_add2->clone(NOX::DeepCopy); composite.addDX(Teuchos::NO_TRANS, 1.45, B1, 2.78, *composite_add1); combined.addDX(Teuchos::NO_TRANS, 1.45, B1, 2.78, *combined_add1); ierr += testCompare.testMultiVector( *composite_add1, *combined_add1, reltol, abstol, "CompositeConstraint::addDX() (No Trans)"); // // test addDX() (Trans) // composite.addDX(Teuchos::TRANS, 1.45, B2, 2.78, *composite_add2); combined.addDX(Teuchos::TRANS, 1.45, B2, 2.78, *combined_add2); ierr += testCompare.testMultiVector( *composite_add2, *combined_add2, reltol, abstol, "CompositeConstraint::addDX() (Trans)"); LOCA::destroyGlobalData(globalData); } catch (std::exception& e) { std::cout << e.what() << std::endl; ierr = 1; } catch (const char *s) { std::cout << s << std::endl; ierr = 1; } catch (...) { std::cout << "Caught unknown exception!" << std::endl; ierr = 1; } if (MyPID == 0) { if (ierr == 0) std::cout << "All tests passed!" << std::endl; else std::cout << ierr << " test(s) failed!" << std::endl; } #ifdef HAVE_MPI MPI_Finalize() ; #endif return ierr; }
Model::Model(const MODEL &mod) { type = DEF; fast_reach = false; fpfp_sim = false; op = false; cpus = 2; ci = false; bp = false; // variable list var_list = mod.var_list; // reserved variable list has been abandoned reserved_var_list = mod.reserved_var_list; // the parsed parameter list param_list = mod.param_list; // parameters for IMCR im_param_list = mod.im_param_list; // the parsed initial declaration init = mod.init; // param_list = known params + unknown params Param_list unknown_param_list; for (unsigned i = 0; i < param_list.params.size(); i++) if( param_list.params[i].op == "=") known_param_list.params.push_back(param_list.params[i]); else unknown_param_list.params.push_back(param_list.params[i]); param_list = unknown_param_list; /** * for now, let's focus on reachability analysis **/ //build_param_list_im(); for ( vector<AUTOMATON>::const_iterator it = mod.automaton_v.begin(); it != mod.automaton_v.end(); it ++) { Automaton *aton = new Automaton(*it); string s1 = aton->name; for ( unsigned i = 0; i < aton->locations.size(); i++) { string s2 = aton->locations[i]->name; pair_ss ss1(s1, s2); aton->locations[i]->is_bad = find(ss1, init.bads); if( find(ss1, init.init)) aton->init = aton->locations[i]; } automata.push_back(aton); } //cout << "number of automata " << automata.size() << endl; //for (unsigned i = 0; i < automata.size(); i++) { // cout << i << " automaton " << automata[i]->name << endl; // automata[i]->print(); //} // Bounded parametric synthesis bound = numeric_limits<int>::max(); cout << "To composite ... "; com = automata.at(0); for (unsigned i = 1; i < automata.size(); i++) { com = composite(com, automata[i]); } cout << " Done!\n"; //com->print(); for (vector<Location*>::iterator it = com->locations.begin(); it != com->locations.end(); ++it) { (*it)->populate_signature(); for (unsigned i = 0; i < (*it)->outgoing.size(); i++) { (*it)->outgoing[i].index = UniqueIndex::get_next_index(); //(*it)->outgoing[i].guard_cvx = guard_cvx( (*it)->outgoing[i] ); } (*it)->time_elapse = time_elapse_cvx(*it); passed_map[(*it)->signature] = make_shared< list<shared_ptr<pair_sc> > > (); passing_map[(*it)->signature] = make_shared< list<shared_ptr<pair_sc> > > (); next_map[(*it)->signature] = make_shared< list<shared_ptr<pair_sc> > > (); } N = var_list.vars.size() / 2; /** * for now, let's focus on reachability analysis **/ //ff_poly = NNC_Polyhedron(0, EMPTY); //line = 0; }
// MW-2006-03-20: Bug 3316 - There seems absolutely no way of preventing flicker // when transitioning from no alpha to alpha. Therefore, we need to create a new // window opened *behind* the current window; show it; redraw it; then delete // the existing window. void MCStack::setopacity(uint1 p_level) { // If the stack is not ours to open, then we do nothing ('runtime' mode/remoteable // window). if (!MCModeMakeLocalWindows()) return; // Do nothing if not NT if (MCmajorosversion < 0x0500) return; if (m_window_shape != NULL && !m_window_shape -> is_sharp) composite(); else if (window != NULL) { HWND t_old_window; t_old_window = NULL; DWORD t_old_long, t_new_long; t_old_long = GetWindowLong((HWND)window -> handle . window, GWL_EXSTYLE); if (p_level == 255) t_new_long = t_old_long & ~WS_EX_LAYERED; else t_new_long = t_old_long | WS_EX_LAYERED; if (t_new_long != t_old_long) { if (IsWindowVisible((HWND)window -> handle . window) && (t_new_long & WS_EX_LAYERED) != 0) t_old_window = (HWND)window -> handle . window; else SetWindowLong((HWND)window -> handle . window, GWL_EXSTYLE, t_new_long); } if (t_old_window != NULL) { uint32_t t_style, t_ex_style; getstyle(t_style, t_ex_style); // MW-2006-07-27: [[ Bug 3690 ]] - Make sure layered attribute is set if we need it t_ex_style = (t_ex_style & ~WS_EX_LAYERED) | (t_new_long & WS_EX_LAYERED); RECT t_rect; t_rect = getwrect(rect, t_style, t_ex_style); Bool t_is_xp_menu; t_is_xp_menu = (mode == WM_PULLDOWN || mode == WM_POPUP || mode == WM_CASCADE) && (MCcurtheme && MCcurtheme->getthemeid() == LF_NATIVEWIN); if (!t_is_xp_menu && mode < WM_PULLDOWN) window -> handle . window = (MCSysWindowHandle)CreateWindowExW(t_ex_style, MC_WIN_CLASS_NAME_W, WideCString(getname_cstring()), t_style | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, t_rect . left, t_rect . top, t_rect . right - t_rect . left, t_rect . bottom - t_rect . top, NULL, NULL, MChInst, NULL); else window -> handle . window = (MCSysWindowHandle)CreateWindowExA(t_ex_style, t_is_xp_menu ? MC_MENU_WIN_CLASS_NAME : mode >= WM_PULLDOWN ? MC_POPUP_WIN_CLASS_NAME : MC_WIN_CLASS_NAME, getname_cstring(), t_style | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, t_rect . left, t_rect . top, t_rect . right - t_rect . left, t_rect . bottom - t_rect . top, NULL, NULL, MChInst, NULL); // MW-2010-10-22: [[ Bug 8151 ]] Make sure we update the title string. if (titlestring != nil) MCscreen -> setname(window, titlestring); SetWindowLongA((HWND)window->handle.window, GWL_USERDATA, mode); if (flags & F_DECORATIONS && !(decorations & WD_SHAPE) && !(decorations & WD_CLOSE)) EnableMenuItem(GetSystemMenu((HWND)window->handle.window, False), SC_CLOSE, MF_BYCOMMAND | MF_GRAYED); if (m_window_shape != nil && m_window_shape -> is_sharp) { MCRegionRef t_region; t_region = (MCRegionRef)m_window_shape -> handle; MCRegionOffset(t_region, rect . x - t_rect . left, rect . y - t_rect . top); MCRegionSetAsWindowShape(t_region, window->handle.window); // The window now owns the region. m_window_shape -> handle = nil; } RevokeDragDrop(t_old_window); CoLockObjectExternal(droptarget, FALSE, TRUE); droptarget -> setstack(NULL); droptarget -> setstack(this); CoLockObjectExternal(droptarget, TRUE, TRUE); RegisterDragDrop((HWND)window -> handle . window, droptarget); SetWindowPos((HWND)window -> handle . window, t_old_window, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOSENDCHANGING | SWP_NOSIZE | SWP_SHOWWINDOW); MCPlayer *t_player; for(t_player = MCplayers; t_player != NULL; t_player = t_player -> getnextplayer()) if (t_player -> getstack() == this) t_player -> changewindow((MCSysWindowHandle)t_old_window); } if (p_level < 255) SetLayeredWindowAttributes((HWND)window -> handle . window, 0, p_level, LWA_ALPHA); if (t_old_window != NULL) { RedrawWindow((HWND)window -> handle . window, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); DestroyWindow(t_old_window); } } }
void Color::blend(Color const &color, float alpha) { composite(color, 1.0f-alpha, alpha); }
int reduced_charset(struct zint_symbol *symbol, unsigned char *source, int length) { /* These are the "norm" standards which only support Latin-1 at most */ int error_number = 0; #ifndef _MSC_VER unsigned char preprocessed[length + 1]; #else unsigned char* preprocessed = (unsigned char*)_alloca(length + 1); #endif if(symbol->symbology == BARCODE_CODE16K) { symbol->whitespace_width = 16; symbol->border_width = 2; symbol->output_options = BARCODE_BIND; } if(symbol->symbology == BARCODE_ITF14) { symbol->whitespace_width = 20; symbol->border_width = 8; symbol->output_options = BARCODE_BOX; } switch(symbol->input_mode) { case DATA_MODE: case GS1_MODE: memcpy(preprocessed, source, length); preprocessed[length] = '\0'; break; case UNICODE_MODE: error_number = latin1_process(symbol, source, preprocessed, &length); if(error_number != 0) { return error_number; } break; } switch(symbol->symbology) { case BARCODE_C25MATRIX: error_number = matrix_two_of_five(symbol, preprocessed, length); break; case BARCODE_C25IND: error_number = industrial_two_of_five(symbol, preprocessed, length); break; case BARCODE_C25INTER: error_number = interleaved_two_of_five(symbol, preprocessed, length); break; case BARCODE_C25IATA: error_number = iata_two_of_five(symbol, preprocessed, length); break; case BARCODE_C25LOGIC: error_number = logic_two_of_five(symbol, preprocessed, length); break; case BARCODE_DPLEIT: error_number = dpleit(symbol, preprocessed, length); break; case BARCODE_DPIDENT: error_number = dpident(symbol, preprocessed, length); break; case BARCODE_UPCA: error_number = eanx(symbol, preprocessed, length); break; case BARCODE_UPCE: error_number = eanx(symbol, preprocessed, length); break; case BARCODE_EANX: error_number = eanx(symbol, preprocessed, length); break; case BARCODE_EAN128: error_number = ean_128(symbol, preprocessed, length); break; case BARCODE_CODE39: error_number = c39(symbol, preprocessed, length); break; case BARCODE_PZN: error_number = pharmazentral(symbol, preprocessed, length); break; case BARCODE_EXCODE39: error_number = ec39(symbol, preprocessed, length); break; case BARCODE_CODABAR: error_number = codabar(symbol, preprocessed, length); break; case BARCODE_CODE93: error_number = c93(symbol, preprocessed, length); break; case BARCODE_LOGMARS: error_number = c39(symbol, preprocessed, length); break; case BARCODE_CODE128: error_number = code_128(symbol, preprocessed, length); break; case BARCODE_CODE128B: error_number = code_128(symbol, preprocessed, length); break; case BARCODE_NVE18: error_number = nve_18(symbol, preprocessed, length); break; case BARCODE_CODE11: error_number = code_11(symbol, preprocessed, length); break; case BARCODE_MSI_PLESSEY: error_number = msi_handle(symbol, preprocessed, length); break; case BARCODE_TELEPEN: error_number = telepen(symbol, preprocessed, length); break; case BARCODE_TELEPEN_NUM: error_number = telepen_num(symbol, preprocessed, length); break; case BARCODE_PHARMA: error_number = pharma_one(symbol, preprocessed, length); break; case BARCODE_PLESSEY: error_number = plessey(symbol, preprocessed, length); break; case BARCODE_ITF14: error_number = itf14(symbol, preprocessed, length); break; case BARCODE_FLAT: error_number = flattermarken(symbol, preprocessed, length); break; case BARCODE_FIM: error_number = fim(symbol, preprocessed, length); break; case BARCODE_POSTNET: error_number = post_plot(symbol, preprocessed, length); break; case BARCODE_PLANET: error_number = planet_plot(symbol, preprocessed, length); break; case BARCODE_RM4SCC: error_number = royal_plot(symbol, preprocessed, length); break; case BARCODE_AUSPOST: error_number = australia_post(symbol, preprocessed, length); break; case BARCODE_AUSREPLY: error_number = australia_post(symbol, preprocessed, length); break; case BARCODE_AUSROUTE: error_number = australia_post(symbol, preprocessed, length); break; case BARCODE_AUSREDIRECT: error_number = australia_post(symbol, preprocessed, length); break; case BARCODE_CODE16K: error_number = code16k(symbol, preprocessed, length); break; case BARCODE_PHARMA_TWO: error_number = pharma_two(symbol, preprocessed, length); break; case BARCODE_ONECODE: error_number = imail(symbol, preprocessed, length); break; case BARCODE_ISBNX: error_number = eanx(symbol, preprocessed, length); break; case BARCODE_RSS14: error_number = rss14(symbol, preprocessed, length); break; case BARCODE_RSS14STACK: error_number = rss14(symbol, preprocessed, length); break; case BARCODE_RSS14STACK_OMNI: error_number = rss14(symbol, preprocessed, length); break; case BARCODE_RSS_LTD: error_number = rsslimited(symbol, preprocessed, length); break; case BARCODE_RSS_EXP: error_number = rssexpanded(symbol, preprocessed, length); break; case BARCODE_RSS_EXPSTACK: error_number = rssexpanded(symbol, preprocessed, length); break; case BARCODE_EANX_CC: error_number = composite(symbol, preprocessed, length); break; case BARCODE_EAN128_CC: error_number = composite(symbol, preprocessed, length); break; case BARCODE_RSS14_CC: error_number = composite(symbol, preprocessed, length); break; case BARCODE_RSS_LTD_CC: error_number = composite(symbol, preprocessed, length); break; case BARCODE_RSS_EXP_CC: error_number = composite(symbol, preprocessed, length); break; case BARCODE_UPCA_CC: error_number = composite(symbol, preprocessed, length); break; case BARCODE_UPCE_CC: error_number = composite(symbol, preprocessed, length); break; case BARCODE_RSS14STACK_CC: error_number = composite(symbol, preprocessed, length); break; case BARCODE_RSS14_OMNI_CC: error_number = composite(symbol, preprocessed, length); break; case BARCODE_RSS_EXPSTACK_CC: error_number = composite(symbol, preprocessed, length); break; case BARCODE_KIX: error_number = kix_code(symbol, preprocessed, length); break; case BARCODE_CODE32: error_number = code32(symbol, preprocessed, length); break; case BARCODE_DAFT: error_number = daft_code(symbol, preprocessed, length); break; case BARCODE_EAN14: error_number = ean_14(symbol, preprocessed, length); break; case BARCODE_AZRUNE: error_number = aztec_runes(symbol, preprocessed, length); break; case BARCODE_KOREAPOST: error_number = korea_post(symbol, preprocessed, length); break; case BARCODE_HIBC_128: error_number = hibc(symbol, preprocessed, length); break; case BARCODE_HIBC_39: error_number = hibc(symbol, preprocessed, length); break; case BARCODE_HIBC_DM: error_number = hibc(symbol, preprocessed, length); break; case BARCODE_HIBC_QR: error_number = hibc(symbol, preprocessed, length); break; case BARCODE_HIBC_PDF: error_number = hibc(symbol, preprocessed, length); break; case BARCODE_HIBC_MICPDF: error_number = hibc(symbol, preprocessed, length); break; case BARCODE_HIBC_AZTEC: error_number = hibc(symbol, preprocessed, length); break; case BARCODE_JAPANPOST: error_number = japan_post(symbol, preprocessed, length); break; case BARCODE_CODE49: error_number = code_49(symbol, preprocessed, length); break; case BARCODE_CHANNEL: error_number = channel_code(symbol, preprocessed, length); break; case BARCODE_CODEONE: error_number = code_one(symbol, preprocessed, length); break; case BARCODE_DATAMATRIX: error_number = dmatrix(symbol, preprocessed, length); break; case BARCODE_PDF417: error_number = pdf417enc(symbol, preprocessed, length); break; case BARCODE_PDF417TRUNC: error_number = pdf417enc(symbol, preprocessed, length); break; case BARCODE_MICROPDF417: error_number = micro_pdf417(symbol, preprocessed, length); break; case BARCODE_MAXICODE: error_number = maxicode(symbol, preprocessed, length); break; case BARCODE_AZTEC: error_number = aztec(symbol, preprocessed, length); break; } return error_number; }