CopyDeepMask -- available to basic QuickDraw only in System 7, combines the functionality of both CopyBits and CopyMask
182899
public void copyDeepMask(BufferedImage pSrcBitmap,
                             BufferedImage pMaskBitmap,
                             Rectangle pSrcRect,
                             Rectangle pMaskRect,
                             Rectangle pDstRect,
                             int pSrcCopy,
                             Shape pMaskRgn) {
        throw new UnsupportedOperationException("Method copyDeepMask not implemented"); // TODO: Implement
    }
294364
function createMaskingClip() {
            if (isAnimated) {
                // We use a white rectangle to simulate the line drawing animation
                maskingRectangle = svg.append('rect')
                    .attr('class', 'masking-rectangle')
                    .attr('width', width)
                    .attr('height', height)
                    .attr('x', 0)
                    .attr('y', 0);

                maskingRectangle.transition()
                    .duration(animationDuration)
                    .ease(ease)
                    .attr('x', width)
                    .on('end', () => maskingRectangle.remove());
            }
        }
305558
def rm_job(user,
           path,
           mask,
           cmd):
    '''
    
    '''

    # Scrub the types
    mask = six.text_type(mask).upper()

    # Check for valid mask types
    for item in mask.split(','):
        if item not in _MASK_TYPES:
            return 'Invalid mask type: {0}' . format(item)

    lst = list_tab(user)
    ret = 'absent'
    rm_ = None
    for ind in range(len(lst['crons'])):
        if rm_ is not None:
            break
        if path == lst['crons'][ind]['path']:
            if cmd == lst['crons'][ind]['cmd']:
                if mask == lst['crons'][ind]['mask']:
                    rm_ = ind
    if rm_ is not None:
        lst['crons'].pop(rm_)
        ret = 'removed'
    comdat = _write_incron_lines(user, _render_tab(lst))
    if comdat['retcode']:
        # Failed to commit, return the error
        return comdat['stderr']

    return ret
821488
function shiftL(start, end, c, maskJumps) {
                var buffer = getActiveBuffer();
                if (maskJumps !== false) //jumping over nonmask position
                    while (!isMask(start) && start - 1 >= 0) start--;
                for (var i = start; i < end && i < getMaskLength() ; i++) {
                    if (isMask(i)) {
                        setReTargetPlaceHolder(buffer, i);
                        var j = seekNext(i);
                        var p = getBufferElement(buffer, j);
                        if (p != getPlaceHolder(j)) {
                            if (j < getMaskLength() && isValid(i, p, true) !== false && getActiveTests()[determineTestPosition(i)].def == getActiveTests()[determineTestPosition(j)].def) {
                                setBufferElement(buffer, i, p, true);
                            } else {
                                if (isMask(i))
                                    break;
                            }
                        }
                    } else {
                        setReTargetPlaceHolder(buffer, i);
                    }
                }
                if (c != undefined)
                    setBufferElement(buffer, seekPrevious(end), c);

                if (getActiveMaskSet()["greedy"] == false) {
                    var trbuffer = truncateInput(buffer.join('')).split('');
                    buffer.length = trbuffer.length;
                    for (var i = 0, bl = buffer.length; i < bl; i++) {
                        buffer[i] = trbuffer[i];
                    }
                    if (buffer.length == 0) getActiveMaskSet()["buffer"] = getActiveBufferTemplate().slice();
                }
                return start; //return the used start position
            }
