void draw_numeral( int x, int y, int n, int height, int width) { switch(n) { case 1: draw_one(x, y, height, width) ; break ; case 2: draw_two(x, y, height, width) ; break ; case 3: draw_three(x, y, height, width) ; break ; case 4: draw_four(x, y, height, width) ; break ; case 5: draw_five(x, y, height, width) ; break ; case 6: draw_six(x, y, height, width) ; break ; case 7: draw_seven(x, y, height, width) ; break ; case 8: draw_eight(x, y, height, width) ; break ; case 9: draw_nine(x, y, height, width) ; break ; case 0: draw_zero(x, y, height, width) ; break ; } }
int main (void) { int xSize=600, ySize=600, xMouse, yMouse, j; float h=100; char c; gfx_open(xSize, ySize, "Window"); while (1) { c = gfx_wait(); xMouse = gfx_xpos(); yMouse = gfx_ypos(); switch (c) { case '0': draw_zero(xMouse, yMouse, h); break; case '1': draw_one(xMouse, yMouse, h); break; case '2': draw_two(xMouse, yMouse, h); break; case '3': draw_three(xMouse, yMouse, h); break; case '4': draw_four(xMouse, yMouse, h); break; case '5': draw_five(xMouse, yMouse, h); break; case '6': draw_six(xMouse, yMouse, h); break; case '7': draw_seven(xMouse, yMouse, h); break; case '8': draw_eight(xMouse, yMouse, h); break; case '9': draw_nine(xMouse, yMouse, h); break; case '-': h = h/2; break; case '=': h = h*2; break; case 'q': return 0; } } return 0; }
bool SkMaskFilterBase::filterPath(const SkPath& devPath, const SkMatrix& matrix, const SkRasterClip& clip, SkBlitter* blitter, SkStrokeRec::InitStyle style) const { SkRect rects[2]; int rectCount = 0; if (SkStrokeRec::kFill_InitStyle == style) { rectCount = countNestedRects(devPath, rects); } if (rectCount > 0) { NinePatch patch; switch (this->filterRectsToNine(rects, rectCount, matrix, clip.getBounds(), &patch)) { case kFalse_FilterReturn: SkASSERT(nullptr == patch.fMask.fImage); return false; case kTrue_FilterReturn: draw_nine(patch.fMask, patch.fOuterRect, patch.fCenter, 1 == rectCount, clip, blitter); return true; case kUnimplemented_FilterReturn: SkASSERT(nullptr == patch.fMask.fImage); // fall through break; } } SkMask srcM, dstM; if (!SkDraw::DrawToMask(devPath, &clip.getBounds(), this, &matrix, &srcM, SkMask::kComputeBoundsAndRenderImage_CreateMode, style)) { return false; } SkAutoMaskFreeImage autoSrc(srcM.fImage); if (!this->filterMask(&dstM, srcM, matrix, nullptr)) { return false; } SkAutoMaskFreeImage autoDst(dstM.fImage); // if we get here, we need to (possibly) resolve the clip and blitter SkAAClipBlitterWrapper wrapper(clip, blitter); blitter = wrapper.getBlitter(); SkRegion::Cliperator clipper(wrapper.getRgn(), dstM.fBounds); if (!clipper.done()) { const SkIRect& cr = clipper.rect(); do { blitter->blitMask(dstM, cr); clipper.next(); } while (!clipper.done()); } return true; }
/*F****************************************************************** * draw_digit(float x_position, float y_position, unsigned int digit, float size) * * PURPOSE : Draws the specified digit to the specified coordinates * at the specified size * * RETURN : void * * NOTES : *F*/ void draw_digit(float x_position, float y_position, unsigned int digit, float size) { glClearColor(255, 255, 255, 1); glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_LINES); switch(digit) { case 0: draw_zero(x_position, y_position, size); return; case 1: draw_one(x_position, y_position, size); return; case 2: draw_two(x_position, y_position, size); return; case 3: draw_three(x_position, y_position, size); return; case 4: draw_four(x_position, y_position, size); return; case 5: draw_five(x_position, y_position, size); return; case 6: draw_six(x_position, y_position, size); return; case 7: draw_seven(x_position, y_position, size); return; case 8: draw_eight(x_position, y_position, size); return; case 9: draw_nine(x_position, y_position, size); return; default: return; } glEnd(); glutSwapBuffers(); }
bool SkMaskFilterBase::filterRRect(const SkRRect& devRRect, const SkMatrix& matrix, const SkRasterClip& clip, SkBlitter* blitter) const { // Attempt to speed up drawing by creating a nine patch. If a nine patch // cannot be used, return false to allow our caller to recover and perform // the drawing another way. NinePatch patch; patch.fMask.fImage = nullptr; if (kTrue_FilterReturn != this->filterRRectToNine(devRRect, matrix, clip.getBounds(), &patch)) { SkASSERT(nullptr == patch.fMask.fImage); return false; } draw_nine(patch.fMask, patch.fOuterRect, patch.fCenter, true, clip, blitter); return true; }