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


C# CGBitmapContext.ConcatCTM方法代码示例

本文整理汇总了C#中CGBitmapContext.ConcatCTM方法的典型用法代码示例。如果您正苦于以下问题:C# CGBitmapContext.ConcatCTM方法的具体用法?C# CGBitmapContext.ConcatCTM怎么用?C# CGBitmapContext.ConcatCTM使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CGBitmapContext的用法示例。


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

示例1: BeginImageContextWithOptions

        public static void BeginImageContextWithOptions(CGSize size, bool opaque, nfloat scale)
        {
            // Create new image context
            ColorSpace = CGColorSpace.CreateDeviceRGB ();
            Context = new CGBitmapContext (null, (int)size.Width, (int)size.Height, 8, 0, ColorSpace, CGImageAlphaInfo.PremultipliedLast);

            // Flip context vertically
            var flipVertical = new  CGAffineTransform(1,0,0,-1,0,size.Height);
            Context.ConcatCTM (flipVertical);

            // Save previous context
            ImageSize = size;
            PreviousContext = NSGraphicsContext.CurrentContext;
            NSGraphicsContext.CurrentContext = NSGraphicsContext.FromCGContext (Context, true);
        }
开发者ID:RangoLee,项目名称:mac-samples,代码行数:15,代码来源:UIGraphics.cs

