////////////////////////////////////////////////////////////////////////// // open scribble data file void CScribbleMgr::open(const char *dirName) { close(); // construct scribble file name if (NULL == dirName) return; strncpy(path.scbname, dirName, SCB_MAX_PATH); char *pos = strrchr(path.scbname, '/'); strcpy(++pos, "scribble.irx"); pos += strlen("scribble.irx"); *pos = 0; // open file doc = scb_doc_make_sure_exist(&path); }
void testFastDraw() { ScbPath path; strncpy(path.scbname, "/temp.irx", MAX_PATH); ScbDocPtr doc = scb_doc_make_sure_exist(&path); ScbPageId id; scb_page_id_from_str(&id, "abcdef"); ScbPagePtr page = scb_doc_get_page(doc, &id); if (NULL == page) { page = scb_page_new(); scb_page_set_id(page, &id); scb_doc_add_page(doc, page); } ScbStrokePtr stroke = scb_stroke_new(); stroke->style.color.pixel = 3; stroke->style.penSize = 3; static const int POINTS = 1000; int i; ScbPoint point; for(i = 0; i < POINTS - 1; ++i) { point.x = i; point.y = i; point.pressure = i * i; scb_stroke_add_point(stroke, &point); scb_stroke_fast_draw_point(stroke, &point); } point.x = i; point.y = i; point.pressure = i * i; scb_stroke_add_point(stroke, &point); scb_stroke_fast_draw_point_done(stroke, &point); scb_page_add_stroke(page, stroke); scb_doc_save(doc); scb_doc_free(doc); }