178149
@Override
    protected ImageWritable doTransform(ImageWritable image, Random random) {
        if (image == null) {
            return null;
        }

        //Convert image to gray and blur
        Mat original = converter.convert(image.getFrame());
        Mat grayed = new Mat();
        cvtColor(original, grayed, CV_BGR2GRAY);
        if (blurWidth > 0 && blurHeight > 0)
            blur(grayed, grayed, new Size(blurWidth, blurHeight));

        //Get edges from Canny edge detector
        Mat edgeOut = new Mat();
        if (isCanny)
            Canny(grayed, edgeOut, lowerThresh, upperThresh);
        else
            threshold(grayed, edgeOut, lowerThresh, upperThresh, 0);

        double largestArea = 0;
        Rect boundingRect = new Rect();
        MatVector contours = new MatVector();
        Mat hierarchy = new Mat();

        findContours(edgeOut, contours, hierarchy, this.mode, this.method);

        for (int i = 0; i < contours.size(); i++) {
            //  Find the area of contour
            double area = contourArea(contours.get(i), false);

            if (area > largestArea) {
                // Find the bounding rectangle for biggest contour
                boundingRect = boundingRect(contours.get(i));
            }
        }

        //Apply crop and return result
        x = boundingRect.x();
        y = boundingRect.y();
        Mat result = original.apply(boundingRect);

        return new ImageWritable(converter.convert(result));
    }
391503
def mouseMoveEvent(self, event):
        """"""
        if (event.pos() - self.dragStartPosition).manhattanLength() < 10:
            return
        QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ClosedHandCursor))
        factory = self.factoryclass()

        mimeData = QtCore.QMimeData()
        try:
            mimeData.setData("application/x-protocol", factory.serialize())
        except:
            mimeData.setData("application/x-protocol", cPickle.dumps(factory))

        drag = QtGui.QDrag(self)
        drag.setMimeData(mimeData)

        pixmap = QtGui.QPixmap()
        pixmap = pixmap.grabWidget(self, self.frameRect())

        # below makes the pixmap half transparent
        # painter = QtGui.QPainter(pixmap)
        # painter.setCompositionMode(painter.CompositionMode_DestinationIn)
        # painter.fillRect(pixmap.rect(), QtGui.QColor(0, 0, 0, 127))
        # painter.end()

        drag.setPixmap(pixmap)

        drag.setHotSpot(QtCore.QPoint(pixmap.width()/2, pixmap.height()/2))
        drag.setPixmap(pixmap)

        self.dragActive.emit(True)
        result = drag.exec_(QtCore.Qt.MoveAction)

        QtGui.QApplication.restoreOverrideCursor()
196807
def memcpy_dtoh(self, dest, src):
        
        if isinstance(src, cl.Buffer):
            cl.enqueue_copy(self.queue, dest, src)
409743
@Override
    protected ImageWritable doTransform(ImageWritable image, Random random) {
        if (image == null) {
            return null;
        }

        Mat mat = converter.convert(image.getFrame());
        Mat box = new Mat(height, width, mat.type());
        box.put(borderValue);
        x = (mat.cols() - width) / 2;
        y = (mat.rows() - height) / 2;
        int w = Math.min(mat.cols(), width);
        int h = Math.min(mat.rows(), height);
        Rect matRect = new Rect(x, y, w, h);
        Rect boxRect = new Rect(x, y, w, h);

        if (x <= 0) {
            matRect.x(0);
            boxRect.x(-x);
        } else {
            matRect.x(x);
            boxRect.x(0);
        }

        if (y <= 0) {
            matRect.y(0);
            boxRect.y(-y);
        } else {
            matRect.y(y);
            boxRect.y(0);
        }
        mat.apply(matRect).copyTo(box.apply(boxRect));
        return new ImageWritable(converter.convert(box));
    }
