zoukankan      html  css  js  c++  java
  • cocos2d从Url获得图片数据创建CCSprite

    URL->CCSprite

    1.URL->UIImage
    1 +(UIImage *) GetUIImageFromURL : (NSString *) url
    2 {
    3     return [UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString: url]]];
    4 }
    2.UIImage->CCSprite
    1 +(CCSprite *) convertImageToSprite:(UIImage *) image
    2 {
    3     CGImageRef cgimage = image.CGImage;
    4     CCTexture2D *texture = [[CCTexture2D alloc] initWithCGImage:cgimage resolutionType:kCCResolutioniPhoneRetinaDisplay];
    5     CCSprite *sprite = [CCSprite spriteWithTexture:texture];
    6     [texture release];
    7     return sprite;
    8 }
  • 相关阅读:
    灌注和宝石性道法价比分析
    bzoj1912
    bzoj3504
    poj3580
    bzoj1251
    bzoj3223
    bzoj1212
    bzoj3790
    记一次惨痛的比赛
    bzoj2734
  • 原文地址:https://www.cnblogs.com/ketmales/p/2934413.html
Copyright © 2011-2022 走看看