亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? cellwidget.c

?? Linux環(huán)境下手寫輸入程序。手寫輸入
?? C
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):
/*cellwriter -- a character recognition input methodCopyright (C) 2007 Michael Levin <risujin@risujin.org>This program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.*/#include "config.h"#include "common.h"#include "recognize.h"#include "keys.h"#include <string.h>/* stroke.c */void smooth_stroke(Stroke *s);void simplify_stroke(Stroke *s);/* cellwidget.c */int cell_widget_scrollbar_width(void);static void start_timeout(void);static void show_context_menu(int button, int time);static void stop_drawing(void);/*        Cells*/#define ALTERNATES 5#define CELL_BASELINE (cell_height / 3)#define CELL_BORDER (cell_height / 12)#define KEY_WIDGET_COLS 4#define KEY_WIDGET_BORDER 6/* Msec of no mouse motion before a cell is finished */#define MOTION_TIMEOUT 500/* Cell flags */#define CELL_SHOW_INK   0x01#define CELL_DIRTY      0x02#define CELL_VERIFIED   0x04#define CELL_SHIFTED    0x08struct Cell {        Sample sample, *alts[ALTERNATES];        gunichar2 ch;        int alt_used[ALTERNATES];        char flags, alt_ratings[ALTERNATES];};/* Cell preferences */int cell_width = 40, cell_height = 70, cell_cols_pref = 12, cell_rows_pref = 4,    enable_cairo = TRUE, training = FALSE, train_on_input = TRUE,    right_to_left = FALSE, keyboard_enabled = TRUE, xinput_enabled = FALSE;/* Statistics */int corrections = 0, rewrites = 0, characters = 0, inputs = 0;/* Colors */GdkColor custom_active_color = RGB_TO_GDKCOLOR(255, 255, 255),         custom_inactive_color = RGB_TO_GDKCOLOR(212, 222, 226),         custom_ink_color = RGB_TO_GDKCOLOR(0, 0, 0),         custom_select_color = RGB_TO_GDKCOLOR(204, 0, 0);static GdkColor color_active, color_inactive, color_ink, color_select;static Cell *cells = NULL, *cells_saved = NULL;static GtkWidget *drawing_area = NULL, *training_menu, *scrollbar;static GdkPixmap *pixmap = NULL;static GdkGC *pixmap_gc = NULL;static GdkColor color_bg, color_bg_dark;static cairo_t *cairo = NULL;static PangoContext *pango = NULL;static PangoFontDescription *pango_font_desc = NULL;static KeyWidget *key_widget;static gunichar2 *history[HISTORY_MAX];static int cell_cols, cell_rows, cell_row_view = 0, current_cell = -1, old_cc,           cell_cols_saved, cell_rows_saved, cell_row_view_saved,           timeout_source,           drawing = FALSE, inserting = FALSE, eraser = FALSE, invalid = FALSE,           potential_insert = FALSE, potential_hold = FALSE, cross_out = FALSE,           show_keys = TRUE, is_clear = TRUE, keys_dirty = FALSE;static double cursor_x, cursor_y;static void cell_coords(int cell, int *px, int *py)/* Get the int position of a cell from its index */{        int cell_y, cell_x;        cell -= cell_row_view * cell_cols;        cell_y = cell / cell_cols;        cell_x = cell - cell_y * cell_cols;        *px = (!right_to_left ? cell_x * cell_width :                                (cell_cols - cell_x - 1) * cell_width) + 1;        *py = cell_y * cell_height + 1;}static void set_pen_color(Sample *sample, int cell)/* Selects the pen color depending on if the sample being drawn is the input   or the template sample */{        if (sample == input || sample == &cells[cell].sample)                cairo_set_source_gdk_color(cairo, &color_ink, 1.);        else                cairo_set_source_gdk_color(cairo, &color_select, 1.);}static void render_point(Sample *sample, int cell, int stroke, Vec2 *offset)/* Draw a single point stroke */{        double x, y, radius;        int cx, cy;        if (!pixmap || stroke < 0 || !sample || stroke >= sample->len ||            sample->strokes[stroke]->len < 1)                return;        /* Apply offset */        x = sample->strokes[stroke]->points[0].x;        y = sample->strokes[stroke]->points[0].y;        if (offset) {                x += offset->x;                y += offset->y;        }        /* Unscale coordinates */        cell_coords(cell, &cx, &cy);        x = cx + cell_width / 2 + x * cell_height / SCALE;        y = cy + cell_height / 2 + y * cell_height / SCALE;        /* Draw a dot with cairo */        cairo_new_path(cairo);        radius = cell_height / 33.;        cairo_arc(cairo, x, y, radius > 1. ? radius : 1., 0., 2 * M_PI);        set_pen_color(sample, cell);        cairo_fill(cairo);        gtk_widget_queue_draw_area(drawing_area, x - radius - 0.5,                                   y - radius - 0.5, radius * 2 + 0.5,                                   radius * 2 + 0.5);}static void render_segment(Sample *sample, int cell, int stroke, int seg,                           Vec2 *offset)/* Draw a segment of the stroke   FIXME since the segments are not properly connected according to Cairo,         there is a bit of missing value at the segment connection points */{        double pen_width, x1, x2, y1, y2;        int xmin, xmax, ymin, ymax, cx, cy, pen_range;        if (!cairo || stroke < 0 || !sample || stroke >= sample->len ||            seg < 0 || seg >= sample->strokes[stroke]->len - 1)                return;        x1 = sample->strokes[stroke]->points[seg].x;        x2 = sample->strokes[stroke]->points[seg + 1].x;        y1 = sample->strokes[stroke]->points[seg].y;        y2 = sample->strokes[stroke]->points[seg + 1].y;        /* Apply offset */        if (offset) {                x1 += offset->x;                y1 += offset->y;                x2 += offset->x;                y2 += offset->y;        }        /* Unscale coordinates */        cell_coords(cell, &cx, &cy);        x1 = cx + cell_width / 2 + x1 * cell_height / SCALE;        x2 = cx + cell_width / 2 + x2 * cell_height / SCALE;        y1 = cy + cell_height / 2 + y1 * cell_height / SCALE;        y2 = cy + cell_height / 2 + y2 * cell_height / SCALE;        /* Find minimum and maximum x and y */        if (x1 > x2) {                xmax = x1 + 0.9999;                xmin = x2;        } else {                xmin = x1;                xmax = x2 + 0.9999;        }        if (y1 > y2) {                ymax = y1 + 0.9999;                ymin = y2;        } else {                ymin = y1;                ymax = y2 + 0.9999;        }        /* Draw the new segment using Cairo */        cairo_new_path(cairo);        cairo_move_to(cairo, x1, y1);        cairo_line_to(cairo, x2, y2);        set_pen_color(sample, cell);        pen_width = cell_height / 33.;        if (pen_width < 1.)                pen_width = 1.;        cairo_set_line_width(cairo, pen_width);        cairo_stroke(cairo);        /* Dirty only the new segment */        pen_range = 2 * pen_width + 0.9999;        gtk_widget_queue_draw_area(drawing_area, xmin - pen_range,                                   ymin - pen_range,                                   xmax - xmin + pen_range + 1,                                   ymax - ymin + pen_range + 1);}static void render_sample(Sample *sample, int cell)/* Render the ink from a sample in a cell */{        Vec2 sc_to_ic;        int i, j;        if (!sample)                return;        /* Center stored samples on input */        if (sample != &cells[cell].sample)                center_samples(&sc_to_ic, sample, &cells[cell].sample);        else                vec2_set(&sc_to_ic, 0., 0.);        for (i = 0; i < sample->len; i++)                if (sample->strokes[i]->len <= 1 ||                    sample->strokes[i]->spread < DOT_SPREAD)                        render_point(sample, cell, i, &sc_to_ic);                else                        for (j = 0; j < sample->strokes[i]->len - 1; j++)                                render_segment(sample, cell, i, j, &sc_to_ic);}static int cell_offscreen(int cell){        int rows, cols;        cols = cell_cols;        if (show_keys)                cols -= KEY_WIDGET_COLS;        rows = cell_rows < cell_rows_pref ? cell_rows : cell_rows_pref;        return cell < cell_row_view * cols ||               cell >= (cell_row_view + rows) * cols;}static void dirty_cell(int cell){        if (!cell_offscreen(cell))                cells[cell].flags |= CELL_DIRTY;}static void dirty_all(void){        int i, rows;        rows = cell_row_view + cell_rows_pref > cell_rows ?               cell_rows : cell_row_view + cell_rows_pref;        for (i = cell_cols * cell_row_view; i < rows * cell_cols; i++)                cells[i].flags |= CELL_DIRTY;}static void render_cell(int i){        cairo_pattern_t *pattern;        GdkColor color, *base_color;        Cell *pc;        int x, y, active, cols, samples = 0;        if (!cairo || !pixmap || !pixmap_gc || cell_offscreen(i))                return;        pc = cells + i;        cell_coords(i, &x, &y);        if (training) {                samples = char_trained(pc->ch);                active = pc->ch && (samples > 0 ||                                    (current_cell == i && input &&                                     !invalid && input->len));        } else                active = pc->ch || (current_cell == i && !inserting &&                                    !invalid && input && input->len);        base_color = active ? &color_active : &color_inactive;        /* Fill above baseline */        gdk_gc_set_rgb_fg_color(pixmap_gc, base_color);        gdk_draw_rectangle(pixmap, pixmap_gc, TRUE, x, y, cell_width,                                cell_height - CELL_BASELINE);        /* Fill baseline */        highlight_gdk_color(base_color, &color, 0.1);        gdk_gc_set_rgb_fg_color(pixmap_gc, &color);        gdk_draw_rectangle(pixmap, pixmap_gc, TRUE, x, y + cell_height -                           CELL_BASELINE, cell_width, CELL_BASELINE);        /* Cairo clip region */        cairo_reset_clip(cairo);        cairo_rectangle(cairo, x, y, cell_width, cell_height);        cairo_clip(cairo);        /* Separator line */        cols = cell_cols;        if (show_keys)                cols -= KEY_WIDGET_COLS;        if ((!right_to_left && i % cell_cols) ||            (right_to_left && i % cell_cols != cols - 1)) {                highlight_gdk_color(base_color, &color, 0.5);                pattern = cairo_pattern_create_linear(x, y, x, y + cell_height);                cairo_pattern_add_gdk_color_stop(pattern, 0.0, &color, 0.);                cairo_pattern_add_gdk_color_stop(pattern, 0.5, &color, 1.);                cairo_pattern_add_gdk_color_stop(pattern, 1.0, &color, 0.);                cairo_set_source(cairo, pattern);                cairo_set_line_width(cairo, 0.5);                cairo_move_to(cairo, x + 0.5, y);                cairo_line_to(cairo, x + 0.5, y + cell_height - 1);                cairo_stroke(cairo);                cairo_pattern_destroy(pattern);        }        /* Draw ink if shown */        if ((cells[i].ch && cells[i].flags & CELL_SHOW_INK) ||            (current_cell == i && input && input->len)) {                int j;                render_sample(&cells[i].sample, i);                if (cells[i].ch)                        for (j = 0; j < ALTERNATES && cells[i].alts[j]; j++)                                if (sample_valid(cells[i].alts[j],                                                 cells[i].alt_used[j]) &&                                    cells[i].alts[j]->ch == cells[i].ch) {                                        render_sample(cells[i].alts[j], i);                                        break;                                }        }        /* Draw letter if recognized or training */        else if (pc->ch && (current_cell != i || !input || !input->len)) {                PangoLayout *layout;                PangoRectangle ink_ext, log_ext;                char string[6] = { 0, 0, 0, 0, 0, 0 };                /* Training color is determined by how well a character is                   trained */                if (training) {                        if (samples)                                highlight_gdk_color(&color_ink, &color,                                                    0.5 - ((double)samples) /                                                    samples_max / 2.);                        else                                highlight_gdk_color(&color_inactive,                                                    &color, 0.2);                }                /* Use ink color unless this is a questionable match */                else {                        color = color_ink;                        if (!(pc->flags & CELL_VERIFIED) && pc->alts[0] &&                            pc->alts[1] && pc->ch == pc->alts[0]->ch &&                            pc->alt_ratings[0] - pc->alt_ratings[1] <= 10)                                color = color_select;                }                cairo_set_source_gdk_color(cairo, &color, 1.);                layout = pango_layout_new(pango);                cairo_move_to(cairo, x, y);                g_unichar_to_utf8(pc->ch, string);                pango_layout_set_text(layout, string, 6);                pango_layout_set_font_description(layout, pango_font_desc);                pango_layout_get_pixel_extents(layout, &ink_ext, &log_ext);                cairo_rel_move_to(cairo,                                  cell_width / 2 - log_ext.width / 2, 2);                pango_cairo_show_layout(cairo, layout);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
a美女胸又www黄视频久久| 奇米888四色在线精品| 99久久精品免费精品国产| 欧美经典三级视频一区二区三区| 国产乱国产乱300精品| 久久精品一区二区三区不卡牛牛| 国产精品综合久久| 国产精品全国免费观看高清| 不卡av电影在线播放| 亚洲制服欧美中文字幕中文字幕| 精品视频全国免费看| 麻豆精品视频在线| 国产精品免费视频一区| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 亚洲综合在线五月| 日韩免费看的电影| 94色蜜桃网一区二区三区| 图片区小说区区亚洲影院| 精品国产网站在线观看| 不卡大黄网站免费看| 午夜精品成人在线| 国产婷婷色一区二区三区| 一本色道久久综合精品竹菊| 青青草97国产精品免费观看| 国产精品午夜久久| 8v天堂国产在线一区二区| 成人综合婷婷国产精品久久蜜臀| 亚洲人精品午夜| 精品欧美乱码久久久久久1区2区| 99精品桃花视频在线观看| 蜜臀av性久久久久蜜臀aⅴ四虎| 亚洲国产成人午夜在线一区| 欧美精品粉嫩高潮一区二区| 国产成人av影院| 日韩精品1区2区3区| 国产精品视频免费| 精品久久久三级丝袜| 在线看不卡av| av在线不卡电影| 久久国产尿小便嘘嘘| 亚洲一二三区视频在线观看| 欧美高清在线精品一区| 欧美一区午夜精品| 一本久久精品一区二区| 国产成人精品综合在线观看 | 国产欧美一区二区精品秋霞影院| 91久久精品午夜一区二区| 国产一二精品视频| 男女性色大片免费观看一区二区| 亚洲欧美日韩中文字幕一区二区三区 | 国产精品乱码人人做人人爱| 欧美一卡二卡在线| 欧美日韩中文国产| 色综合婷婷久久| 成人黄色一级视频| 国模大尺度一区二区三区| 日韩激情在线观看| 亚洲一区二区三区免费视频| 亚洲欧美电影一区二区| 欧美极品美女视频| 久久综合精品国产一区二区三区 | 精品免费国产二区三区| 欧美日韩亚洲不卡| 欧美偷拍一区二区| 91香蕉视频黄| 91美女福利视频| aaa欧美大片| 成人精品一区二区三区中文字幕| 国产成人av自拍| 国产·精品毛片| 国产91精品在线观看| 国产69精品久久久久777| 国产.欧美.日韩| 成人爱爱电影网址| jiyouzz国产精品久久| 91丨porny丨在线| 色婷婷精品久久二区二区蜜臂av | 狠狠色丁香婷婷综合| 日本vs亚洲vs韩国一区三区| 免费观看久久久4p| 久久99精品久久久久久动态图 | 99久久夜色精品国产网站| 成人av网址在线观看| 91亚洲大成网污www| www.亚洲国产| 一本大道久久a久久综合| 在线一区二区三区做爰视频网站| 色综合久久久久久久久| 欧美日韩国产小视频在线观看| 欧美精品一二三区| 欧美videofree性高清杂交| 久久综合久久综合九色| 国产精品二三区| 亚洲国产日产av| 日本aⅴ免费视频一区二区三区 | 日本女人一区二区三区| 久久精品国产99久久6| 福利一区在线观看| 色婷婷久久久亚洲一区二区三区 | 欧美一级二级三级乱码| 欧美大片拔萝卜| 欧美国产精品一区二区三区| 一区二区欧美精品| 久99久精品视频免费观看| 成人免费电影视频| 欧美乱熟臀69xxxxxx| 精品国产乱码久久久久久闺蜜| 国产精品另类一区| 亚洲图片欧美一区| 韩国毛片一区二区三区| 91免费在线看| 精品福利av导航| 亚洲精品网站在线观看| 久久精品久久99精品久久| 国产aⅴ精品一区二区三区色成熟| 一本久久综合亚洲鲁鲁五月天 | 91免费观看视频在线| 在线不卡一区二区| 国产精品美女久久福利网站| 亚洲sss视频在线视频| 国产一区日韩二区欧美三区| 在线亚洲免费视频| 久久久精品影视| 视频一区二区不卡| 成人激情动漫在线观看| 欧美一卡二卡在线| 尤物在线观看一区| 国产精品主播直播| 91精品国产综合久久精品性色| 国产精品久久久久三级| 久久99精品久久久久久| 欧美日韩dvd在线观看| 一区二区中文视频| 久久疯狂做爰流白浆xx| 欧美日韩一区国产| 亚洲欧洲一区二区三区| 国产一区二区三区久久久| 欧美美女一区二区| 一区二区在线观看视频| www.亚洲色图.com| 欧美激情综合在线| 韩国v欧美v日本v亚洲v| 欧美精品tushy高清| 亚洲综合成人在线视频| 99精品视频中文字幕| 久久久91精品国产一区二区三区| 美女一区二区三区在线观看| 欧美视频精品在线观看| 亚洲女子a中天字幕| 91在线免费视频观看| 国产精品高潮久久久久无| 成人一区在线观看| 国产原创一区二区| 99综合影院在线| 国产偷国产偷精品高清尤物 | 日本欧美加勒比视频| 欧美怡红院视频| 亚洲精品视频免费观看| 91亚洲精品一区二区乱码| 国产欧美日本一区视频| 国产一区二区三区高清播放| 欧美v国产在线一区二区三区| 日本女优在线视频一区二区| 日韩一级大片在线| 日本免费在线视频不卡一不卡二| 欧美久久久一区| 免费的成人av| 日韩精品影音先锋| 极品少妇一区二区三区精品视频| 精品蜜桃在线看| 国产剧情av麻豆香蕉精品| 国产日韩欧美精品一区| 不卡欧美aaaaa| 日本韩国精品在线| 精品免费视频一区二区| 亚洲黄色录像片| 欧美日韩一区二区三区四区| 亚洲18色成人| 欧美一区二区三区视频免费播放| 蜜臀av亚洲一区中文字幕| 2023国产精品视频| 丁香婷婷综合网| 中文字幕亚洲一区二区va在线| 91视频.com| 丝袜诱惑亚洲看片| 久久久久国产精品麻豆ai换脸| 国产精品99精品久久免费| 亚洲特黄一级片| 欧美精品v日韩精品v韩国精品v| 精品一区二区三区免费| 国产亚洲成年网址在线观看| 91美女在线观看| 秋霞av亚洲一区二区三| 国产欧美日韩久久| 欧美性生交片4| 久久精品99国产精品| 国产精品乱码妇女bbbb| 欧美久久久久免费| 高清国产一区二区| 亚洲小说春色综合另类电影|