357798
def py2dep(target, **kw):
    "
    log.info("py2dep(%r)", target)
    dummy = DummyModule(target, **kw)

    kw['dummyname'] = dummy.fname
    syspath = sys.path[:]
    syspath.insert(0, target.syspath_dir)

    # remove exclude so we don't pass it twice to modulefinder
    exclude = ['migrations'] + kw.pop('exclude', [])
    log.debug("Exclude: %r", exclude)
    log.debug("KW: %r", kw)
    if 'fname' in kw:
        del kw['fname']

    mf = MyModuleFinder(
        syspath,                # module search path for this module finder
        excludes=exclude,       # folders to exclude
        **kw
    )
    mf.debug = max(mf.debug, kw.get('debug_mf', 0))
    log.debug("CURDIR: %s", os.getcwd())
    log.debug("FNAME: %r, CONTENT:\n%s\n", dummy.fname, dummy.text())
    mf.run_script(dummy.fname)

    log.info("mf._depgraph:\n%s", json.dumps(dict(mf._depgraph), indent=4))
    log.info("mf.badmodules:\n%s", json.dumps(mf.badmodules, indent=4))

    if kw.get('include_missing'):
        for k, vdict in list(mf.badmodules.items()):
            if k not in mf._depgraph:
                mf._depgraph[k] = {}
            for v in vdict:
                if v not in mf._depgraph['__main__']:
                    mf._depgraph['__main__'][v] = None
                if v in mf._depgraph:
                    mf._depgraph[v][k] = None
                else:
                    mf._depgraph[v] = {k:None}

    log.info("mf._depgraph:\n%s", json.dumps(dict(mf._depgraph), indent=4))

    kw['exclude'] = exclude

    if kw.get('pylib'):
        mf_depgraph = mf._depgraph
        for k, v in list(mf._depgraph.items()):
            log.debug('depgraph item: %r %r', k, v)
        # mf_modules = {k: os.syspath.abspath(v.__file__)
        #               for k, v in mf.modules.items()}
    else:
        pylib = pystdlib()
        mf_depgraph = {}
        for k, v in list(mf._depgraph.items()):
            log.debug('depgraph item: %r %r', k, v)
            if k in pylib:
                continue
            vals = {vk: vv for vk, vv in list(v.items()) if vk not in pylib}
            mf_depgraph[k] = vals

        # mf_modules = {k: os.syspath.abspath(v.__file__)
        #               for k, v in mf.modules.items()
        #               if k not in pylib}

    try:
        import yaml
        log.info("mf_depgraph:\n%s",
                 yaml.dump(dict(mf_depgraph), default_flow_style=False))
        # log.error("mf._types:\n%s", yaml.dump(mf._types, default_flow_style=False))
        # log.debug("mf_modules:\n%s", yaml.dump(mf_modules, default_flow_style=False))
    except ImportError:
        log.info("mf_depgraph:\n%s", json.dumps(dict(mf_depgraph), indent=4))

    return depgraph.DepGraph(mf_depgraph, mf._types, **kw)
852058
def _paste_mask(box, mask, shape):
    
    # int() is floor
    # box fpcoor=0.0 -> intcoor=0.0
    x0, y0 = list(map(int, box[:2] + 0.5))
    # box fpcoor=h -> intcoor=h-1, inclusive
    x1, y1 = list(map(int, box[2:] - 0.5))    # inclusive
    x1 = max(x0, x1)    # require at least 1x1
    y1 = max(y0, y1)

    w = x1 + 1 - x0
    h = y1 + 1 - y0

    # rounding errors could happen here, because masks were not originally computed for this shape.
    # but it's hard to do better, because the network does not know the "original" scale
    mask = (cv2.resize(mask, (w, h)) > 0.5).astype('uint8')
    ret = np.zeros(shape, dtype='uint8')
    ret[y0:y1 + 1, x0:x1 + 1] = mask
    return ret
569288
function copyToOut(src, out, multiFileMode) {
    try {
        fs.copySync(src, out);
        fs.statSync(out)
        return out;
    } catch (err) {
    }
}
1041744
def _startDPDrag(self):
        """"""
        dp = self._dp_menu_on
        if dp and dp.archived:
            drag = QDrag(self)
            mimedata = QMimeData()
            mimedata.setUrls([QUrl.fromLocalFile(dp.fullpath)])
            drag.setMimeData(mimedata)
            drag.exec_(Qt.CopyAction | Qt.LinkAction)
