当前位置: 首页>>代码示例>>C++>>正文


C++ CGAffineTransformMake函数代码示例

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


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

示例1: CGBitmapContextCreateImage

void GiCanvasIos::endPaint(bool draw)
{
    if (m_draw->getContext())
    {
        if (draw && m_draw->_buffctx && m_draw->_context) {
            CGContextRef context = m_draw->_context;
            CGImageRef image = CGBitmapContextCreateImage(m_draw->_buffctx);
            CGRect rect = CGRectMake(0, 0, m_draw->width(), m_draw->height()); // 逻辑宽高点数
            
            if (image) {
                CGAffineTransform af = CGAffineTransformMake(1, 0, 0, -1, 0, m_draw->height());
                CGContextConcatCTM(context, af);    // 图像是朝上的,上下文坐标系朝下,上下颠倒显示
                
                CGInterpolationQuality old = CGContextGetInterpolationQuality(context);
                CGContextSetInterpolationQuality(context, kCGInterpolationNone);
                CGContextDrawImage(context, rect, image);
                CGContextSetInterpolationQuality(context, old);
                
                CGContextConcatCTM(context, CGAffineTransformInvert(af));   // 恢复成坐标系朝下
                CGImageRelease(image);
            }
        }
        if (m_draw->_buffctx) {
            CGContextRelease(m_draw->_buffctx);
            m_draw->_buffctx = NULL;
        }
        m_draw->_context = NULL;
        if (owner())
            owner()->_endPaint();
    }
}
开发者ID:fanliugen,项目名称:touchvg,代码行数:31,代码来源:ioscanvas.cpp

示例2: 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,代码来源:CoordinateSystem.c

示例3: CGImageGetWidth

bool GiCanvasIos::drawImage(CGImageRef image, const Point2d& centerM, bool autoScale)
{
    CGContextRef context = m_draw->getContext();
    bool ret = false;
    
    if (context && image) {
        Point2d ptD = centerM * m_draw->xf().modelToDisplay();
        float w = CGImageGetWidth(image);
        float h = CGImageGetHeight(image);
        
        if (autoScale) {
            w *= m_draw->xf().getViewScale();
            h *= m_draw->xf().getViewScale();
        }
        
        CGAffineTransform af = CGAffineTransformMake(1, 0, 0, -1, 0, m_draw->height());
        af = CGAffineTransformTranslate(af, ptD.x - w * 0.5f, 
                                        m_draw->height() - (ptD.y + h * 0.5f));
        
        CGContextConcatCTM(context, af);
        CGContextDrawImage(context, CGRectMake(0, 0, w, h), image);
        CGContextConcatCTM(context, CGAffineTransformInvert(af));
        ret = true;
    }
    
    return ret;
}
开发者ID:fanliugen,项目名称:touchvg,代码行数:27,代码来源:ioscanvas.cpp

示例4: _cairo_matrix_to_unit_quartz_matrix

static inline cairo_status_t
_cairo_matrix_to_unit_quartz_matrix (const cairo_matrix_t *m, CGAffineTransform *txout,
				     double *xout, double *yout)
{
    CGAffineTransform transform;
    double xscale, yscale;
    cairo_status_t status;

    status = _cairo_matrix_compute_basis_scale_factors (m, &xscale, &yscale, 1);
    if (status)
	return status;

    transform = CGAffineTransformMake (m->xx, - m->yx,
				       - m->xy, m->yy,
				       0.0f, 0.0f);
    if (xout)
	*xout = xscale;
    if (yout)
	*yout = yscale;

    if (xscale)
	xscale = 1.0 / xscale;
    if (yscale)
	yscale = 1.0 / yscale;

    *txout = CGAffineTransformScale (transform, xscale, yscale);

    return CAIRO_STATUS_SUCCESS;
}
开发者ID:colama,项目名称:colama-3rdparty-tools,代码行数:29,代码来源:cairo-quartz-font.c

示例5: CGRectMake

