void setup() { size(700, 500); colorMode(COLOR_MODE_HSB, width, 100, 100, 100); strokeWeight(0.2); noFill(); //smooth(); background(width); //frameRate(100); radius = 10; thickness = 0.5; x = 2; y = height / 2; z = height / 2; t = height / 2; amp = 5; angle = 0; i = 0; }
void setup() { size(640, 360); colorMode(COLOR_MODE_HSB, height, height, height); noStroke(); background(height); }
void QPrinter::setPageSize( PageSize newPageSize ) { if ( newPageSize > NPageSize ) { #if defined(CHECK_STATE) qWarning("QPrinter::SetPageSize: illegal page size %d", newPageSize ); #endif return; } page_size = makepagesize( newPageSize, pageOrder(), colorMode() ); }
void setup() { size(640, 360); noStroke(); colorMode(COLOR_MODE_HSB, numChars); background(numChars / 2); // Set a gray value for each key for (int i = 0; i < numChars; i++) { colors[i] = COLOR(i, numChars, numChars, 255); } }
void drawer_paintImage2(int left, int bottom, int right, int top, int height,double complex *phis,double complex *phis2) { colorf c; double phi; for(int x=left, i=0; x<right; x++, i++){ for(int y=bottom, j=0; y<top ; y++, j++){ phi = colorMode(phis[x*height+y] + phis2[x*height+y]); //colorMode : creal() or cabs() colorTransform( phi, &c ); texColor[i][j] = c; } } }
//todo 可変長引数を利用して, 複数のデータの平均で色を出すようにするべき? void drawer_paintImage(int left, int bottom, int right, int top, int height, double complex *phis, ...) { // const int num = sizeof(phis) / sizeof(double complex*); //printf("size = %d",num); colorf c; double phi; for(int x=left, i=0; x<right; x++, i++){ for(int y=bottom, j=0; y<top ; y++, j++){ phi = colorMode(phis[x*height+y]); //colorMode : creal() or cabs() colorTransform( phi, &c ); texColor[i][j] = c; } } }
//todo 可変長引数を利用して, 複数のデータの平均で色を出すようにするべき? void drawer_paintImage(int left, int bottom, int right, int top, int width, int height, double complex *phis, ...) { colorf c; double complex cphi; double ux = 1.0*(right-left)/TEX_NX; double uy = 1.0*(top-bottom)/TEX_NY; double u = max(ux,uy); int i,j; double x,y; for(i=0,x=left; i<TEX_NX && x<right; i++, x+=u) { for(j=0,y=bottom; j<TEX_NY && y<top; j++, y+=u) { cphi = cbilinear(phis,x,y,width,height); colorTransform(colorMode(cphi), &c); texColor[i][j] = c; } } }
void Drawing::render(DrawingContext &ct, Geom::IntRect const &area, unsigned flags) { if (_root) { _root->render(ct, area, flags); } if (colorMode() == COLORMODE_GRAYSCALE) { // apply grayscale filter on top of everything cairo_surface_t *input = ct.rawTarget(); cairo_surface_t *out = ink_cairo_surface_create_identical(input); ink_cairo_surface_filter(input, out, _grayscale_colormatrix); Geom::Point origin = ct.targetLogicalBounds().min(); ct.setSource(out, origin[Geom::X], origin[Geom::Y]); ct.setOperator(CAIRO_OPERATOR_SOURCE); ct.paint(); ct.setOperator(CAIRO_OPERATOR_OVER); cairo_surface_destroy(out); } }
bool QPrinter::prepare(PMPrintSettings *s) { if (!psession && PMCreateSession(&psession) != noErr) return FALSE; if (*s == kPMNoPrintSettings) { if (PMCreatePrintSettings(s) != noErr) return FALSE; if (PMSessionDefaultPrintSettings(psession, *s) != noErr) return FALSE; } else { if (PMSessionValidatePrintSettings(psession, *s, kPMDontWantBoolean) != noErr) return FALSE; } if (minPage() != 0 || maxPage() != 0) PMSetPageRange(*s, minPage(), maxPage()); if (d->printRange != AllPages) { PMSetFirstPage(*s, fromPage(), TRUE); PMSetLastPage(*s, toPage(), TRUE); } PMSetColorMode(*s, colorMode() == GrayScale ? kPMGray : kPMColor); PMSetCopies(*s, numCopies(), TRUE); if (outputToFile()) { CFStringRef cfstring = qstring2cfstring(outputFileName()); CFURLRef outFile = CFURLCreateWithFileSystemPath(kCFAllocatorSystemDefault, cfstring, kCFURLPOSIXPathStyle, false); PMSessionSetDestination(psession, *s, kPMDestinationFile, kPMDocumentFormatPDF, outFile); CFRelease(outFile); CFRelease(cfstring); } QString printName = printerName(); if (!printName.isEmpty()) { CFStringRef pname = qstring2cfstring(printName); PMSessionSetCurrentPrinter(psession, pname); CFRelease(pname); } return TRUE; }
void QPrinter::setPageOrder( PageOrder newPageOrder ) { page_size = makepagesize( pageSize(), newPageOrder, colorMode() ); }
void KPrinter::translateQtOptions() { d->m_wrapper->setCreator(creator()); d->m_wrapper->setDocName(docName()); d->m_wrapper->setFullPage(fullPage()); d->m_wrapper->setColorMode((QPrinter::ColorMode)colorMode()); d->m_wrapper->setOrientation((QPrinter::Orientation)orientation()); if ( !option( "kde-printsize" ).isEmpty() ) d->m_wrapper->setPageSize( ( QPrinter::PageSize )option( "kde-printsize" ).toInt() ); else d->m_wrapper->setPageSize((QPrinter::PageSize)pageSize()); d->m_wrapper->setOutputToFile(true); d->m_wrapper->setOutputFileName(d->m_tmpbuffer); d->m_wrapper->setNumCopies(option("kde-qtcopies").isEmpty() ? 1 : option("kde-qtcopies").toInt()); if (!option("kde-margin-top").isEmpty()) { /** * Scale margings as the margin widget always stores values * in dot units ( 1/72th in ), to be resolution independent * when specified by the user ( who usually specifies margins * in metric units ). */ int res = resolution(); d->m_wrapper->setMargins( ( int )( ( option("kde-margin-top").toFloat() * res + 71 ) / 72 ), ( int )( ( option("kde-margin-left").toFloat() * res + 71 ) / 72 ), ( int )( ( option("kde-margin-bottom").toFloat() * res + 71 ) / 72 ), ( int )( ( option("kde-margin-right").toFloat() * res + 71 ) / 72 ) ); } else if ( d->m_pagesize != NULL ) { int res = resolution(); DrPageSize *ps = d->m_pagesize; int top = ( int )( ps->topMargin() * res + 71 ) / 72; int left = ( int )( ps->leftMargin() * res + 71 ) / 72; int bottom = ( int )( ps->bottomMargin() * res + 71 ) / 72; int right = ( int )( ps->rightMargin() * res + 71 ) / 72; if ( !fullPage() ) { // Printers can often print very close to the edges (PPD files say ImageArea==PaperDimension). // But that doesn't mean it looks good. Apps which use setFullPage(false) assume that // KPrinter will give them reasonable margins, so let's QMAX with defaults from Qt in that case. // Keep this in sync with KPMarginPage::initPageSize unsigned int it, il, ib, ir; d->m_wrapper->margins( &it, &il, &ib, &ir ); top = QMAX( top, (int)it ); left = QMAX( left, (int)il ); bottom = QMAX( bottom, (int)ib ); right = QMAX( right, (int)ir ); } d->m_wrapper->setMargins( top, left, bottom, right ); } /*else { int res = d->m_wrapper->resolution(); d->m_wrapper->setMargins( res/3, res/2, res/3, res/2 ); }*/ // for special printers, copies are handled by Qt if (option("kde-isspecial") == "1") d->m_wrapper->setNumCopies(numCopies()); }