示例2: InitWithCGImage

        private void InitWithCGImage(CGImage image, All filter)
        {
            int	width,height,i;
            CGContext context = null;
            IntPtr data;
            CGColorSpace colorSpace;
            IntPtr tempData;
            bool hasAlpha;
            CGImageAlphaInfo info;
            CGAffineTransform transform;
            Size imageSize;
            SurfaceFormat pixelFormat;
            bool sizeToFit = false;

            if(image == null)
            {
                throw new ArgumentException(" uimage is invalid! " );
            }

            info = image.AlphaInfo;
            hasAlpha = ((info == CGImageAlphaInfo.PremultipliedLast) || (info == CGImageAlphaInfo.PremultipliedFirst) || (info == CGImageAlphaInfo.Last) || (info == CGImageAlphaInfo.First) ? true : false);

            if (image.ColorSpace != null)
            {
                pixelFormat = SurfaceFormat.Color;
            }
            else
            {
                pixelFormat = SurfaceFormat.Alpha8;
            }

            imageSize = new Size(image.Width,image.Height);
            transform = CGAffineTransform.MakeIdentity();
            width = imageSize.Width;

            if((width != 1) && ((width & (width - 1))!=0)) {
                i = 1;
                while((sizeToFit ? 2 * i : i) < width)
                    i *= 2;
                width = i;
            }
            height = imageSize.Height;
            if((height != 1) && ((height & (height - 1))!=0)) {
                i = 1;
                while((sizeToFit ? 2 * i : i) < height)
                    i *= 2;
                height = i;
            }
            // TODO: kMaxTextureSize = 1024
            while((width > 1024) || (height > 1024))
            {
                width /= 2;
                height /= 2;
                transform = CGAffineTransform.MakeScale(0.5f,0.5f);
                imageSize.Width /= 2;
                imageSize.Height /= 2;
            }

            switch(pixelFormat)
            {
                case SurfaceFormat.Color:
                    colorSpace = CGColorSpace.CreateDeviceRGB();
                    data = Marshal.AllocHGlobal(height * width * 4);
                    context = new CGBitmapContext(data, width, height, 8, 4 * width, colorSpace,CGImageAlphaInfo.PremultipliedLast);
                    colorSpace.Dispose();
                    break;
                case SurfaceFormat.Alpha8:
                    data = Marshal.AllocHGlobal(height * width);
                    context = new CGBitmapContext(data, width, height, 8, width, null, CGImageAlphaInfo.Only);
                    break;
                default:
                    throw new NotSupportedException("Invalid pixel format");
            }

            context.ClearRect(new RectangleF(0,0,width,height));
             			context.TranslateCTM(0, height - imageSize.Height);

            if (!transform.IsIdentity)
            {
                context.ConcatCTM(transform);
            }

            context.DrawImage(new RectangleF(0, 0, image.Width, image.Height), image);

            //Convert "RRRRRRRRRGGGGGGGGBBBBBBBBAAAAAAAA" to "RRRRRGGGGGGBBBBB"
            /*
            if(pixelFormat == SurfaceFormat.Rgb32) {
                tempData = Marshal.AllocHGlobal(height * width * 2);

                int d32;
                short d16;
                int inPixel32Count=0,outPixel16Count=0;
                for(i = 0; i < width * height; ++i, inPixel32Count+=sizeof(int))
                {
                    d32 = Marshal.ReadInt32(data,inPixel32Count);
                    short R = (short)((((d32 >> 0) & 0xFF) >> 3) << 11);
                    short G = (short)((((d32 >> 8) & 0xFF) >> 2) << 5);
                    short B = (short)((((d32 >> 16) & 0xFF) >> 3) << 0);
                    d16 = (short)  (R | G | B);
                    Marshal.WriteInt16(tempData,outPixel16Count,d16);
//.........这里部分代码省略.........
开发者ID:JoelCarter,项目名称:MonoGame,代码行数:101,代码来源:ESTexture2D.cs

示例3: ESTexture2D

        public ESTexture2D(UIImage uiImage, All filter)
        {
            CGImage image = uiImage.CGImage;
            if(uiImage == null)
                throw new ArgumentNullException("uiImage");

            // TODO: could use this to implement lower-bandwidth textures
            //bool hasAlpha = (image.AlphaInfo == CGImageAlphaInfo.First || image.AlphaInfo == CGImageAlphaInfo.Last
            //		|| image.AlphaInfo == CGImageAlphaInfo.PremultipliedFirst || image.AlphaInfo == CGImageAlphaInfo.PremultipliedLast);

            // Image dimentions:
            logicalSize = new Point((int)uiImage.Size.Width, (int)uiImage.Size.Height);

            pixelWidth = uiImage.CGImage.Width;
            pixelHeight = uiImage.CGImage.Height;

            // Round up the target texture width and height to powers of two:
            potWidth = pixelWidth;
            potHeight = pixelHeight;
            if(( potWidth & ( potWidth-1)) != 0) { int w = 1; while(w <  potWidth) { w *= 2; }  potWidth = w; }
            if((potHeight & (potHeight-1)) != 0) { int h = 1; while(h < potHeight) { h *= 2; } potHeight = h; }

            // Scale down textures that are too large...
            CGAffineTransform transform = CGAffineTransform.MakeIdentity();
            while((potWidth > 1024) || (potHeight > 1024))
            {
                potWidth /= 2;    // Note: no precision loss - it's a power of two
                potHeight /= 2;
                pixelWidth /= 2;  // Note: precision loss - assume possibility of dropping a pixel at each step is ok
                pixelHeight /= 2;
                transform.Multiply(CGAffineTransform.MakeScale(0.5f, 0.5f));
            }

            RecalculateRatio();

            lock(textureLoadBufferLockObject)
            {
                CreateTextureLoadBuffer();

                unsafe
                {
                    fixed(byte* data = textureLoadBuffer)
                    {
                        var colorSpace = CGColorSpace.CreateDeviceRGB();
                        var context = new CGBitmapContext(new IntPtr(data), potWidth, potHeight,
                                8, 4 * potWidth, colorSpace, CGImageAlphaInfo.PremultipliedLast);

                        context.ClearRect(new RectangleF(0, 0, potWidth, potHeight));
                        context.TranslateCTM(0, potHeight - pixelHeight); // TODO: this does not play nice with the precision-loss above (keeping half-pixel to the edge)

                        if(!transform.IsIdentity)
                            context.ConcatCTM(transform);

                        context.DrawImage(new RectangleF(0, 0, image.Width, image.Height), image);
                        SetupTexture(new IntPtr(data), filter);

                        context.Dispose();
                        colorSpace.Dispose();
                    }
                }
            }
        }
开发者ID:meds,项目名称:ChicksnVixens,代码行数:62,代码来源:ESTexture2D.cs

示例4: DrawPathAsBackground

		// Draws our animation path on the background image, just to show it
		protected void DrawPathAsBackground ()
		{
			// create our offscreen bitmap context
			var bitmapSize = new SizeF (View.Frame.Size);
			using (var context = new CGBitmapContext (
				       IntPtr.Zero,
				       (int)bitmapSize.Width, (int)bitmapSize.Height, 8,
				       (int)(4 * bitmapSize.Width), CGColorSpace.CreateDeviceRGB (),
				       CGImageAlphaInfo.PremultipliedFirst)) {
				
				// convert to View space
				var affineTransform = CGAffineTransform.MakeIdentity ();
				// invert the y axis
				affineTransform.Scale (1f, -1f);
				// move the y axis up
				affineTransform.Translate (0, View.Frame.Height);
				context.ConcatCTM (affineTransform);

				// actually draw the path
				context.AddPath (animationPath);
				context.SetStrokeColor (UIColor.LightGray.CGColor);
				context.SetLineWidth (3f);
				context.StrokePath ();
				
				// set what we've drawn as the backgound image
				backgroundImage.Image = UIImage.FromImage (context.ToImage());
			}
		}
开发者ID:BoogieMAN2K,项目名称:monotouch-samples,代码行数:29,代码来源:LayerAnimationScreen.xib.cs

示例5: Texture2D

        public Texture2D(UIImage uiImage)
        {
            if (uiImage == null) {
                throw new ArgumentNullException("uiImage");
            }

            CGImage image = uiImage.CGImage;

            if (image == null) {
                throw new InvalidOperationException("Attempted to create a Texture2D from UIImage, but resulting CGImage is null");
            }

            CGImageAlphaInfo info = image.AlphaInfo;
            bool hasAlpha = info == CGImageAlphaInfo.PremultipliedLast || info == CGImageAlphaInfo.PremultipliedFirst || info == CGImageAlphaInfo.Last || info == CGImageAlphaInfo.First;

            int bpp = image.BitsPerComponent;

            Texture2DPixelFormat pixelFormat;

            if (image.ColorSpace != null) {
                if (hasAlpha || bpp >= 8) {
                    pixelFormat = Texture2DPixelFormat.Default;
                } else {
                    pixelFormat = Texture2DPixelFormat.RGB565;
                }
            } else {
                pixelFormat = Texture2DPixelFormat.A8;
            }

            int width = image.Width;
            if (width != 1 && (width & (width - 1)) != 0) {
                int i = 1;
                while (i < width) {
                    i *= 2;
                }

                width = i;
            }

            int height = image.Height;
            if (height != 1 && (height & (height - 1)) != 0) {
                int i = 1;
                while (i < height) {
                    i *= 2;
                }
                height = i;
            }

            if (width > MaxTextureSize || height > MaxTextureSize) {
                throw new InvalidOperationException("Image is too large. Width or height larger than MaxTextureSize");
            }

            CGColorSpace colorSpace = null;
            CGContext context;
            byte[] data;

            unsafe {
                // all formats require w*h*4, except A8 requires just w*h
                int dataSize = width * height * 4;
                if (pixelFormat == Texture2DPixelFormat.A8) {
                    dataSize = width * height;
                }

                data = new byte[dataSize];
                fixed (byte* dp = data) {
                    switch (pixelFormat) {
                        case Texture2DPixelFormat.RGBA8888:
                        case Texture2DPixelFormat.RGBA4444:
                        case Texture2DPixelFormat.RGB5A1:
                            colorSpace = CGColorSpace.CreateDeviceRGB();
                            context = new CGBitmapContext((IntPtr)dp, (int)width, (int)height, 8, 4 * (int)width, colorSpace, CGImageAlphaInfo.PremultipliedLast);
                            break;
                        case Texture2DPixelFormat.RGB565:
                            colorSpace = CGColorSpace.CreateDeviceRGB();
                            context = new CGBitmapContext((IntPtr)dp, (int)width, (int)height, 8, 4 * (int)width, colorSpace, CGImageAlphaInfo.NoneSkipLast);
                            break;
                        case Texture2DPixelFormat.A8:
                            context = new CGBitmapContext((IntPtr)dp, (int)width, (int)height, 8, (int)width, null, CGImageAlphaInfo.Only);
                            break;
                        default:
                            throw new InvalidEnumArgumentException("pixelFormat", (int)pixelFormat, typeof(Texture2DPixelFormat));
                    }

                    if (colorSpace != null) {
                        colorSpace.Dispose();
                    }

                    context.ClearRect(new RectangleF(0, 0, width, height));
                    context.TranslateCTM(0, height - image.Height);

                    // why is this here? make an identity transform, then immediately not use it? Need to look into this
                    CGAffineTransform transform = CGAffineTransform.MakeIdentity();

                    if (!transform.IsIdentity) {
                        context.ConcatCTM(transform);
                    }

                    context.DrawImage(new RectangleF(0, 0, image.Width, image.Height), image);
                }
            }
//.........这里部分代码省略.........
开发者ID:ishinao,项目名称:CocosNet,代码行数:101,代码来源:Texture2D.cs

示例6: InitWithCGImage

        private void InitWithCGImage(CGImage image)
        {
            int	width, height;
            CGBitmapContext bitmap = null;
            bool hasAlpha;
            CGImageAlphaInfo alphaInfo;
            CGColorSpace colorSpace;
            int bitsPerComponent, bytesPerRow;
            CGBitmapFlags bitmapInfo;
            bool premultiplied = false;
            int bitsPerPixel = 0;

            if (image == null) {
                throw new ArgumentException (" image is invalid! " );
            }

            alphaInfo = image.AlphaInfo;
            hasAlpha = ((alphaInfo == CGImageAlphaInfo.PremultipliedLast) || (alphaInfo == CGImageAlphaInfo.PremultipliedFirst) || (alphaInfo == CGImageAlphaInfo.Last) || (alphaInfo == CGImageAlphaInfo.First) ? true : false);

            imageSize.Width = (int)image.Width;
            imageSize.Height = (int)image.Height;

            width = (int)image.Width;
            height = (int)image.Height;

            // Not sure yet if we need to keep the original image information
            // before we change it internally.  TODO look at what windows does
            // and follow that.
            bitmapInfo = image.BitmapInfo;
            bitsPerComponent = (int)image.BitsPerComponent;
            bitsPerPixel = (int)image.BitsPerPixel;
            bytesPerRow = width * bitsPerPixel/bitsPerComponent;
            int size = bytesPerRow * height;

            colorSpace = image.ColorSpace;

            // Right now internally we represent the images all the same
            // I left the call here just in case we find that this is not
            // possible.  Read the comments for non alpha images.
            if(colorSpace != null) {
                if( hasAlpha ) {
                    premultiplied = true;
                    colorSpace = CGColorSpace.CreateDeviceRGB ();
                    bitsPerComponent = 8;
                    bitsPerPixel = 32;
                    bitmapInfo = CGBitmapFlags.PremultipliedLast;
                }
                else
                {
                    // even for images without alpha we will internally
                    // represent them as RGB with alpha.  There were problems
                    // if we do not do it this way and creating a bitmap context.
                    // The images were not drawing correctly and tearing.  Also
                    // creating a Graphics to draw on was a nightmare.  This
                    // should probably be looked into or maybe it is ok and we
                    // can continue representing internally with this representation
                    premultiplied = true;
                    colorSpace = CGColorSpace.CreateDeviceRGB ();
                    bitsPerComponent = 8;
                    bitsPerPixel = 32;
                    bitmapInfo = CGBitmapFlags.NoneSkipLast;
                }
            } else {
                premultiplied = true;
                colorSpace = CGColorSpace.CreateDeviceRGB ();
                bitsPerComponent = 8;
                bitsPerPixel = 32;
                bitmapInfo = CGBitmapFlags.NoneSkipLast;
            }

            bytesPerRow = width * bitsPerPixel/bitsPerComponent;
            size = bytesPerRow * height;

            bitmapBlock = Marshal.AllocHGlobal (size);
            bitmap = new CGBitmapContext (bitmapBlock,
                                          width, height,
                                          bitsPerComponent,
                                          bytesPerRow,
                                          colorSpace,
                                          bitmapInfo);

            bitmap.ClearRect (new CGRect (0,0,width,height));

            // We need to flip the Y axis to go from right handed to lefted handed coordinate system
            var transform = new CGAffineTransform(1, 0, 0, -1, 0, image.Height);
            bitmap.ConcatCTM(transform);

            bitmap.DrawImage (new CGRect (0, 0, image.Width, image.Height), image);

            var provider = new CGDataProvider (bitmapBlock, size, true);
            NativeCGImage = new CGImage (width, height, bitsPerComponent,
                                         bitsPerPixel, bytesPerRow,
                                         colorSpace,
                                         bitmapInfo,
                                         provider, null, true, image.RenderingIntent);

            colorSpace.Dispose();
            bitmap.Dispose();
        }
开发者ID:mono,项目名称:sysdrawing-coregraphics,代码行数:99,代码来源:Bitmap.cs

示例7: FixOrientation

        UIImage FixOrientation(UIImage image)
        {
            if (image.Orientation == UIImageOrientation.Up)
            return image;

             CGAffineTransform transform = CGAffineTransform.MakeIdentity ();

             switch (image.Orientation)
             {
            case UIImageOrientation.Down:
            case UIImageOrientation.DownMirrored:
               transform = CGAffineTransform.Translate (transform, image.Size.Width, image.Size.Height);
               transform = CGAffineTransform.Rotate (transform, (nfloat)(Math.PI));
               break;
            case UIImageOrientation.Left:
            case UIImageOrientation.LeftMirrored:
               transform = CGAffineTransform.Translate (transform, image.Size.Width, 0);
               transform = CGAffineTransform.Rotate (transform, (nfloat)(Math.PI / 2));
               break;
            case UIImageOrientation.Right:
            case UIImageOrientation.RightMirrored:
               transform = CGAffineTransform.Translate (transform, 0, image.Size.Height);
               transform = CGAffineTransform.Rotate (transform, (nfloat)(-1 * Math.PI / 2));
               break;
            case UIImageOrientation.Up:
            case UIImageOrientation.UpMirrored:
               break;
             }

             switch (image.Orientation)
             {
            case UIImageOrientation.UpMirrored:
            case UIImageOrientation.DownMirrored:
               transform = CGAffineTransform.Translate (transform, image.Size.Width, 0);
               transform = CGAffineTransform.Scale (transform, -1, 1);
               break;
            case UIImageOrientation.LeftMirrored:
            case UIImageOrientation.RightMirrored:
               transform = CGAffineTransform.Translate (transform, image.Size.Height, 0);
               transform = CGAffineTransform.Scale (transform, -1, 1);
               break;
            case UIImageOrientation.Up:
            case UIImageOrientation.Down:
            case UIImageOrientation.Left:
            case UIImageOrientation.Right:
               break;
             }

             using (CGBitmapContext ctx = new CGBitmapContext (null, (nint)image.Size.Width, (nint)image.Size.Height, (nint)image.CGImage.BitsPerComponent, (nint)0,
                                         image.CGImage.ColorSpace, image.CGImage.BitmapInfo))
             {
            ctx.ConcatCTM (transform);
            switch (image.Orientation)
            {
               case UIImageOrientation.Left:
               case UIImageOrientation.LeftMirrored:
               case UIImageOrientation.Right:
               case UIImageOrientation.RightMirrored:
                  ctx.DrawImage (new CGRect (0, 0, image.Size.Height, image.Size.Width), image.CGImage);
                  break;
               default:
                  ctx.DrawImage (new CGRect (0, 0, image.Size.Width, image.Size.Height), image.CGImage);
                  break;
            }

            using (var cgImage = ctx.ToImage ())
            {
               return new UIImage (cgImage);
            }
             }
        }
开发者ID:bkmza,项目名称:XamCropBkmzaSampleIOS,代码行数:71,代码来源:BCroppableViewController.cs

示例8: GetThumbImage

        /// <summary>
        /// Returns thumb image object for page 
        /// </summary>
        /// <param name="thumbContentSize">Thumb content size</param>
        /// <param name="pageNumber">Page number for what will created image object</param>
        /// <returns>Page image object</returns>
        private static UIImage GetThumbImage(float thumbContentSize, int pageNumber)
        {
            if ((pageNumber <= 0) || (pageNumber > PDFDocument.PageCount)) {
                return null;
            }

            // Calc page view size
            var pageSize = PageContentView.GetPageViewSize(pageNumber);
            if (pageSize.Width % 2 > 0) {
                pageSize.Width--;
            }
            if (pageSize.Height % 2 > 0) {
                pageSize.Height--;
            }

            // Calc target size
            var targetSize = new Size((int)pageSize.Width, (int)pageSize.Height);

            // Draw page on CGImage
            CGImage pageImage;
            using (CGColorSpace rgb = CGColorSpace.CreateDeviceRGB()) {
                using (var context = new CGBitmapContext(null, targetSize.Width, targetSize.Height, 8, 0, rgb, CGBitmapFlags.ByteOrder32Little | CGBitmapFlags.NoneSkipFirst)) {
                    using (var pdfPage = PDFDocument.GetPage(pageNumber)) {
                        // Draw page on custom CGBitmap context
                        var thumbRect = new RectangleF(0.0f, 0.0f, targetSize.Width, targetSize.Height);
                        context.SetFillColor(1.0f, 1.0f, 1.0f, 1.0f);
                        context.FillRect(thumbRect);
                        context.ConcatCTM(pdfPage.GetDrawingTransform(CGPDFBox.Crop, thumbRect, 0, true));
                        context.SetRenderingIntent(CGColorRenderingIntent.Default);
                        context.InterpolationQuality = CGInterpolationQuality.Default;
                        context.DrawPDFPage(pdfPage);
                        // Create CGImage from custom CGBitmap context
                        pageImage = context.ToImage();
                    }
                }
            }
            return UIImage.FromImage(pageImage);
        }
开发者ID:kenLa,项目名称:mTouch-PDFReader,代码行数:44,代码来源:ThumbView.cs

示例9: FromUIImage

        static Texture2D FromUIImage(UIImage uiImage, string name)
        {
            All filter = All.Linear;

            CGImage image = uiImage.CGImage;
            if(uiImage == null)
                throw new ArgumentNullException("uiImage");

            // TODO: could use this to implement lower-bandwidth textures
            //bool hasAlpha = (image.AlphaInfo == CGImageAlphaInfo.First || image.AlphaInfo == CGImageAlphaInfo.Last
            //		|| image.AlphaInfo == CGImageAlphaInfo.PremultipliedFirst || image.AlphaInfo == CGImageAlphaInfo.PremultipliedLast);

            // Image dimentions:
            Point logicalSize = new Point((int)uiImage.Size.Width, (int)uiImage.Size.Height);

            int pixelWidth = uiImage.CGImage.Width;
            int pixelHeight = uiImage.CGImage.Height;

            // Round up the target texture width and height to powers of two:
            int potWidth = pixelWidth;
            int potHeight = pixelHeight;
            if(( potWidth & ( potWidth-1)) != 0) { int w = 1; while(w <  potWidth) { w *= 2; }  potWidth = w; }
            if((potHeight & (potHeight-1)) != 0) { int h = 1; while(h < potHeight) { h *= 2; } potHeight = h; }

            // Scale down textures that are too large...
            CGAffineTransform transform = CGAffineTransform.MakeIdentity();
            while((potWidth > 1024) || (potHeight > 1024))
            {
                potWidth /= 2;    // Note: no precision loss - it's a power of two
                potHeight /= 2;
                pixelWidth /= 2;  // Note: precision loss - assume possibility of dropping a pixel at each step is ok
                pixelHeight /= 2;
                transform.Multiply(CGAffineTransform.MakeScale(0.5f, 0.5f));
            }

            lock(textureLoadBufferLockObject)
            {
                CreateTextureLoadBuffer();

                unsafe
                {
                    fixed(byte* data = textureLoadBuffer)
                    {
                        using(var colorSpace = CGColorSpace.CreateDeviceRGB())
                        using(var context = new CGBitmapContext(new IntPtr(data), potWidth, potHeight,
                                8, 4 * potWidth, colorSpace, CGImageAlphaInfo.PremultipliedLast))
                        {
                            context.ClearRect(new RectangleF(0, 0, potWidth, potHeight));
                            context.TranslateCTM(0, potHeight - pixelHeight); // TODO: this does not play nice with the precision-loss above (keeping half-pixel to the edge)

                            if(!transform.IsIdentity)
                                context.ConcatCTM(transform);

                            context.DrawImage(new RectangleF(0, 0, image.Width, image.Height), image);

                            uint textureId = 0;
                            /*textureId = new uint[1];
                            textureId[0]= 0;
                            GL.GenTextures(1,textureId);*/
                            GL.GenTextures(1, ref textureId);
                            GL.BindTexture(All.Texture2D, textureId);
                            GL.TexParameter(All.Texture2D, All.TextureMinFilter, (int)filter);
                            GL.TexParameter(All.Texture2D, All.TextureMagFilter, (int)filter);
                            GL.TexImage2D(All.Texture2D, 0, (int)All.Rgba, (int)potWidth, (int)potHeight, 0, All.Rgba, All.UnsignedByte, new IntPtr(data));

                            return new Texture2D(logicalSize.X, logicalSize.Y,
                                    pixelWidth, pixelHeight, potWidth, potHeight,
                                    textureId, name);
                        }
                    }
                }
            }
        }
开发者ID:eickegao,项目名称:tiny2d,代码行数:73,代码来源:Texture2D.cs


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