bool GiCanvasIos::drawCachedBitmap2(const GiCanvas* p, float x, float y, bool secondBmp)
{
    bool ret = false;
    
    if (p && p->getCanvasType() == getCanvasType()) {
        GiCanvasIos* gs = (GiCanvasIos*)p;
        int index = secondBmp ? 1 : 0;
        CGImageRef image = gs->m_draw->_cacheserr[index] ? NULL : gs->m_draw->_caches[index];
        CGContextRef context = m_draw->getContext();
        
        if (context && image) {
            CGRect rect = CGRectMake(x, y, m_draw->width(), m_draw->height());
            CGAffineTransform af = CGAffineTransformMake(1, 0, 0, -1, 0, m_draw->height());
            
            CGContextConcatCTM(context, af);
            
            CGInterpolationQuality oldQuality = CGContextGetInterpolationQuality(context);
            CGContextSetInterpolationQuality(context, kCGInterpolationNone);
            CGContextDrawImage(context, rect, image);
            CGContextSetInterpolationQuality(context, oldQuality);
            
            CGContextConcatCTM(context, CGAffineTransformInvert(af));
            ret = true;
        }
    }
    
    return ret;
}
开发者ID:fanliugen,项目名称:touchvg,代码行数:28,代码来源:ioscanvas.cpp

示例6: TransformHIViewToCG

static void TransformHIViewToCG(CGContextRef ctx, HIViewRef theView)
{
    // Undo the HIView coordinate flipping
    HIRect bounds;
    HIViewGetBounds(theView, &bounds);
    CGContextConcatCTM(ctx, CGAffineTransformMake(1, 0, 0, -1, 0, bounds.size.height));
}
开发者ID:fruitsamples,项目名称:MouseTracking,代码行数:7,代码来源:MouseTrackingView-CG.c

示例7: addOvalToPath

void addOvalToPath(CGContextRef context, CGRect r)
{
    CGAffineTransform matrix;
	
	// Save the context's state because we are going to transform and scale it
    CGContextSaveGState(context);

	// Create a transform to scale the context so that a radius of 1
	// is equal to the bounds of the rectangle, and transform the origin
	// of the context to the center of the bounding rectangle.  The 
	// center of the bounding rectangle will now be the center of
	// the oval.
    matrix = CGAffineTransformMake((r.size.width)/2, 0,
								   0, (r.size.height)/2,
								   r.origin.x + (r.size.width)/2,
								   r.origin.y + (r.size.height)/2);
 
	// Apply the transform to the context
    CGContextConcatCTM(context, matrix);

	// Signal the start of a path
    CGContextBeginPath(context);
	
	// Add a circle to the path.  After the circle is transformed by the
	// context's transformation matrix, it will become an oval lying
	// just inside the bounding rectangle.
    CGContextAddArc(context, 0, 0, 1, 0, 2*pi, true);

	// Restore the context's state. This removes the translation and scaling but leaves
	// the path, since the path is not part of the graphics state.
	CGContextRestoreGState(context);
}
开发者ID:DannyDeng2014,项目名称:CocoaSampleCode,代码行数:32,代码来源:ovals.c

示例8: CGAffineTransformMake

void Path::translate(const FloatSize& size)
{
    CGAffineTransform translation = CGAffineTransformMake(1, 0, 0, 1, size.width(), size.height());
    CGMutablePathRef newPath = CGPathCreateMutable();
    CGPathAddPath(newPath, &translation, m_path);
    CGPathRelease(m_path);
    m_path = newPath;
}
开发者ID:13W,项目名称:phantomjs,代码行数:8,代码来源:PathCG.cpp

示例9: CGAffineTransform

