您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CGContextTranslateCTM函数代码示例

51自学网 2021-06-01 19:59:47
  C++
这篇教程C++ CGContextTranslateCTM函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CGContextTranslateCTM函数的典型用法代码示例。如果您正苦于以下问题:C++ CGContextTranslateCTM函数的具体用法?C++ CGContextTranslateCTM怎么用?C++ CGContextTranslateCTM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CGContextTranslateCTM函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GScreenDC

GPrintDC::GPrintDC(void *Handle, const char *PrintJobName, const char *PrinterName) :	GScreenDC((GPrintDcParams*)Handle){	d = new GPrintDCPrivate;	d->PrintJobName = PrintJobName;	d->PrinterName = PrinterName;		GPrintDcParams *Params = (GPrintDcParams*)Handle;	if (Params)	{		int x = Params->Page.right - Params->Page.left;		int y = Params->Page.bottom - Params->Page.top;				d->Dpi.x = Params->Dpi.hRes;		d->Dpi.y = Params->Dpi.vRes;				#if 0		d->x = x * d->Dpi.x;		d->y = y * d->Dpi.y;		#else		d->x = x;		d->y = y;		#endif		d->Ctx = Params->Ctx;		// Invert the co-ordinate space so 0,0 is the top left corner.		CGContextTranslateCTM(d->Ctx, 0, y);		CGContextScaleCTM(d->Ctx, 1.0, -1.0);	}}
开发者ID:FEI17N,项目名称:Lgi,代码行数:31,


示例2: CGRectMake

wxBitmap wxScreenDCImpl::DoGetAsBitmap(const wxRect *subrect) const{    CGRect srcRect = CGRectMake(0, 0, m_width, m_height);    if (subrect)    {        srcRect.origin.x = subrect->GetX();        srcRect.origin.y = subrect->GetY();        srcRect.size.width = subrect->GetWidth();        srcRect.size.height = subrect->GetHeight();    }    wxBitmap bmp = wxBitmap(srcRect.size.width, srcRect.size.height, 32);#if wxOSX_USE_IPHONE#else    CGContextRef context = (CGContextRef)bmp.GetHBITMAP();        CGContextSaveGState(context);        CGContextTranslateCTM( context, 0,  m_height );    CGContextScaleCTM( context, 1, -1 );        if ( subrect )        srcRect = CGRectOffset( srcRect, -subrect->x, -subrect->y ) ;        CGImageRef image = grabViaOpenGL(kCGNullDirectDisplay, srcRect);        wxASSERT_MSG(image, wxT("wxScreenDC::GetAsBitmap - unable to get screenshot."));        CGContextDrawImage(context, srcRect, image);        CGContextRestoreGState(context);#endif    return bmp;}
开发者ID:jonntd,项目名称:dynamica,代码行数:33,


示例3: CGContextWithHDC

static CGContextRef CGContextWithHDC(HDC hdc, bool hasAlpha){    HBITMAP bitmap = static_cast<HBITMAP>(GetCurrentObject(hdc, OBJ_BITMAP));    DIBPixelData pixelData(bitmap);    // FIXME: We can get here because we asked for a bitmap that is too big    // when we have a tiled layer and we're compositing. In that case     // bmBitsPixel will be 0. This seems to be benign, so for now we will    // exit gracefully and look at it later:    //  https://bugs.webkit.org/show_bug.cgi?id=52041       // ASSERT(bitmapBits.bitsPerPixel() == 32);    if (pixelData.bitsPerPixel() != 32)        return 0;    CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Little | (hasAlpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst);    CGContextRef context = CGBitmapContextCreate(pixelData.buffer(), pixelData.size().width(), pixelData.size().height(), 8,                                                 pixelData.bytesPerRow(), deviceRGBColorSpaceRef(), bitmapInfo);    // Flip coords    CGContextTranslateCTM(context, 0, pixelData.size().height());    CGContextScaleCTM(context, 1, -1);        // Put the HDC In advanced mode so it will honor affine transforms.    SetGraphicsMode(hdc, GM_ADVANCED);        return context;}
开发者ID:3163504123,项目名称:phantomjs,代码行数:28,


示例4: paintRepaintRectOverlay

static void paintRepaintRectOverlay(CGContextRef context, WKImageRef image, WKArrayRef repaintRects){    WKSize imageSize = WKImageGetSize(image);    CGContextSaveGState(context);    // Using a transparency layer is easier than futzing with clipping.    CGContextBeginTransparencyLayer(context, 0);        // Flip the context.    CGContextScaleCTM(context, 1, -1);    CGContextTranslateCTM(context, 0, -imageSize.height);        CGContextSetRGBFillColor(context, 0, 0, 0, static_cast<CGFloat>(0.66));    CGContextFillRect(context, CGRectMake(0, 0, imageSize.width, imageSize.height));    // Clear the repaint rects.    size_t count = WKArrayGetSize(repaintRects);    for (size_t i = 0; i < count; ++i) {        WKRect rect = WKRectGetValue(static_cast<WKRectRef>(WKArrayGetItemAtIndex(repaintRects, i)));        CGRect cgRect = CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);        CGContextClearRect(context, cgRect);    }        CGContextEndTransparencyLayer(context);    CGContextRestoreGState(context);}
开发者ID:ZeusbaseWeb,项目名称:webkit,代码行数:27,


示例5: wxRect

wxBitmap wxScreenDCImpl::DoGetAsBitmap(const wxRect *subrect) const{    wxRect rect = subrect ? *subrect : wxRect(0, 0, m_width, m_height);    wxBitmap bmp(rect.GetSize(), 32);#if !wxOSX_USE_IPHONE    CGRect srcRect = CGRectMake(rect.x, rect.y, rect.width, rect.height);    CGContextRef context = (CGContextRef)bmp.GetHBITMAP();    CGContextSaveGState(context);    CGContextTranslateCTM( context, 0,  m_height );    CGContextScaleCTM( context, 1, -1 );    if ( subrect )        srcRect = CGRectOffset( srcRect, -subrect->x, -subrect->y ) ;    CGImageRef image = grabViaOpenGL(kCGNullDirectDisplay, srcRect);    wxASSERT_MSG(image, wxT("wxScreenDC::GetAsBitmap - unable to get screenshot."));    CGContextDrawImage(context, srcRect, image);        CGImageRelease(image);    CGContextRestoreGState(context);#else    // TODO implement using UIGetScreenImage, CGImageCreateWithImageInRect, CGContextDrawImage#endif    return bmp;}
开发者ID:erwincoumans,项目名称:wxWidgets,代码行数:33,


示例6: CGContextTranslateCTM

void GraphicsContext::translate(float x, float y){    if (paintingDisabled())        return;    CGContextTranslateCTM(platformContext(), x, y);    m_data->translate(x, y);}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:7,


示例7: wxGCDCImpl

wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window )   : wxGCDCImpl( owner ){    m_window = window;    m_ok = true ;    m_window->GetSize( &m_width , &m_height);    if ( !m_window->IsShownOnScreen() )        m_width = m_height = 0;    CGContextRef cg = (CGContextRef) window->MacGetCGContextRef();    m_release = false;    if ( cg == NULL )    {        SetGraphicsContext( wxGraphicsContext::Create( window ) ) ;    }    else    {        CGContextSaveGState( cg );        m_release = true ;        // make sure the context is having its origin at the wx-window coordinates of the        // view (read at the top of window.cpp about the differences)        if ( window->MacGetLeftBorderSize() != 0 || window->MacGetTopBorderSize() != 0 )            CGContextTranslateCTM( cg , -window->MacGetLeftBorderSize() , -window->MacGetTopBorderSize() );        SetGraphicsContext( wxGraphicsContext::CreateFromNative( cg ) );    }    DoSetClippingRegion( 0 , 0 , m_width , m_height ) ;    SetBackground(wxBrush(window->GetBackgroundColour(),wxSOLID));    SetFont( window->GetFont() ) ;}
开发者ID:CyberIntelMafia,项目名称:clamav-devel,代码行数:35,


示例8: beginCGContext

//-----------------------------------------------------------------------------void CGDrawContext::lineTo (const CPoint& point){	CGContextRef context = beginCGContext (true, currentState.drawMode.integralMode ());	if (context)	{		applyLineStyle (context);		if ((((int32_t)currentState.frameWidth) % 2))			CGContextTranslateCTM (context, 0.5f, -0.5f);		CGContextBeginPath (context);		if (currentState.drawMode.integralMode ())		{			CGContextMoveToPoint (context, round (currentState.penLoc.h), round (currentState.penLoc.v));			CGContextAddLineToPoint (context, round (point.h), round (point.v));		}		else		{			CGContextMoveToPoint (context, currentState.penLoc.h, currentState.penLoc.v);			CGContextAddLineToPoint (context, point.h, point.v);		}		CGContextDrawPath (context, kCGPathStroke);		releaseCGContext (context);	}	currentState.penLoc = point;}
开发者ID:DaniM,项目名称:lyngo,代码行数:27,


示例9: beginCGContext

//-----------------------------------------------------------------------------void CGDrawContext::drawLines (const LineList& lines){    if (lines.size () == 0)        return;    CGContextRef context = beginCGContext (true, getDrawMode ().integralMode ());    if (context)    {        applyLineStyle (context);        CGPoint* cgPoints = new CGPoint[lines.size () * 2];        uint32_t index = 0;        VSTGUI_RANGE_BASED_FOR_LOOP(LineList, lines, LinePair, line)        cgPoints[index] = CGPointFromCPoint (line.first);        cgPoints[index+1] = CGPointFromCPoint (line.second);        if (getDrawMode ().integralMode ())        {            cgPoints[index] = pixelAlligned (cgPoints[index]);            cgPoints[index+1] = pixelAlligned (cgPoints[index+1]);        }        index += 2;        VSTGUI_RANGE_BASED_FOR_LOOP_END        if (getDrawMode ().integralMode ())        {            int32_t frameWidth = static_cast<int32_t> (currentState.frameWidth);            if (frameWidth % 2)                CGContextTranslateCTM (context, 0.5, 0.5);        }        CGContextStrokeLineSegments (context, cgPoints, lines.size () * 2);        delete [] cgPoints;        releaseCGContext (context);    }}
开发者ID:UIKit0,项目名称:vstgui,代码行数:36,


示例10: HandleViewEvent

staticOSStatus HandleViewEvent(	EventHandlerCallRef inHandlerCallRef,	EventRef 			inEvent, 	void 				*inUserData ){#pragma unused( inHandlerCallRef )	OSStatus			err = eventNotHandledErr;	DrawContextStruct	*context = inUserData;    verify_noerr( GetEventParameter(inEvent, kEventParamCGContextRef, typeCGContextRef, NULL, sizeof(CGContextRef), NULL, &context->cgContext) );	HIViewGetBounds(context->viewRef, &context->bounds);	CGContextTranslateCTM(context->cgContext, 0, context->bounds.size.height);	CGContextScaleCTM(context->cgContext, 1.0, -1.0);	switch ( GetEventKind( inEvent ) ) {		case kEventControlDraw:		{								// redraw  the context			DrawWindow( context->windowRef );			break;		}		default:			break;	};		return err;			}
开发者ID:fruitsamples,项目名称:ATSUIDirectAccessDemo,代码行数:30,


示例11: drawSkewedCoordinateSystem

void drawSkewedCoordinateSystem(CGContextRef context){    // alpha is 22.5 degrees and beta is 15 degrees.    float alpha = M_PI/8, beta = M_PI/12;    CGAffineTransform skew;    // Create a rectangle that is 72 units on a side    // with its origin at (0,0).    CGRect r = CGRectMake(0, 0, 72, 72);        CGContextTranslateCTM(context, 144, 144);    // Draw the coordinate axes untransformed.    drawCoordinateAxes(context);    // Fill the rectangle.    CGContextFillRect(context, r);    // Create an affine transform that skews the coordinate system,    // skewing the x-axis by alpha radians and the y-axis by beta radians.     skew = CGAffineTransformMake(1, tan(alpha), tan(beta), 1, 0, 0);    // Apply that transform to the context coordinate system.    CGContextConcatCTM(context, skew);    // Set the fill and stroke color to a dark blue.    CGContextSetRGBStrokeColor(context, 0.11, 0.208, 0.451, 1);    CGContextSetRGBFillColor(context, 0.11, 0.208, 0.451, 1);        // Draw the coordinate axes again, now transformed.    drawCoordinateAxes(context);    // Set the fill color again but with a partially transparent alpha.    CGContextSetRGBFillColor(context, 0.11, 0.208, 0.451, 0.7);    // Fill the rectangle in the transformed coordinate system.    CGContextFillRect(context, r);}
开发者ID:yarshure,项目名称:ProgrammingWithQuartz-Code,代码行数:32,


示例12: Quartz_StrWidth

static double 	Quartz_StrWidth(char *str, 				R_GE_gcontext *gc,				NewDevDesc *dd){    QuartzDesc *xd = (QuartzDesc*)dd->deviceSpecific;    CGPoint position;    CGContextSaveGState( GetContext(xd) );    CGContextTranslateCTM( GetContext(xd), 0, 0 );    CGContextScaleCTM( GetContext(xd), -1, 1);    CGContextRotateCTM( GetContext(xd), -1.0 * 3.1416);    CGContextSetTextDrawingMode( GetContext(xd), kCGTextInvisible );    Quartz_SetFont(gc->fontfamily, gc->fontface, gc->cex,  gc->ps, dd);    CGContextShowTextAtPoint( GetContext(xd), 0, 0, str, strlen(str) );    position = CGContextGetTextPosition( GetContext(xd) );    CGContextRestoreGState( GetContext(xd) );    return(position.x);}
开发者ID:Vladimir84,项目名称:rcc,代码行数:25,


示例13: QDPictGetBounds

bool wxMetaFile::Play(wxDC *dc){    if (!m_refData)        return false;    if (!dc->Ok() )        return false;    {#if wxMAC_USE_CORE_GRAPHICS        QDPictRef cgPictRef = M_METAFILEDATA->m_qdPictRef ;        CGContextRef cg = ((wxMacCGContext*)(dc->GetGraphicContext()))->GetNativeContext() ;        CGRect bounds = QDPictGetBounds( cgPictRef ) ;        CGContextSaveGState(cg);        CGContextTranslateCTM(cg, 0 , bounds.size.width );        CGContextScaleCTM(cg, 1, -1);        QDPictDrawToCGContext( cg , bounds , cgPictRef ) ;        CGContextRestoreGState( cg ) ;#else        PicHandle pict = (PicHandle) GetHMETAFILE() ;        wxMacPortSetter helper( dc ) ;        DrawPicture( pict , &(**pict).picFrame ) ;#endif    }    return true;}
开发者ID:HackLinux,项目名称:chandler-1,代码行数:27,


示例14: addRoundedRectToPath

static void addRoundedRectToPath(CGContextRef context, CGRect rect,										float ovalWidth,										float ovalHeight){	float fw, fh;	// If either ovalWidth or ovalHeight is 0, draw a regular rectangle.	if (ovalWidth == 0 || ovalHeight == 0) {		CGContextAddRect(context, rect);	}else{        CGContextSaveGState(context);		// Translate to lower-left corner of rectangle.        CGContextTranslateCTM(context, CGRectGetMinX(rect),										 CGRectGetMinY(rect));		// Scale by the oval width and height so that		// each rounded corner is 0.5 units in radius.		CGContextScaleCTM(context, ovalWidth, ovalHeight);		// Unscale the rectangle width by the amount of the X scaling.		fw = CGRectGetWidth(rect) / ovalWidth;		// Unscale the rectangle height by the amount of the Y scaling.		fh = CGRectGetHeight(rect) / ovalHeight;		// Start at the right edge of the rect, at the midpoint in Y.		CGContextMoveToPoint(context, fw, fh/2);		// Segment 1		CGContextAddArcToPoint(context, fw, fh, fw/2, fh, 0.5);		// Segment 2		CGContextAddArcToPoint(context, 0, fh, 0, fh/2, 0.5);		// Segment 3		CGContextAddArcToPoint(context, 0, 0, fw/2, 0, 0.5);		// Segment 4		CGContextAddArcToPoint(context, fw, 0, fw, fh/2, 0.5);		// Closing the path adds the last segment.		CGContextClosePath(context);		CGContextRestoreGState(context);	}}
开发者ID:yarshure,项目名称:ProgrammingWithQuartz-Code,代码行数:35,


示例15: image

QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool /* isTextBuffer */, QWidget *widget)    : image(width, height, format){    uint cgflags = kCGImageAlphaNoneSkipFirst;    switch (format) {    case QImage::Format_ARGB32:        cgflags = kCGImageAlphaFirst;        break;    case QImage::Format_ARGB32_Premultiplied:    case QImage::Format_ARGB8565_Premultiplied:    case QImage::Format_ARGB6666_Premultiplied:    case QImage::Format_ARGB8555_Premultiplied:    case QImage::Format_ARGB4444_Premultiplied:        cgflags = kCGImageAlphaPremultipliedFirst;        break;    default:        break;    }#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version    cgflags |= kCGBitmapByteOrder32Host;#endif    cg = CGBitmapContextCreate(image.bits(), width, height, 8, image.bytesPerLine(),                               QCoreGraphicsPaintEngine::macDisplayColorSpace(widget), cgflags);    CGContextTranslateCTM(cg, 0, height);    CGContextScaleCTM(cg, 1, -1);    Q_ASSERT(image.paintEngine()->type() == QPaintEngine::Raster);    static_cast<QRasterPaintEngine *>(image.paintEngine())->setCGContext(cg);}
开发者ID:AlekSi,项目名称:phantomjs,代码行数:32,


示例16: CGColorSpaceCreateDeviceRGB

bool GiCanvasIosImpl::createBufferBitmap(float width, float height, float scale){    width  *= scale;                       // 点数宽度转为像素宽度    height *= scale;        if (width < 4 || height < 4 || width > 2049 || height > 2049) {        return false;    }        CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();    _buffctx = CGBitmapContextCreate(NULL, width, height, 8, width * 4,                                     colorSpace, kCGImageAlphaPremultipliedLast);    CGColorSpaceRelease(colorSpace);        CGContextClearRect(_buffctx, CGRectMake(0, 0, width, height));        // 坐标系改为Y朝下,原点在左上角,这样除了放大倍数为1外,其余就与 _context 坐标系一致    //if (_buffctx && _context) {        CGContextTranslateCTM(_buffctx, 0, height);        CGContextScaleCTM(_buffctx, scale, - scale);    //}    //else if (_buffctx) {    //    CGContextScaleCTM(_buffctx, scale, scale);    //}        return !!_buffctx;}
开发者ID:huangzongwu,项目名称:touchvg,代码行数:27,


示例17: allocBits

//-----------------------------------------------------------------------------CGContextRef CGBitmap::createCGContext (){	CGContextRef context = 0;	if (bits == 0)	{		allocBits ();		if (imageSource)			getCGImage ();		if (image)		{			context = createCGContext ();			if (context)			{				CGContextScaleCTM (context, 1, -1);				CGContextDrawImage (context, CGRectMake (0, static_cast<CGFloat> (-size.y), static_cast<CGFloat> (size.x), static_cast<CGFloat> (size.y)), image);				CGContextScaleCTM (context, 1, -1);				return context;			}		}	}	if (bits)	{		CGBitmapInfo bitmapInfo = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Big;		context = CGBitmapContextCreate (bits,						static_cast<size_t> (size.x),						static_cast<size_t> (size.y),						8,						getBytesPerRow (),						GetCGColorSpace (),						bitmapInfo);		CGContextTranslateCTM (context, 0, (CGFloat)size.y);		CGContextScaleCTM (context, 1, -1);	}	return context;}
开发者ID:EQ4,项目名称:vstgui,代码行数:36,


示例18: AddRoundedRectToPath

static void AddRoundedRectToPath(CGContextRef context, CGRect rect,                                 float ovalWidth, float ovalHeight){    float fw, fh;    if (ovalWidth == 0 || ovalHeight == 0)    {        CGContextAddRect(context, rect);        return;    }    CGContextSaveGState(context);    CGContextTranslateCTM (context, CGRectGetMinX(rect),                           CGRectGetMinY(rect));    CGContextScaleCTM (context, ovalWidth, ovalHeight);    fw = CGRectGetWidth (rect) / ovalWidth;    fh = CGRectGetHeight (rect) / ovalHeight;    CGContextMoveToPoint(context, fw, fh / 2);    CGContextAddArcToPoint(context, fw, fh, fw / 2, fh, 1);    CGContextAddArcToPoint(context, 0, fh, 0, fh / 2, 1);    CGContextAddArcToPoint(context, 0, 0, fw / 2, 0, 1);    CGContextAddArcToPoint(context, fw, 0, fw, fh / 2, 1);    CGContextClosePath(context);    CGContextRestoreGState(context);}
开发者ID:AdamDiment,项目名称:CocoaSampleCode,代码行数:28,


示例19: SkCreateCGImageRef

void SkOSWindow::doPaint(void* ctx){#if 0	this->update(NULL);    const SkBitmap& bm = this->getBitmap();    CGImageRef img = SkCreateCGImageRef(bm);    if (img) {        CGRect r = CGRectMake(0, 0, bm.width(), bm.height());        CGContextRef cg = reinterpret_cast<CGContextRef>(ctx);        CGContextSaveGState(cg);        CGContextTranslateCTM(cg, 0, r.size.height);        CGContextScaleCTM(cg, 1, -1);        CGContextDrawImage(cg, r, img);        CGContextRestoreGState(cg);        CGImageRelease(img);    }#endif}
开发者ID:AliFarahnak,项目名称:XobotOS,代码行数:25,


示例20: CGContextTranslateCTM

void GraphicsContext::translate(float x, float y){    if (paintingDisabled())        return;    CGContextTranslateCTM(platformContext(), x, y);    m_data->translate(x, y);    m_data->m_userToDeviceTransformKnownToBeIdentity = false;}
开发者ID:dslab-epfl,项目名称:warr,代码行数:8,


示例21: doSimpleCGLayer

void doSimpleCGLayer(CGContextRef context){    int i,j;    CGSize s;    // Create the layer.    CGLayerRef layer = createCGLayerForDrawing(context);    if(layer == NULL){		fprintf(stderr, "Couldn't create layer!/n");		return;    }        // Get the size of the layer created.    s = CGLayerGetSize(layer);        // Clip to a rect that corresponds to    // a grid of 8x8 layer objects.    CGContextClipToRect(context, CGRectMake(0, 0, 8*s.width, 8*s.height));        // Paint 8 rows of layer objects.    for(j = 0 ; j < 8 ; j++){		CGContextSaveGState(context);			// Paint 4 columns of layer objects, moving			// across the drawing canvas by skipping a			// square on the grid each time across.			for(i = 0 ; i < 4 ; i++){				// Draw the layer at the current origin.				CGContextDrawLayerAtPoint(context, 					CGPointZero, 					layer);				// Translate across two layer widths.				CGContextTranslateCTM(context, 2*s.width, 0);			}		CGContextRestoreGState(context);		// Translate to the left one layer width on		// even loop counts and to the right one		// layer width on odd loop counts. Each		// time through the outer loop, translate up		// one layer height.		CGContextTranslateCTM(context, 			(j % 2) ? s.width: -s.width, 			s.height);    }    // Release the layer when done drawing with it.    CGLayerRelease(layer);}
开发者ID:yarshure,项目名称:ProgrammingWithQuartz-Code,代码行数:45,


示例22: CGContextSaveGState

void WKCACFLayer::display(PlatformGraphicsContext* context){    if (!m_owner)        return;    CGContextSaveGState(context);    CGRect layerBounds = bounds();    if (m_owner->contentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesTopDown) {        CGContextScaleCTM(context, 1, -1);        CGContextTranslateCTM(context, 0, -layerBounds.size.height);    }    if (m_owner->client()) {        GraphicsContext graphicsContext(context);        // It's important to get the clip from the context, because it may be significantly        // smaller than the layer bounds (e.g. tiled layers)        CGRect clipBounds = CGContextGetClipBoundingBox(context);        IntRect clip(enclosingIntRect(clipBounds));        m_owner->paintGraphicsLayerContents(graphicsContext, clip);    }#ifndef NDEBUG    else {        ASSERT_NOT_REACHED();        // FIXME: ideally we'd avoid calling -setNeedsDisplay on a layer that is a plain color,        // so CA never makes backing store for it (which is what -setNeedsDisplay will do above).        CGContextSetRGBFillColor(context, 0.0f, 1.0f, 0.0f, 1.0f);        CGContextFillRect(context, layerBounds);    }#endif    if (m_owner->showRepaintCounter()) {        char text[16]; // that's a lot of repaints        _snprintf(text, sizeof(text), "%d", m_owner->incrementRepaintCount());        CGContextSaveGState(context);        CGContextSetRGBFillColor(context, 1.0f, 0.0f, 0.0f, 0.8f);                CGRect aBounds = layerBounds;        aBounds.size.width = 10 + 12 * strlen(text);        aBounds.size.height = 25;        CGContextFillRect(context, aBounds);                CGContextSetRGBFillColor(context, 0.0f, 0.0f, 0.0f, 1.0f);        CGContextSetTextMatrix(context, CGAffineTransformMakeScale(1.0f, -1.0f));        CGContextSelectFont(context, "Helvetica", 25, kCGEncodingMacRoman);        CGContextShowTextAtPoint(context, aBounds.origin.x + 3.0f, aBounds.origin.y + 20.0f, text, strlen(text));                CGContextRestoreGState(context);            }    CGContextRestoreGState(context);}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:57,


示例23: drawPatternCallback

static void drawPatternCallback(void* info, CGContextRef context){    CGImageRef image = (CGImageRef)info;    CGFloat height = CGImageGetHeight(image);#if PLATFORM(IOS)    CGContextScaleCTM(context, 1, -1);    CGContextTranslateCTM(context, 0, -height);#endif    CGContextDrawImage(context, GraphicsContext(context).roundToDevicePixels(FloatRect(0, 0, CGImageGetWidth(image), height)), image);}
开发者ID:JefferyJeffery,项目名称:webkit,代码行数:10,


示例24: DISABLED_DRAW_TEST_F

DISABLED_DRAW_TEST_F(CGContext, ShadowWithRotatedCTM, WhiteBackgroundTest) {    CGContextRef context = GetDrawingContext();    CGRect bounds = GetDrawingBounds();    CGContextSetRGBStrokeColor(context, 1.0, 0.0, 0.0, 1.0);    CGContextSetLineWidth(context, 5);    CGContextSetShadow(context, CGSize{ 10.f, 10.f }, 1.0);    CGPoint center = _CGRectGetCenter(bounds);    CGRect rect = _CGRectCenteredOnPoint({ 150, 150 }, center);    CGPoint rectCenter = _CGRectGetCenter(rect);    CGContextTranslateCTM(context, rectCenter.x, rectCenter.y);    CGContextRotateCTM(context, 15.f * M_PI / 180.f);    CGContextTranslateCTM(context, -rectCenter.x, -rectCenter.y);    CGContextStrokeRect(context, rect);}
开发者ID:vkvenkat,项目名称:WinObjC,代码行数:19,


示例25: CGContextGetCTM

// On Mac, must redraw borders yourself:void QuartzWindow::adjust_after_resize() {   if (myContext) {    CGAffineTransform x = CGContextGetCTM(myContext);    CGContextScaleCTM(myContext, 1.0 / x.a, 1.0 / x.d);    CGContextTranslateCTM(myContext, -x.tx, -x.ty);    setupCTM();  }    if (TheSpy != NULL)    TheSpy->adjust_after_resize(); // might be the spy}
开发者ID:ardeujho,项目名称:self,代码行数:11,



注:本文中的CGContextTranslateCTM函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ CGDataProviderCreateWithData函数代码示例
C++ CGContextScaleCTM函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。