当前位置: 首页>>代码示例>>C++>>正文


C++ Fl_Image::copy方法代码示例

本文整理汇总了C++中Fl_Image::copy方法的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Image::copy方法的具体用法?C++ Fl_Image::copy怎么用?C++ Fl_Image::copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fl_Image的用法示例。


在下文中一共展示了Fl_Image::copy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: load_icon

void DesktopIcon::load_icon(int face) {
	const char* ic = NULL;

	if(face != ICON_FACE_TWO) {
		if(!settings->icon.empty())
			ic = settings->icon.c_str();
	} else {
		if(!settings->icon2.empty())
			ic = settings->icon2.c_str();
	}

	if(!ic)
		return;

	if(!IconLoader::set(this, ic, ICON_SIZE_HUGE)) {
		E_DEBUG(E_STRLOC ": Unable to load %s icon\n", ic);
		return;
	}	

	/* fetch image object for sizes */
	Fl_Image* img = image();

	int img_w = img->w();
	int img_h = img->h();

	/* resize box if icon is larger */
	if(img_w > ICON_SIZE_MIN_W || img_h > ICON_SIZE_MIN_H)
		size(img_w + OFFSET_W, img_h + OFFSET_H);

	/* darker icon version for selection */
	delete darker_img;

	darker_img = img->copy(img->w(), img->h());
	darker_img->color_average(FL_BLUE, 0.6);
}
开发者ID:edeproject,项目名称:svn,代码行数:35,代码来源:DesktopIcon.cpp

示例2: reload

void DerivedShared_Image::reload ()
{
    int i;
    FILE * fp;
    uchar header[64];
    Fl_Image * img;

    if (!name_)
        return;

    if ((fp = fl_fopen (name_, "rb")) != NULL)
    {
        if (fread (header, 1, sizeof (header), fp) == 0)
        { /* ignore */
        }
        fclose (fp);
    }
    else
    {
        return;
    }

    if (memcmp (header, "#define", 7) == 0) // XBM file
        img = new Fl_XBM_Image (name_);
    else if (memcmp (header, "/* XPM */", 9) == 0) // XPM file
        img = new Fl_XPM_Image (name_);
    else
    {
        for (i = 0, img = 0; i < num_handlers_; i++)
        {
            // The only difference is the cast
            img = (static_cast<Fl_Image *> (
                (fl_handlers_[i]) (name_, header, sizeof (header))));

            if (img)
                break;
        }
    }

    if (img)
    {
        if (alloc_image_)
            delete image_;

        alloc_image_ = 1;

        if ((img->w () != w () && w ()) || (img->h () != h () && h ()))
        {
            Fl_Image * temp = img->copy (w (), h ());
            delete img;
            image_ = temp;
        }
        else
        {
            image_ = img;
        }

        update ();
    }
};
开发者ID:Happy-Ferret,项目名称:XwinTox,代码行数:60,代码来源:DerivedShared_Image.cpp

示例3: if

void
Panner::draw_the_box ( int tx, int ty, int tw, int th )
{
    draw_box();

    Fl_Image *i = 0;

    if ( _bg_image && ( _bg_image->h() != th || projection() != _bg_image_projection ) )
    {
        if ( _bg_image_scaled )
            delete _bg_image;
        else
            ((Fl_Shared_Image*)_bg_image)->release();

        _bg_image = 0;
    }

    if ( ! _bg_image )
    {
        if ( projection() == POLAR )
        {
            if ( th <= 92 )
                i = Fl_Shared_Image::get( PIXMAP_PATH "/non-mixer/panner-sphere-92x92.png" );
            else if ( th <= 502 )
                i = Fl_Shared_Image::get( PIXMAP_PATH "/non-mixer/panner-sphere-502x502.png" );
            else if ( th <= 802 )
                i = Fl_Shared_Image::get( PIXMAP_PATH "/non-mixer/panner-sphere-802x802.png" );
        }
        else
        {
            if ( th <= 92 )
                i = Fl_Shared_Image::get( PIXMAP_PATH "/non-mixer/panner-plane-92x92.png" );
            else if ( th <= 502 )
                i = Fl_Shared_Image::get( PIXMAP_PATH "/non-mixer/panner-plane-502x502.png" );
            else if ( th <= 802 )
                i = Fl_Shared_Image::get( PIXMAP_PATH "/non-mixer/panner-plane-802x802.png" );
        }

        if ( i && i->h() != th )
        {
            Fl_Image *scaled = i->copy( th, th );

            _bg_image = scaled;
            _bg_image_scaled = true;
        }
        else
        {
            _bg_image = i;
            _bg_image_scaled = false;
        }
    }
    
    _bg_image_projection = projection();

    if ( _bg_image )
        _bg_image->draw( tx, ty );
}
开发者ID:0mk,项目名称:non,代码行数:57,代码来源:Panner.C

示例4: if

//=============================================================================
Fl_Image * openTextureFile(string strFileName)
{
	Fl_Image *img = NULL;
	try
	{
		if (getExt(strFileName) == ".jpg" || getExt(strFileName) == ".jpeg")
			img = new Fl_JPEG_Image(strFileName.c_str());
		else if (getExt(strFileName) == ".png")
			img = new Fl_PNG_Image(strFileName.c_str());
		else
			img = new Fl_BMP_Image(strFileName.c_str());
	}
	catch(std::bad_alloc x)
	{
		mem_alloc_failure(__FILE__, __LINE__);
		return NULL;
	}

	//  return if no image
	if (img->d() == 0 || img->h() == 0 || img->w() == 0)
	{
		delete img;
		return NULL;
	}

	//  downsize if image is too big
	if (img->h() > 4096 || img->w() > 4096)
	{
		cout << ("Downsizing image to maximum of 4096 a side");
		int h = img->h() >= img->w() ? 4096 : 4096 * img->h() / img->w();
		int w = img->w() >= img->h() ? 4096 : 4096 * img->w() / img->h();
		Fl_Image *img2 = img->copy(w, h);
		delete img;
		img = img2;
	}
	
	return img;
}
开发者ID:ribells,项目名称:cove_yurt,代码行数:39,代码来源:scene_tex.cpp


注:本文中的Fl_Image::copy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。