AffineTransform::operator CGAffineTransform() const
{
    return CGAffineTransformMake(narrowPrecisionToCGFloat(a()),
                                 narrowPrecisionToCGFloat(b()),
                                 narrowPrecisionToCGFloat(c()),
                                 narrowPrecisionToCGFloat(d()),
                                 narrowPrecisionToCGFloat(e()),
                                 narrowPrecisionToCGFloat(f()));
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:9,代码来源:TransformationMatrixCG.cpp

示例10: CATransform3DSkew

CATransform3D CATransform3DSkew (CATransform3D t,CGFloat angleX, CGFloat angleY)
{
    
    CGAffineTransform affineTransform  = CGAffineTransformMake(1, tanf(-angleX*M_PI/180.0f), tanf(-angleY*M_PI/180.0f), 1, 0, 0);
    CATransform3D skewTransform = CATransform3DMakeAffineTransform(affineTransform);
    
    return CATransform3DConcat(t, skewTransform);

}
开发者ID:BlessNeo,项目名称:TTAnimations,代码行数:9,代码来源:CATransform3DExtend.c

示例11: CGContextSetFont

FX_BOOL CQuartz2D::drawGraphicsString(void*                 graphics,
                                      void*                 font,
                                      FX_FLOAT              fontSize,
                                      FX_WORD*              glyphIndices,
                                      CGPoint*           glyphPositions,
                                      FX_INT32              charsCount,
                                      FX_ARGB               argb,
                                      CFX_AffineMatrix*     matrix )
{
    if (!graphics) {
        return FALSE;
    }
    CGContextRef context = (CGContextRef) graphics;
    CGContextSetFont(context, (CGFontRef)font);
    CGContextSetFontSize(context, fontSize);
    if (matrix) {
        CGAffineTransform m = CGContextGetTextMatrix(context);
        m = CGAffineTransformConcat(m,
                                    CGAffineTransformMake(matrix->a,
                                            matrix->b,
                                            matrix->c,
                                            matrix->d,
                                            matrix->e,
                                            matrix->f));
        CGContextSetTextMatrix(context, m);
    }
    FX_INT32 a, r, g, b;
    ArgbDecode(argb, a, r, g, b);
    CGContextSetRGBFillColor(context,
                             r / 255.f,
                             g / 255.f,
                             b / 255.f,
                             a / 255.f);
    CGContextSaveGState(context);
#if CGFLOAT_IS_DOUBLE
    CGPoint* glyphPositionsCG = new CGPoint[charsCount];
    if (!glyphPositionsCG) {
        return FALSE;
    }
    for (int index = 0; index < charsCount; ++index) {
        glyphPositionsCG[index].x = glyphPositions[index].x;
        glyphPositionsCG[index].y = glyphPositions[index].y;
    }
#else
    CGPoint* glyphPositionsCG = (CGPoint*)glyphPositions;
#endif
    CGContextShowGlyphsAtPositions(context,
                                   (CGGlyph *) glyphIndices,
                                   glyphPositionsCG,
                                   charsCount);
#if CGFLOAT_IS_DOUBLE
    delete[] glyphPositionsCG;
#endif
    CGContextRestoreGState(context);
    return TRUE;
}
开发者ID:151706061,项目名称:PDFium,代码行数:56,代码来源:fx_quartz_device.cpp

示例12: TEST

TEST(AffineTransform, CGAffineTransformConstruction)
{
    CGAffineTransform cgTransform = CGAffineTransformMake(6.0, 5.0, 4.0, 3.0, 2.0, 1.0);
    WebCore::AffineTransform test(cgTransform);

    testValueConstruction(test);
    testGetAndSet(test);

    ASSERT_FALSE(test.isIdentity());
}
开发者ID:eocanha,项目名称:webkit,代码行数:10,代码来源:AffineTransform.cpp

示例13: SaveState

FX_BOOL CFX_QuartzDeviceDriver::DrawPath(const CFX_PathData*        pathData,
        const CFX_AffineMatrix*       matrix,
        const CFX_GraphStateData*     graphState,
        FX_DWORD                      fillArgb,
        FX_DWORD                      strokeArgb,
        int                           fillMode,
        int                           alpha_flag,
        void*                         pIccTransform,
        int							blend_type
                                        )
{
    SaveState();
    CGBlendMode mode = GetCGBlendMode(blend_type);
    if (mode != kCGBlendModeNormal) {
        CGContextSetBlendMode(_context, mode);
    }
    CGAffineTransform m = CGAffineTransformIdentity;
    if (matrix) {
        m = CGAffineTransformMake(matrix->GetA(), matrix->GetB(), matrix->GetC(), matrix->GetD(), matrix->GetE(), matrix->GetF());
    }
    m = CGAffineTransformConcat(m, _foxitDevice2User);
    CGContextConcatCTM(_context, m);
    int pathMode = 0;
    if (graphState && strokeArgb) {
        CGContextSetMiterLimit(_context, graphState->m_MiterLimit);
        FX_FLOAT lineWidth = getLineWidth(graphState, m);
        setStrokeInfo(graphState, strokeArgb, lineWidth);
        pathMode |= 4;
    }
    if (fillMode && fillArgb) {
        setFillInfo(fillArgb);
        if ((fillMode & 3) == FXFILL_WINDING) {
            pathMode |= 1;
        } else if ((fillMode & 3) == FXFILL_ALTERNATE) {
            pathMode |= 2;
        }
    }
    setPathToContext(pathData);
    if (fillMode & FXFILL_FULLCOVER) {
        CGContextSetShouldAntialias(_context, false);
    }
    if (pathMode == 4) {
        CGContextStrokePath(_context);
    } else if (pathMode == 1) {
        CGContextFillPath(_context);
    } else if (pathMode == 2) {
        CGContextEOFillPath(_context);
    } else if (pathMode == 5) {
        CGContextDrawPath(_context, kCGPathFillStroke);
    } else if (pathMode == 6) {
        CGContextDrawPath(_context, kCGPathEOFillStroke);
    }
    RestoreState(FALSE);
    return TRUE;
}
开发者ID:151706061,项目名称:PDFium,代码行数:55,代码来源:fx_quartz_device.cpp

示例14: _cairo_quartz_init_glyph_path

static cairo_int_status_t
_cairo_quartz_init_glyph_path (cairo_quartz_scaled_font_t *font,
			       cairo_scaled_glyph_t *scaled_glyph)
{
    cairo_quartz_font_face_t *font_face = _cairo_quartz_scaled_to_face(font);
    CGGlyph glyph = _cairo_quartz_scaled_glyph_index (scaled_glyph);
    CGAffineTransform textMatrix;
    CGPathRef glyphPath;
    cairo_path_fixed_t *path;

    if (glyph == INVALID_GLYPH) {
	_cairo_scaled_glyph_set_path (scaled_glyph, &font->base, _cairo_path_fixed_create());
	return CAIRO_STATUS_SUCCESS;
    }

    textMatrix = CGAffineTransformMake (font->base.scale.xx,
					-font->base.scale.yx,
					-font->base.scale.xy,
					font->base.scale.yy,
					font->base.scale.x0,
					font->base.scale.y0);

    textMatrix = CGAffineTransformConcat (textMatrix, CGAffineTransformMake (1.0, 0.0, 0.0, -1.0, 0.0, 0.0));

    glyphPath = CGFontGetGlyphPathPtr (font_face->cgFont, &textMatrix, 0, glyph);
    if (!glyphPath)
	return CAIRO_INT_STATUS_UNSUPPORTED;

    path = _cairo_path_fixed_create ();
    if (!path) {
	CGPathRelease (glyphPath);
	return _cairo_error(CAIRO_STATUS_NO_MEMORY);
    }

    CGPathApply (glyphPath, path, _cairo_quartz_path_apply_func);

    CGPathRelease (glyphPath);

    _cairo_scaled_glyph_set_path (scaled_glyph, &font->base, path);

    return CAIRO_STATUS_SUCCESS;
}
开发者ID:colama,项目名称:colama-3rdparty-tools,代码行数:42,代码来源:cairo-quartz-font.c

示例15: OS_NATIVE

JNIEXPORT void JNICALL OS_NATIVE(CGAffineTransformMake)
	(JNIEnv *env, jclass that, jfloat arg0, jfloat arg1, jfloat arg2, jfloat arg3, jfloat arg4, jfloat arg5, jfloatArray arg6)
{
	jfloat *lparg6=NULL;
	OS_NATIVE_ENTER(env, that, CGAffineTransformMake_FUNC);
	if (arg6) if ((lparg6 = (*env)->GetFloatArrayElements(env, arg6, NULL)) == NULL) goto fail;
	*(CGAffineTransform *)lparg6 = CGAffineTransformMake(arg0, arg1, arg2, arg3, arg4, arg5);
fail:
	if (arg6 && lparg6) (*env)->ReleaseFloatArrayElements(env, arg6, lparg6, 0);
	OS_NATIVE_EXIT(env, that, CGAffineTransformMake_FUNC);
}
开发者ID:andreyvit,项目名称:yoursway-swt,代码行数:11,代码来源:os_custom.c


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