当前位置: 首页 > news >正文

网站免费建站k网络搜索引擎有哪些

网站免费建站k,网络搜索引擎有哪些,适合小公司的记账软件,PHP企业网站开发实践文章目录 FLTK - FLTK1.4.1 - demo - animgifimage概述笔记END FLTK - FLTK1.4.1 - demo - animgifimage 概述 知识点: 注册图像文件类型判断回调 FLTK支持的图像格式 GIF, BMP, ICO, PNM, PNG, jpg, svg 事件回调的注册 GIF图像显示为图片或动画的标志设置 // 超时回调的设置…

文章目录

    • FLTK - FLTK1.4.1 - demo - animgifimage
    • 概述
    • 笔记
    • END

FLTK - FLTK1.4.1 - demo - animgifimage

概述

知识点:
注册图像文件类型判断回调
FLTK支持的图像格式 GIF, BMP, ICO, PNM, PNG, jpg, svg
事件回调的注册
GIF图像显示为图片或动画的标志设置
// 超时回调的设置和移除, 超时回调是一次性的,如果还需要同一个超时回调,需要再次设置超时回调
// 文件选择器UI的调用和返回
// 用户选择通过文件选择器选择的文件,有可能不是指定尾缀的文件类型
// fltk窗口的遍历
// fltk窗口 背景颜色设置 Fl_Color
// fltk窗口退出回调的设置
// 图像数据载入成功和图像数据有效的判断
// 图像关键数据(长,宽,帧数)的取得
// fltk窗口类的copy_x()是复制了一份数据,并不是指向原始数据
// fltk图像类禁用缓存
// fltk窗体禁止响应快捷键的窗体size缩放
// 等待当前窗体正常结束
// fltk类的构造函数是通过弹窗来报错的(e.g. 图像文件格式错), 这个报错信息不是API调用者能控制的。

笔记