501634
def _onShortcutDuplicateLine(self):
        
        cursor = self.textCursor()
        if cursor.hasSelection():  # duplicate selection
            text = cursor.selectedText()
            selectionStart, selectionEnd = cursor.selectionStart(), cursor.selectionEnd()
            cursor.setPosition(selectionEnd)
            cursor.insertText(text)
            # restore selection
            cursor.setPosition(selectionStart)
            cursor.setPosition(selectionEnd, QTextCursor.KeepAnchor)
            self.setTextCursor(cursor)
        else:
            line = cursor.blockNumber()
            self.lines.insert(line + 1, self.lines[line])
            self.ensureCursorVisible()

        self._updateExtraSelections()
679001
static HeapUpdateDoublesSketch copyToHeap(final DoublesSketch sketch) {
    final HeapUpdateDoublesSketch qsCopy;
    qsCopy = HeapUpdateDoublesSketch.newInstance(sketch.getK());
    qsCopy.putN(sketch.getN());
    qsCopy.putMinValue(sketch.getMinValue());
    qsCopy.putMaxValue(sketch.getMaxValue());
    qsCopy.putBaseBufferCount(sketch.getBaseBufferCount());
    qsCopy.putBitPattern(sketch.getBitPattern());

    if (sketch.isCompact()) {
      final int combBufItems = Util.computeCombinedBufferItemCapacity(sketch.getK(), sketch.getN());
      final double[] combBuf = new double[combBufItems];
      qsCopy.putCombinedBuffer(combBuf);
      final DoublesSketchAccessor sketchAccessor = DoublesSketchAccessor.wrap(sketch);
      final DoublesSketchAccessor copyAccessor = DoublesSketchAccessor.wrap(qsCopy);
      // start with BB
      copyAccessor.putArray(sketchAccessor.getArray(0, sketchAccessor.numItems()),
              0, 0, sketchAccessor.numItems());

      long bitPattern = sketch.getBitPattern();
      for (int lvl = 0; bitPattern != 0L; ++lvl, bitPattern >>>= 1) {
        if ((bitPattern & 1L) > 0L) {
          sketchAccessor.setLevel(lvl);
          copyAccessor.setLevel(lvl);
          copyAccessor.putArray(sketchAccessor.getArray(0, sketchAccessor.numItems()),
                  0, 0, sketchAccessor.numItems());
        }
      }
    } else {
      final double[] combBuf = sketch.getCombinedBuffer();
      qsCopy.putCombinedBuffer(Arrays.copyOf(combBuf, combBuf.length));
    }
    return qsCopy;
  }
