本文整理汇总了C++中copyImage函数的典型用法代码示例。如果您正苦于以下问题:C++ copyImage函数的具体用法?C++ copyImage怎么用?C++ copyImage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了copyImage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setPixmap
void SystemTray::updateToolTip()
{
// return; /////////////////////////////////////////////////////
Basket *basket = Global::bnpView->currentBasket();
if (!basket)
return;
if (basket->icon().isEmpty() || basket->icon() == "basket" || ! Settings::showIconInSystray())
setPixmap(basket->isLocked() ? m_lockedIconPixmap : m_iconPixmap);
else {
// Code that comes from JuK:
QPixmap bgPix = loadIcon("basket");
QPixmap fgPix = SmallIcon(basket->icon());
QImage bgImage = bgPix.convertToImage(); // Probably 22x22
QImage fgImage = fgPix.convertToImage(); // Should be 16x16
QImage lockOverlayImage = loadIcon("lockoverlay").convertToImage();
KIconEffect::semiTransparent(bgImage);
copyImage(bgImage, fgImage, (bgImage.width() - fgImage.width()) / 2,
(bgImage.height() - fgImage.height()) / 2);
if (basket->isLocked())
KIconEffect::overlay(bgImage, lockOverlayImage);
bgPix.convertFromImage(bgImage);
setPixmap(bgPix);
}
//QTimer::singleShot( Container::c_delayTooltipTime, this, SLOT(updateToolTipDelayed()) );
// No need to delay: it's be called when notes are changed:
updateToolTipDelayed();
}
示例2: dequeue
PROC *kfork(char *filename)
{
int j, segment;
PROC *p = dequeue(&freeList);
if (p == 0) {
printf("Failed to kfork()\n");
getc();
return(0);
}
p->status = READY;
p->priority = 1;
p->ppid = running->pid;
p->parent = running;
p->uss = segment = (p->pid + 1) * 0x1000;
/*
* INITIALIZE p's kstack to make it start from body() when it runs.
* To do this, PRETNED that the process called tswitch() from the
* the entry address of body() and executed the SAVE part of tswitch()
* to give up CPU before.
* Initialize its kstack[ ] and ksp to comform to these.
*/
for (j=1; j<10; j++) {
p->kstack[SSIZE - j] = 0; // all saved registers = 0
}
p->kstack[SSIZE-1]=(int)goUmode; // called tswitch() from body
p->ksp = &(p->kstack[SSIZE-9]); // ksp -> kstack top
//printf("Loading executable\n"); //FOR TESTING
if(filename)
{
load(filename, segment); // Load executable
//printf("Executable loaded\n"); //FOR TESTING
for (j=1; j<13; j++) {
put_word(0, segment, -j*2); // Set all registers to 0
}
put_word(0x0200, segment, -2); // Flag
p->usp = -24;
}
else
{
copyImage(segment);
p->usp = running->usp;
put_word(0, segment, p->usp+16);
}
put_word(segment, segment, p->usp+20); // CS
put_word(segment, segment, p->usp+2); // ES
put_word(segment, segment, p->usp); // DS
//printProc(p);
enqueue(&readyQueue, p);
printQueue(readyQueue, freeList, sleepList);
/*printf("Ready queue:\n");
print_queue(readyList);*/
return(p->pid);
}
示例3: copyImage
void MainWidget::updateScreenshotLabel()
{
ui->imageLabel->setPixmap(originalPixmap.scaled(ui->imageLabel->size(),
Qt::KeepAspectRatio,
Qt::SmoothTransformation));
copyImage();
}
示例4: setContextMenuPolicy
void MathDisplay::buildActions()
{
setContextMenuPolicy(Qt::ActionsContextMenu);
act_copyText = new QAction(tr("Copy text"), this);
connect(act_copyText, SIGNAL(triggered()), this, SLOT(copyText()));
this->addAction(act_copyText);
act_copyLatex = new QAction(tr("Copy LaTeX code"), this);
connect(act_copyLatex, SIGNAL(triggered()), this, SLOT(copyLatex()));
this->addAction(act_copyLatex);
act_copyMml = new QAction(tr("Copy MathML code"), this);
connect(act_copyMml, SIGNAL(triggered()), this, SLOT(copyMml()));
this->addAction(act_copyMml);
act_copyImage = new QAction(tr("Copy image"), this);
connect(act_copyImage, SIGNAL(triggered()), this, SLOT(copyImage()));
act_copyImage->setEnabled(false);
this->addAction(act_copyImage);
act_saveImage = new QAction(tr("Save image"), this);
connect(act_saveImage, SIGNAL(triggered()), this, SLOT(saveImage()));
act_saveImage->setEnabled(false);
this->addAction(act_saveImage);
}
示例5: ASSERT
void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform,
const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect)
{
ASSERT(context);
RefPtr<Image> imageCopy = copyImage(CopyBackingStore);
imageCopy->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
}
示例6: imageObserver
void BitmapImage::drawPattern(GraphicsContext& ctxt, const FloatRect& tileRect, const AffineTransform& transform,
const FloatPoint& phase, const FloatSize& spacing, CompositeOperator op, const FloatRect& destRect, BlendMode blendMode)
{
if (tileRect.isEmpty())
return;
if (!ctxt.drawLuminanceMask()) {
Image::drawPattern(ctxt, tileRect, transform, phase, spacing, op, destRect, blendMode);
return;
}
if (!m_cachedImage) {
auto buffer = ImageBuffer::createCompatibleBuffer(expandedIntSize(tileRect.size()), ctxt);
if (!buffer)
return;
ImageObserver* observer = imageObserver();
ASSERT(observer);
// Temporarily reset image observer, we don't want to receive any changeInRect() calls due to this relayout.
setImageObserver(nullptr);
draw(buffer->context(), tileRect, tileRect, op, blendMode, ImageOrientationDescription());
setImageObserver(observer);
buffer->convertToLuminanceMask();
m_cachedImage = buffer->copyImage(DontCopyBackingStore, Unscaled);
if (!m_cachedImage)
return;
}
ctxt.setDrawLuminanceMask(false);
m_cachedImage->drawPattern(ctxt, tileRect, transform, phase, spacing, op, destRect, blendMode);
}
示例7: mTextureType
//.........这里部分代码省略.........
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
****************************************************************************/
// Include
#include <float.h>
#include <QMessageBox>
#include <QSettings>
#include "constants.h"
#include "hlms_node_samplerblock.h"
#include "hlms_node_porttypes.h"
//****************************************************************************/
HlmsNodeSamplerblock::HlmsNodeSamplerblock(QString title, QGraphicsItem* parent) :
Magus::QtNode(title, parent),
mTextureType(0),
mTextureIndex(0),
mSamplerblockEnabled(true),
mTextureAddressingModeU(0),
mTextureAddressingModeV(0),
mTextureAddressingModeW(0),
mMipLodBias(0.0f),
mMaxAnisotropy(1.0f),
mCompareFunction(8),
mMinLod(-FLT_MAX),
mMaxLod(FLT_MAX),
mBorderColourRed(255.0f),
mBorderColourGreen(255.0f),
mBorderColourBlue(255.0f),
mUvSet(0),
mBlendMode(0),
mMapWeight(1.0f),
mEmissiveColourRed(0.0f),
mEmissiveColourGreen(0.0f),
mEmissiveColourBlue(0.0f),
mAnimationEnabled(false),
mSequenceNumber(-1)
{
mFileNameTexture = QString("");
mBaseNameTexture = QString("");
mPathTexture = QString("");
mOffset = QVector2D(0.0f, 0.0f);
mScale = QVector2D(1.0f, 1.0f);
mAnimationScale = QVector2D(1.0f, 1.0f);
mAnimationTranslate = QVector2D(0.0f, 0.0f);
// Define the connection policy
HlmsPbsDatablockSamplerblockPortType hlmsPbsDatablockSamplerblockPortType;
HlmsSamplerblockDatablockPortType hlmsSamplerblockDatablockPortType;
hlmsPbsDatablockSamplerblockPortType.addPortTypeToConnectionPolicy(hlmsSamplerblockDatablockPortType);
// Apply values from settings.cfg
QSettings settings(FILE_SETTINGS, QSettings::IniFormat);
mTextureMinFilter = settings.value(SETTINGS_SAMPLERBLOCK_FILTER_INDEX).toInt();
mTextureMagFilter = settings.value(SETTINGS_SAMPLERBLOCK_FILTER_INDEX).toInt();
mTextureMipFilter = settings.value(SETTINGS_SAMPLERBLOCK_FILTER_INDEX).toInt();
// Custome node settings
setTitleColor(Qt::white);
setHeaderTitleIcon(ICON_SAMPLERBLOCK);
setAction1Icon(ICON_MINMAX);
setAction2Icon(ICON_CLOSE);
alignTitle(Magus::ALIGNED_LEFT);
setHeaderColor(QColor("#874E96"));
mPort = createPort(PORT_ID_SAMPLERBLOCK,
PORT_DATABLOCK,
hlmsPbsDatablockSamplerblockPortType,
QColor("#874E96"),
Magus::PORT_SHAPE_CIRCLE,
Magus::ALIGNED_LEFT,
QColor("#874E96"));
setPortNameColor(Qt::white);
setZoom(0.9);
}
//****************************************************************************/
HlmsNodeSamplerblock::~HlmsNodeSamplerblock(void)
{
}
//****************************************************************************/
void HlmsNodeSamplerblock::setFileNameTexture(const QString fileNameTexture, const QPixmap* pixmap)
{
mFileNameTexture = fileNameTexture;
if (pixmap)
copyImage(pixmap);
else
setImage(fileNameTexture);
}
示例8: drawPattern
void ImageBuffer::drawPattern(GraphicsContext& destContext, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect, BlendMode blendMode)
{
FloatRect adjustedSrcRect = srcRect;
adjustedSrcRect.scale(m_resolutionScale, m_resolutionScale);
if (!context().isAcceleratedContext()) {
if (&destContext == &context() || destContext.isAcceleratedContext()) {
if (RefPtr<Image> copy = copyImage(CopyBackingStore)) // Drawing into our own buffer, need to deep copy.
copy->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, spacing, styleColorSpace, op, destRect, blendMode);
} else {
if (RefPtr<Image> imageForRendering = copyImage(DontCopyBackingStore))
imageForRendering->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, spacing, styleColorSpace, op, destRect, blendMode);
}
} else {
if (RefPtr<Image> copy = copyImage(CopyBackingStore))
copy->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, spacing, styleColorSpace, op, destRect, blendMode);
}
}
示例9: unPremultiplyImage
LayerGraphics::~LayerGraphics ()
{
// Convert from premultiplied to normal.
//
unPremultiplyImage (m_fill);
// Extract the layer's RGB components as Image::RGB
//
Image fillImage (ChannelImageType::fromImage (m_fill, -1));
// Extract the layer's alpha mask as a single channel image.
//
Image maskImage (ChannelImageType::fromImage (m_fill, PixelARGB::indexA));
// Obtain bitmap data for mask and fill.
//
Pixels fillPixels (fillImage);
Pixels maskPixels (maskImage);
Pixels workPixels (m_work);
m_options.innerShadow (fillPixels, maskPixels);
m_options.dropShadow (m_work, maskImage);
if (m_options.general.groupInteriorEffects)
{
// satin
m_options.colourOverlay (fillPixels);
m_options.gradientOverlay (fillPixels);
m_options.patternOverlay (fillPixels);
m_options.innerGlow (fillPixels, maskPixels);
m_options.fill (m_work, m_fill);
}
else
{
m_options.fill (m_work, m_fill);
m_options.colourOverlay (workPixels);
m_options.gradientOverlay (workPixels);
m_options.patternOverlay (workPixels);
m_options.innerGlow (workPixels, maskPixels);
}
m_options.outerGlow (workPixels, maskPixels);
m_options.bevelEmboss (workPixels, maskPixels);
m_options.stroke (workPixels, maskPixels);
// Copy the work image onto the background layer
// using normal mode and the general opacity.
copyImage (
m_base,
m_workOrigin,
m_work,
m_work.getBounds (),
BlendMode::modeNormal,
m_options.general.opacity);
}
示例10: copyImage
void ImageBuffer::drawPattern(GraphicsContext* destContext, const FloatRect& srcRect, const AffineTransform& patternTransform,
const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect)
{
if (destContext == context()) {
// We're drawing into our own buffer. In order for this to work, we need to copy the source buffer first.
RefPtr<Image> copy = copyImage(CopyBackingStore);
copy->drawPattern(destContext, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
} else
m_data.m_image->drawPattern(destContext, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
}
示例11: copyImage
void FillStyle::operator() (Image destImage, Image fillImage)
{
copyImage (
destImage,
Point <int> (0, 0),
fillImage,
fillImage.getBounds (),
mode,
opacity);
}
示例12: fork
int fork()
{
PROC *p; int i, child, pid; u16 segment;
pid = kfork(0); // kfork() but do NOT load any Umode image for child
if (pid < 0){ // kfork failed
return -1;
}
p = &proc[pid]; // we can do this because of static pid
for (i=0; i<NFD; i++){
p->fd[i] = running->fd[i];
if (p->fd[i] != 0){
p->fd[i]->refCount++;
if (p->fd[i]->mode == READ_PIPE)
p->fd[i]->pipe_ptr->nreader++;
if (p->fd[i]->mode == WRITE_PIPE){
p->fd[i]->pipe_ptr->nwriter++;
}
}
}
segment = (pid+1)*0x2000;
copyImage(running->uss, segment, 32*1024);
p->uss = segment;
p->usp = 0x2000 - 24;
// YOUR CODE to make the child runnable in User mode
p->kstack[SSIZE -1] =(int)goUmode;
/**** ADD these : copy file descriptors ****/
// clean the registers and set flag and uCs and uDs to runnings values
for (i = 1; i < 13; i++) {
child = 0x2000 - i*2;
switch(i){
case 1: put_word(segment, segment, child); break;
case 2: put_word(segment, segment, child); break;
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10: put_word(0,segment, child); break;
case 11:
case 12: put_word(segment, segment, child); break;
}
}
return(p->pid);
}
示例13: QLabel
QRImageWidget::QRImageWidget(QWidget *parent):
QLabel(parent), contextMenu(0)
{
contextMenu = new QMenu();
QAction *saveImageAction = new QAction(tr("&Save Image..."), this);
connect(saveImageAction, SIGNAL(triggered()), this, SLOT(saveImage()));
contextMenu->addAction(saveImageAction);
QAction *copyImageAction = new QAction(tr("&Copy Image"), this);
connect(copyImageAction, SIGNAL(triggered()), this, SLOT(copyImage()));
contextMenu->addAction(copyImageAction);
}
示例14: main
int main(int argc,char** argv)
{
AnalyzeImage imgin,imgout;
int x,y,z,labelsToChange,i;
int intstatus;
int inlabel,outlabel;
bool clobber = true;
bool status;
div_t divtmp;
if(argc < 5) {
cout << "Usage: relabel_analyze inputfile outputfile inlabel1 outlabel1" << endl;
return(1);
}
intstatus = readImage(argv[1],&imgin);
if(intstatus != 0) {
cout << "Could not read the file" << argv[1] << endl;
return(2);
}
status = copyImage(&imgin,&imgout);
divtmp = div(argc - 3,2);
if(divtmp.rem == 0) {
labelsToChange = divtmp.quot;
}
else {
cout << " wrong number of inputs" << endl;
return(3);
}
for(i = 0;i < labelsToChange;i++) {
inlabel = atoi(argv[2*i + 3]);
outlabel = atoi(argv[2*i + 4]);
cout << "Changing" << inlabel << "->" << outlabel << endl;
for(x = 0;x < imgin.header.x_dim;x++) {
for(y = 0;y < imgin.header.y_dim;y++) {
for(z = 0;z < imgin.header.z_dim;z++) {
if(fabs(getVoxelValue(&imgin,x,y,z) - inlabel) < 0.0001)
putVoxelValue(&imgout,x,y,z,outlabel);
}
}
}
}
intstatus = writeImage(argv[2],&imgout,clobber);
if(intstatus != 0) {
cout << "Could not write the file" << argv[2] << endl;
return(3);
}
return(0);
}
示例15: VEC_XSIZE
// Compute fitness =========================================================
double ObjFunc_nma_alignment::eval(Vector X, int *nerror) {
int dim = global_nma_prog->numberOfModes;
for (int i = 0; i < dim; i++) {
global_nma_prog->trial(i) = X[i];
}
int pyramidLevelDisc = 1;
int pyramidLevelCont = (global_nma_prog->currentStage == 1) ? 1 : 0;
FileName fnRandom = global_nma_prog->createDeformedPDB(pyramidLevelCont);
const char * randStr = fnRandom.c_str();
if (global_nma_prog->currentStage == 1) {
global_nma_prog->performCompleteSearch(fnRandom, pyramidLevelDisc);
} else {
double rot, tilt, psi, xshift, yshift;
MetaData DF;
rot = global_nma_prog->bestStage1(
VEC_XSIZE(global_nma_prog->bestStage1) - 5);
tilt = global_nma_prog->bestStage1(
VEC_XSIZE(global_nma_prog->bestStage1) - 4);
psi = global_nma_prog->bestStage1(
VEC_XSIZE(global_nma_prog->bestStage1) - 3);
xshift = global_nma_prog->bestStage1(
VEC_XSIZE(global_nma_prog->bestStage1) - 2);
yshift = global_nma_prog->bestStage1(
VEC_XSIZE(global_nma_prog->bestStage1) - 1);
size_t objId = DF.addObject();
FileName fnDown = formatString("%s_downimg.xmp", randStr);
DF.setValue(MDL_IMAGE, fnDown, objId);
DF.setValue(MDL_ENABLED, 1, objId);
DF.setValue(MDL_ANGLE_ROT, rot, objId);
DF.setValue(MDL_ANGLE_TILT, tilt, objId);
DF.setValue(MDL_ANGLE_PSI, psi, objId);
DF.setValue(MDL_SHIFT_X, xshift, objId);
DF.setValue(MDL_SHIFT_Y, yshift, objId);
DF.write(formatString("%s_angledisc.xmd", randStr));
copyImage(global_nma_prog->currentImgName.c_str(), fnDown.c_str());
}
double fitness = global_nma_prog->performContinuousAssignment(fnRandom,
pyramidLevelCont);
runSystem("rm", formatString("-rf %s* &", randStr));
global_nma_prog->updateBestFit(fitness, dim);
return fitness;
}