// FLTK - FLTK1.4.1 - demo - animgifimage
/*
知识点:注册图像文件类型判断回调FLTK支持的图像格式 GIF, BMP, ICO, PNM, PNG, jpg, svg事件回调的注册GIF图像显示为图片或动画的标志设置// 超时回调的设置和移除, 超时回调是一次性的,如果还需要同一个超时回调,需要再次设置超时回调// 文件选择器UI的调用和返回// 用户选择通过文件选择器选择的文件,有可能不是指定尾缀的文件类型// fltk窗口的遍历// fltk窗口 背景颜色设置 Fl_Color// fltk窗口退出回调的设置// 图像数据载入成功和图像数据有效的判断// 图像关键数据(长,宽,帧数)的取得// fltk窗口类的copy_x()是复制了一份数据,并不是指向原始数据// fltk图像类禁用缓存// fltk窗体禁止响应快捷键的窗体size缩放// 等待当前窗体正常结束// fltk类的构造函数是通过弹窗来报错的(e.g. 图像文件格式错), 这个报错信息不是API调用者能控制的。
*/#include "fltk_test.h"// 如果要将fl demo的实现搬过来测试,就注释掉下面的宏
// #define DONT_USE_FL_DEMO#ifdef DONT_USE_FL_DEMO
int fl_demo_main(int argc, char** argv)
{return 0;
}#else#endif // TEST_FL_DEMO//
//  Test program for displaying animated GIF files using the
//  Fl_Anim_GIF_Image class.
//
#include <FL/Fl_Anim_GIF_Image.H>#include <FL/Fl_Double_Window.H>
#include <FL/Fl_File_Chooser.H>
#include <FL/Fl_Shared_Image.H>
#include <FL/Fl_Tiled_Image.H>
#include <stdlib.h>static int g_good_count = 0, g_bad_count = 0, g_frame_count = 0;static const Fl_Color BackGroundColor = FL_GRAY; // use e.g. FL_RED to see// transparent parts better
static const double RedrawDelay = 30 /* 1. / 20*/ ;         // interval [sec] for forced redrawstatic void quit_cb(Fl_Widget* w_, void*) {exit(0);
}static void set_title(Fl_Window* win, Fl_Anim_GIF_Image* animgif) {char buf[200];snprintf(buf, sizeof(buf), "%s (%d frames)  %2.2fx", fl_filename_name(animgif->name()),animgif->frames(), animgif->speed());if (animgif->frame_uncache())strcat(buf, " U");// fltk窗口类的copy_x()是复制了一份数据,并不是指向原始数据win->copy_label(buf);win->copy_tooltip(buf);
}static void cb_forced_redraw(void* d) {// fltk窗口的遍历Fl_Window* win = Fl::first_window();while (win) {if (!win->menu_window())win->redraw();win = Fl::next_window(win);}if (Fl::first_window())Fl::repeat_timeout(RedrawDelay, cb_forced_redraw);
}Fl_Window* openFile(const char* name, char* flags, bool close = false) {// determine test options from 'flags'bool uncache = strchr(flags, 'u');char* d = flags - 1;int debug = 0;while ((d = strchr(++d, 'd'))) debug++;bool optimize_mem = strchr(flags, 'm');bool desaturate = strchr(flags, 'D');bool average = strchr(flags, 'A');bool test_tiles = strchr(flags, 'T');bool test_forced_redraw = strchr(flags, 'f');char* r = strchr(flags, 'r');bool resizable = r && !test_tiles;double scale = 1.0;if (r && resizable) scale = atof(r + 1);if (scale <= 0.1 || scale > 5)scale = resizable ? 0.7 : 1.0;// setup windowFl::remove_timeout(cb_forced_redraw);Fl_Double_Window* win = new Fl_Double_Window(300, 300);// fltk窗口 背景颜色设置 Fl_Colorwin->color(BackGroundColor);if (close){// fltk窗口退出回调的设置win->callback(quit_cb);}printf("Loading '%s'%s%s ... ", name,uncache ? " (uncached)" : "",optimize_mem ? " (optimized)" : "");// create a canvas for the animationFl_Box* canvas = test_tiles ? 0 : new Fl_Box(0, 0, 0, 0); // canvas will be resized by animationFl_Box* canvas2 = 0;unsigned short gif_flags = debug ? Fl_Anim_GIF_Image::LOG_FLAG : 0;if (debug > 1)gif_flags |= Fl_Anim_GIF_Image::DEBUG_FLAG;if (optimize_mem)gif_flags |= Fl_Anim_GIF_Image::OPTIMIZE_MEMORY;// create animation, specifying this canvas as display widget// fltk类的构造函数是通过弹窗来报错的(e.g. 图像文件格式错), 这个报错信息不是API调用者能控制的。Fl_Anim_GIF_Image* animgif = new Fl_Anim_GIF_Image(name, canvas, gif_flags);// 图像数据载入成功和图像数据有效的判断bool good(animgif->ld() == 0 && animgif->valid());// 图像关键数据(长,宽,帧数)的取得printf("%s: %d x %d (%d frames) %s\n",animgif->name(), animgif->w(), animgif->h(), animgif->frames(), good ? "OK" : "ERROR");// for the statistics (when run on testsuite):g_good_count += good;g_bad_count += !good;g_frame_count += animgif->frames();// 设置窗体的用户数据win->user_data(animgif); // store address of image (see note in main())// exercise the optional tests on the animation// fltk图像类禁用缓存animgif->frame_uncache(uncache);if (scale != 1.0) {animgif->resize(scale);printf("TEST: resized %s by %.2f to %d x %d\n", animgif->name(), scale, animgif->w(), animgif->h());}if (average) {printf("TEST: color_average %s\n", animgif->name());animgif->color_average(FL_GREEN, 0.5); // currently hardcoded}if (desaturate) {printf("TEST: desaturate %s\n", animgif->name());animgif->desaturate();}int W = animgif->w();int H = animgif->h();if (animgif->frames()) {if (test_tiles) {// demonstrate a way how to use the animation with Fl_Tiled_Imageprintf("TEST: use %s as tiles\n", animgif->name());W *= 2;H *= 2;Fl_Tiled_Image* tiled_image = new Fl_Tiled_Image(animgif);Fl_Group* group = new Fl_Group(0, 0, win->w(), win->h());group->image(tiled_image);group->align(FL_ALIGN_INSIDE);animgif->canvas(group, Fl_Anim_GIF_Image::DONT_RESIZE_CANVAS | Fl_Anim_GIF_Image::DONT_SET_AS_IMAGE);win->resizable(group);}else {// demonstrate a way how to use same animation in another canvas simultaneously:// as the current implementation allows only automatic redraw of one canvas..if (test_forced_redraw) {if (W < 400) {printf("TEST: open %s in another animation with application redraw\n", animgif->name());canvas2 = new Fl_Box(W, 0, animgif->w(), animgif->h()); // another canvas for animationcanvas2->image(animgif); // is set to same animation!W *= 2;Fl::add_timeout(RedrawDelay, cb_forced_redraw); // force periodic redraw}}}// make window resizable (must be done before show())if (resizable && canvas && !test_tiles) {win->resizable(win);}win->size(W, H); // change to actual size of canvas// start the animationwin->end();win->show();win->wait_for_expose();set_title(win, animgif);if (resizable && !test_tiles) {// need to reposition the widgets (have been moved by setting resizable())if (canvas && canvas2) {canvas->resize(0, 0, W / 2, canvas->h());canvas2->resize(W / 2, 0, W / 2, canvas2->h());}else if (canvas) {canvas->resize(0, 0, animgif->canvas_w(), animgif->canvas_h());}}// fltk窗体禁止响应快捷键的窗体size缩放win->init_sizes(); // IMPORTANT: otherwise weird things happen at Ctrl+/- scaling}else {delete win;return 0;}if (debug >= 3) {// open each frame in a separate windowfor (int i = 0; i < animgif->frames(); i++) {char buf[200];snprintf(buf, sizeof(buf), "Frame #%d", i + 1);Fl_Double_Window* win = new Fl_Double_Window(animgif->w(), animgif->h());win->copy_tooltip(buf);win->copy_label(buf);win->color(BackGroundColor);int w = animgif->image(i)->w();int h = animgif->image(i)->h();// in 'optimize_mem' mode frames must be offsetted to canvasint x = (w == animgif->w() && h == animgif->h()) ? 0 : animgif->frame_x(i);int y = (w == animgif->w() && h == animgif->h()) ? 0 : animgif->frame_y(i);Fl_Box* b = new Fl_Box(x, y, w, h);// get the frame imageb->image(animgif->image(i));win->end();win->show();}}return win;
}#include <FL/filename.H>
bool openDirectory(const char* dir, char* flags) {dirent** list;int nbr_of_files = fl_filename_list(dir, &list, fl_alphasort);if (nbr_of_files <= 0)return false;int cnt = 0;for (int i = 0; i < nbr_of_files; i++) {char buf[512];const char* name = list[i]->d_name;if (!strcmp(name, ".") || !strcmp(name, "..")) continue;const char* p = strstr(name, ".gif");if (!p) p = strstr(name, ".GIF");if (!p) continue;if (*(p + 4)) continue; // is no extension!snprintf(buf, sizeof(buf), "%s/%s", dir, name);if (strstr(name, "debug"))  // hack: when name contains 'debug' open single framesstrcat(flags, "d");if (openFile(buf, flags, cnt == 0))cnt++;}return cnt != 0;
}static void change_speed(double delta) {Fl_Widget* below = Fl::belowmouse();if (below && below->image()) {Fl_Anim_GIF_Image* animgif = 0;// Q: is there a way to determine Fl_Tiled_Image without using dynamic cast?Fl_Tiled_Image* tiled = dynamic_cast<Fl_Tiled_Image*>(below->image());animgif = tiled ?dynamic_cast<Fl_Anim_GIF_Image*>(tiled->image()) :dynamic_cast<Fl_Anim_GIF_Image*>(below->image());if (animgif && animgif->playing()) {double speed = animgif->speed();if (!delta) speed = 1.;else speed += delta;if (speed < 0.1) speed = 0.1;if (speed > 10) speed = 10;animgif->speed(speed);set_title(below->window(), animgif);}}
}static int events(int event) {if (event == FL_SHORTCUT) {if (Fl::event_key() == '+')change_speed(0.1);else if (Fl::event_key() == '-')change_speed(-0.1);else if (Fl::event_key() == '0')change_speed(0);elsereturn 0;return 1;}return 0;
}static const char testsuite[] = "testsuite";int fl_demo_main(int argc, char* argv[]) {// 注册图像文件类型判断回调fl_register_images();// 事件回调的注册Fl::add_handler(events);char* openFlags = (char*)calloc(1024, 1);if (argc > 1) {// started with argumemtsif (strstr(argv[1], "-h")) {printf("Usage:\n""   -t [directory] [-{flags}] open all files in directory (default name: %s) [with options]\n""   filename [-{flags}] open single file [with options] \n""   No arguments open a fileselector\n""   {flags} can be: d=debug mode, u=uncached, D=desaturated, A=color averaged, T=tiled\n""                   m=minimal update, r[scale factor]=resize by 'scale factor'\n""   Use keys '+'/'-/0' to change speed of the active image (belowmouse).\n", testsuite);exit(1);}for (int i = 1; i < argc; i++) {if (argv[i][0] == '-')strcat(openFlags, &argv[i][1]);}if (strchr(openFlags, 't')) { // open all GIF-files in a given directoryconst char* dir = testsuite;for (int i = 2; i < argc; i++)if (argv[i][0] != '-')dir = argv[i];openDirectory(dir, openFlags);printf("Summary: good=%d, bad=%d, frames=%d\n", g_good_count, g_bad_count, g_frame_count);}else { // open given file(s)for (int i = 1; i < argc; i++)if (argv[i][0] != '-')openFile(argv[i], openFlags, strchr(openFlags, 'd'));}}else {// started without arguments: choose file// GIF图像显示为图片或动画的标志设置Fl_GIF_Image::animate = true; // create animated shared .GIF images (e.g. file chooser)while (1) {Fl::add_timeout(RedrawDelay, cb_forced_redraw); // animate images in chooser// 文件选择器UI的调用和返回// 用户选择通过文件选择器选择的文件,有可能不是指定尾缀的文件类型const char* filename = fl_file_chooser("Select a GIF image file", "*.{gif,GIF}", NULL);// 超时回调的移除Fl::remove_timeout(cb_forced_redraw);if (!filename)break;Fl_Window* win = openFile(filename, openFlags);// 等待当前窗体正常结束Fl::run();// delete last window (which is now just hidden) to test destructors// NOTE: it is essential that *before* doing this also the//       animated image is destroyed, otherwise it will crash//       because it's canvas will be gone.//       In order to keep this demo simple, the adress of the//       Fl_Anim_GIF_Image has been stored in the window's user_data.//       In a real-life application you will probably store//       it somewhere in the window's or canvas' object and destroy//       the image in the window's or canvas' destructor.if (win && win->user_data())delete ((Fl_Anim_GIF_Image*)win->user_data());delete win;}}return Fl::run();
}

END


文章转载自:
http://overaggressive.hjyw.cn
http://tippler.hjyw.cn
http://signalize.hjyw.cn
http://villain.hjyw.cn
http://pantheistical.hjyw.cn
http://kraurotic.hjyw.cn
http://usaf.hjyw.cn
http://flexitime.hjyw.cn
http://tussor.hjyw.cn
http://unaspiring.hjyw.cn
http://deaminate.hjyw.cn
http://tinner.hjyw.cn
http://renault.hjyw.cn
http://enzyme.hjyw.cn
http://mariana.hjyw.cn
http://krad.hjyw.cn
http://ratteen.hjyw.cn
http://voodooism.hjyw.cn
http://peritricha.hjyw.cn
http://wigwam.hjyw.cn
http://microprojector.hjyw.cn
http://valorize.hjyw.cn
http://trough.hjyw.cn
http://linux.hjyw.cn
http://declassee.hjyw.cn
http://hexane.hjyw.cn
http://despumation.hjyw.cn
http://booter.hjyw.cn
http://epidermization.hjyw.cn
http://immanence.hjyw.cn
http://effortless.hjyw.cn
http://contented.hjyw.cn
http://noncommunicant.hjyw.cn
http://malassimilation.hjyw.cn
http://flagpole.hjyw.cn
http://lanac.hjyw.cn
http://ruthfulness.hjyw.cn
http://conspicuous.hjyw.cn
http://saloon.hjyw.cn
http://baldacchino.hjyw.cn
http://protrusile.hjyw.cn
http://maintainable.hjyw.cn
http://chimae.hjyw.cn
http://rerelease.hjyw.cn
http://malacoderm.hjyw.cn
http://gowk.hjyw.cn
http://scherzo.hjyw.cn
http://biter.hjyw.cn
http://highroad.hjyw.cn
http://kvar.hjyw.cn
http://tasman.hjyw.cn
http://sculp.hjyw.cn
http://diseconomy.hjyw.cn
http://camalig.hjyw.cn
http://syphilology.hjyw.cn
http://captainless.hjyw.cn
http://specialization.hjyw.cn
http://terai.hjyw.cn
http://pleochroic.hjyw.cn
http://unbathed.hjyw.cn
http://rumble.hjyw.cn
http://schizophrene.hjyw.cn
http://entomologize.hjyw.cn
http://unalienated.hjyw.cn
http://intangibly.hjyw.cn
http://darkly.hjyw.cn
http://exserted.hjyw.cn
http://interfering.hjyw.cn
http://hamamatsu.hjyw.cn
http://masturbation.hjyw.cn
http://jaguar.hjyw.cn
http://sheepskin.hjyw.cn
http://undisputable.hjyw.cn
http://turdine.hjyw.cn
http://leyden.hjyw.cn
http://plaguily.hjyw.cn
http://untinged.hjyw.cn
http://pantology.hjyw.cn
http://hydric.hjyw.cn
http://dullhead.hjyw.cn
http://sandpiper.hjyw.cn
http://delay.hjyw.cn
http://doukhobors.hjyw.cn
http://compilation.hjyw.cn
http://party.hjyw.cn
http://purline.hjyw.cn
http://suggestive.hjyw.cn
http://malpighia.hjyw.cn
http://astacin.hjyw.cn
http://flavobacterium.hjyw.cn
http://southwardly.hjyw.cn
http://swage.hjyw.cn
http://cleanse.hjyw.cn
http://username.hjyw.cn
http://aminophenol.hjyw.cn
http://basilect.hjyw.cn
http://pseudonymity.hjyw.cn
http://polemologist.hjyw.cn
http://spirometry.hjyw.cn
http://semibasement.hjyw.cn
http://www.dt0577.cn/news/95511.html

相关文章:

  • 建网站的英文培训机构连锁加盟
  • 网站建设方案意见网站推广的技术有哪些
  • 政府未来网站建设和发展规划哪个公司网站设计好
  • 网站建设与知识产权seo的基本步骤顺序正确的是
  • html5手机版优化公司流程制度
  • 江门市做网站交换友情链接推广法
  • 网站平台建设工作汇报网络营销有本科吗
  • 永康市网站建设制作高端网站定制
  • 泰州做网站公司电商seo是什么意思啊
  • 网站开发环境有哪些培训机构好还是学校好
  • 一个网站开发项目小组成员怎么在百度做网站推广
  • 深圳做网站的公司百度指数的主要功能有
  • 百度收录网站名普通话的顺口溜6句
  • ui设计是什么含义宁波seo哪家好快速推广
  • 买网站账号做推广互联网营销的五个手段
  • 县政府子网站建设步骤软文广告图片
  • 南宁网站建设费用网络营销专业学校排名
  • 超炫html5网站模板衡阳seo优化
  • 查询网站的外链软件外包平台
  • 贵州建设厅监理协会网站百度搜索排名优化
  • 昆山做网站价格电商培训机构排名前十
  • 做壁纸壁的网站有什么品牌推广策略有哪几种
  • 外贸独立网站推特最新消息今天
  • 越秀营销型网站seo点击优化
  • 公司网站建设需求书学电脑在哪里报名
  • 重庆网络科技有限公司佛山做网络优化的公司
  • 西安最有名的策划公司站长之家seo工具包
  • 沈阳网站建设设计seo管理软件
  • 音乐做音基题网站活动推广文案
  • 简单的网站模板衡阳seo服务