1195640
function registerDraggingEventsOnCanvas(canvas) {
				
				//Mouse Drag Events for Desktop Version
				if (!isMobile()) {
					canvas.on('mousedown', function(event) {
						var x = event.pageX - $(this).offset().left;
						var y = event.pageY - $(this).offset().top;
						processTimeSelection(x, y);
						isDragging = true;
					});
					canvas.on('mouseup', function(event) {
						isDragging = false;
						var x = event.pageX - $(this).offset().left;
						var y = event.pageY - $(this).offset().top;
						var selectorLength = Math.sqrt(Math.pow(Math.abs(x - clockCenterX), 2) + Math.pow(Math.abs(y - clockCenterY), 2));
						if (settings.duration && settings.durationNegative && selectorLength <= 20) {
							var oldVal = inputElement.val();
							if (oldVal.match(/^-/)) {
								newVal = oldVal.substring(1);
							} else {
								newVal = '-' + oldVal.replace(/^(-|\+)/, '');
							}
							if (settings.minimum && !isTimeSmallerOrEquals(settings.minimum, newVal)) newVal = formatTime(settings.minimum);
							if (settings.maximum && !isTimeSmallerOrEquals(newVal, settings.maximum)) newVal = formatTime(settings.maximum);
							inputElement.val(formatTime(newVal));
							repaintClock();
							settings.onAdjust.call(element.get(0), newVal.replace(/^\+/, ''), oldVal.replace(/^\+/, ''));
							if (selectionMode == 'HOUR') selectHourOnInputElement();
							else selectMinuteOnInputElement();
							return;
						}
						if (!processTimeSelection(x, y, true)) {
							if (settings.precision == 60) {
								hideTimePicker();
							} else if (selectionMode == 'HOUR') {
								switchToMinuteMode();
								selectMinuteOnInputElement();
							} else {
								hideTimePicker();
							}
							return false;
						}
						if (selectionMode == 'MINUTE' || settings.precision == 60) {
							hideTimePicker();
						}
						else {
							switchToMinuteMode();
							selectMinuteOnInputElement();
						}
					});
					canvas.on('mousemove', function(event) {
						var x = event.pageX - $(this).offset().left;
						var y = event.pageY - $(this).offset().top;
						processTimeSelection(x, y);
					});
					canvas.on('mouseleave', function(event) {
						if (selectionMode == 'HOUR') repaintClockHourCanvas();
						else repaintClockMinuteCanvas();
					});
					
					canvas.on('mousewheel', function(event) {
						processMouseWheelEvent(event);
					});
				}
				
				//Touch Events for Mobile Version
				else {
					canvas.on('touchstart', function(event) {
						event.preventDefault();
						var x = event.originalEvent.touches[0].pageX - $(this).offset().left;
						var y = event.originalEvent.touches[0].pageY - $(this).offset().top;
						var selectorLength = Math.sqrt(Math.pow(Math.abs(x - clockCenterX), 2) + Math.pow(Math.abs(y - clockCenterY), 2));
						if (settings.duration && settings.durationNegative && selectorLength <= 20) {
							touchSignButton = true;
							var oldVal = inputElement.val();
							if (oldVal.match(/^-/)) {
								newVal = oldVal.substring(1);
							} else {
								newVal = '-' + oldVal.replace(/^(-|\+)/, '');
							}
							if (settings.minimum && !isTimeSmallerOrEquals(settings.minimum, newVal)) newVal = formatTime(settings.minimum);
							if (settings.maximum && !isTimeSmallerOrEquals(newVal, settings.maximum)) newVal = formatTime(settings.maximum);
							inputElement.val(formatTime(newVal));
							repaintClock();
							settings.onAdjust.call(element.get(0), newVal.replace(/^\+/, ''), oldVal.replace(/^\+/, ''));
							if (selectionMode == 'HOUR') selectHourOnInputElement();
							else selectMinuteOnInputElement();
							return;
						}
						processTimeSelection(x, y);
						isDragging = true;
					});
					canvas.on('touchend', function(event) {
						event.preventDefault();
						isDragging = false;
						if (!touchSignButton && settings.precision != 60) {
							switchToMinuteMode();
							selectMinuteOnInputElement();
						}
						touchSignButton = false;
					});
					canvas.on('touchmove', function(event) {
						event.preventDefault();
						if (isDragging) {
							var x = event.originalEvent.touches[0].pageX - $(this).offset().left;
							var y = event.originalEvent.touches[0].pageY - $(this).offset().top;
							processTimeSelection(x, y);
						}
					});
				}
				
				canvas.on('keydown', function(event) {
					event.preventDefault();
					processTimeSelection();
					switchToHourMode();
					selectHourOnInputElement();
					oldValue = inputElement.val();
				});
			}
588732
def copy(self):
        """"""
        data = QMimeData()
        text = '\n'.join([cursor.selectedText() \
                            for cursor in self.cursors()])
        data.setText(text)
        data.setData(self.MIME_TYPE, text.encode('utf8'))
        QApplication.clipboard().setMimeData(data)
866958
def _copytoscratch(self, maps):
        
        try:
            for p in self.inputs:
                self._scratch[p][:] = maps[p]
        except ValueError:
            # we'll get a ValueError if the scratch space isn't the same size
            # as the maps; in that case, re-create the scratch space with the
            # appropriate size and try again
            invals = maps[list(self.inputs)[0]]
            if isinstance(invals, numpy.ndarray):
                shape = invals.shape
            else:
                shape = len(invals)
            self._createscratch(shape)
            for p in self.inputs:
                self._scratch[p][:] = maps[p]