public ImageProperties(int width, int height, string mimeType, ImageOrientation orientation) { this.width = width; this.height = height; this.mimeType = mimeType; this.orientation = orientation; }
private void SetImageMargin(Image image, ImageOrientation orientation) { int left = 0; int top = 0; int right = 0; int bottom = 0; switch (orientation) { case ImageOrientation.ImageToLeft: right = 10; break; case ImageOrientation.ImageOnTop: bottom = 10; break; case ImageOrientation.ImageToRight: left = 10; break; case ImageOrientation.ImageOnBottom: top = 10; break; } image.Margin = new System.Windows.Thickness(left, top, right, bottom); }
/// <summary> /// Sets a margin of 10 between the image and the text. /// </summary> /// <param name="image">The image to add a margin to.</param> /// <param name="orientation">The orientation of the image on the button.</param> private static void SetImageMargin(Image image, ImageOrientation orientation) { const int DefaultMargin = 10; var left = 0; var top = 0; var right = 0; var bottom = 0; switch (orientation) { case ImageOrientation.ImageToLeft: right = DefaultMargin; break; case ImageOrientation.ImageOnTop: bottom = DefaultMargin; break; case ImageOrientation.ImageToRight: left = DefaultMargin; break; case ImageOrientation.ImageOnBottom: top = DefaultMargin; break; } image.Margin = new Thickness(left, top, right, bottom); }
/// <summary> /// Sets a margin of 10 between the image and the text. /// </summary> /// <param name="image">The image to add a margin to.</param> /// <param name="orientation">The orientation of the image on the button.</param> private static void SetImageMargin(System.Windows.Controls.Image image, ImageOrientation orientation) { const int defaultMargin = 10; int left = 0; int top = 0; int right = 0; int bottom = 0; switch (orientation) { case ImageOrientation.ImageToLeft: right = defaultMargin; break; case ImageOrientation.ImageOnTop: bottom = defaultMargin; break; case ImageOrientation.ImageToRight: left = defaultMargin; break; case ImageOrientation.ImageOnBottom: top = defaultMargin; break; } image.Margin = new System.Windows.Thickness(left, top, right, bottom); }
public void OrientationSetTest([PexAssumeUnderTest] XmpTag target, ImageOrientation value) { PexAssume.IsTrue((uint)value >= 1U && (uint)value <= 8U); target.Orientation = value; PexAssert.AreEqual(target.Orientation, value); // TODO: add assertions to method XmpTagTest.OrientationSetTest(XmpTag, ImageOrientation) }
static public ImageOrientation Rotate90 (ImageOrientation orientation) { orientation = Rotate270 (orientation); orientation = Rotate270 (orientation); orientation = Rotate270 (orientation); return orientation; }
void executeRequestForResource(PictureAd ad, ImageOrientation imageOrientation, ImageType imageType) { string filePath = ad.getLocalImageURL(imageOrientation, imageType); if (System.IO.File.Exists(filePath)) { downloadedResourcesCount++; if (downloadedResourcesCount == PictureAd.expectedResourcesCount) { _resourcesAvailable(); _operationCompleteDelegate(); } return; } string url = ad.getRemoteImageURL(imageOrientation, imageType); HTTPRequest pictureURLRequest = new HTTPRequest(url); pictureURLRequest.execute(pictureURLRequestResponse => { downloadedResourcesCount++; if (pictureURLRequestResponse.dataLength != 0) { System.IO.File.WriteAllBytes(ad.getLocalImageURL(imageOrientation, imageType), pictureURLRequestResponse.data); } if (downloadedResourcesCount == PictureAd.expectedResourcesCount) { _resourcesAvailable(); _operationCompleteDelegate(); } }); }
protected virtual void ExtractMetadata(TagLib.Image.File metadata) { if (metadata != null) { Orientation = metadata.ImageTag.Orientation; } }
/// <summary> /// Sets a margin of 10 between the image and the text. /// </summary> /// <param name="image">The image to add a margin to.</param> /// <param name="orientation">The orientation of the image on the button.</param> private void SetImageMargin(Image image, ImageOrientation orientation) { const int defaultMargin = 10; var left = 0; var top = 0; var right = 0; var bottom = 0; //If the button has text add a margin if (!string.IsNullOrEmpty(sourceButton.Text)) { switch (orientation) { case ImageOrientation.ImageToLeft: right = defaultMargin; break; case ImageOrientation.ImageOnTop: bottom = defaultMargin; break; case ImageOrientation.ImageToRight: left = defaultMargin; break; case ImageOrientation.ImageOnBottom: top = defaultMargin; break; } } image.Margin = new Thickness(left, top, right, bottom); }
public static RotateFlipType GetNormalizationRotation(this ImageOrientation imageOrientation) { switch (imageOrientation) { case ImageOrientation.TopLeft: break; case ImageOrientation.TopRight: return(RotateFlipType.RotateNoneFlipX); case ImageOrientation.BottomRight: return(RotateFlipType.Rotate180FlipNone); case ImageOrientation.BottomLeft: return(RotateFlipType.Rotate180FlipX); case ImageOrientation.LeftTop: return(RotateFlipType.Rotate90FlipX); case ImageOrientation.RightTop: return(RotateFlipType.Rotate90FlipNone); case ImageOrientation.RightBottom: return(RotateFlipType.Rotate270FlipX); case ImageOrientation.LeftBottom: return(RotateFlipType.Rotate270FlipNone); } return(RotateFlipType.RotateNoneFlipNone); }
public static void RotateBitmap(ImageOrientation orientation, ref Bitmap image) { var matrix = new Matrix(); // var scaleWidth = ((float)width) / image.Width; // var scaleHeight = ((float)height) / image.Height; // matrix.PostRotate(90); // matrix.PreScale(scaleWidth, scaleHeight); switch (orientation) { case ImageOrientation.Portrait: matrix.PostRotate(90); break; case ImageOrientation.LandscapeLeft: //matrix.PostRotate(90); break; case ImageOrientation.LandscapeRight: matrix.PostRotate(180); break; case ImageOrientation.PortraitBottom: matrix.PostRotate(270); break; default: break; } image = Bitmap.CreateBitmap(image, 0, 0, image.Width, image.Height, matrix, true); }
public void ReorientInPlace(ImageOrientation orientation) { if (orientation.Angle == 0 && orientation.Mirroring == ImageMirroring.None) return; this.Image.RotateFlip(rotateFlip[orientation]); }
public static ImageOrientation Rotate90(ImageOrientation orientation) { orientation = Rotate270(orientation); orientation = Rotate270(orientation); orientation = Rotate270(orientation); return(orientation); }
void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { Quaternion q = e.Reading.Orientation; const float eps = 0.137472f; const float deg90 = 0.707f; if (q.X > 0 && Math.Abs(q.Y - q.Z) <= eps) { Orientation = ImageOrientation.Portrait; } else if (q.X < 0 && (Math.Abs(q.Y - q.Z) <= eps || Math.Abs(q.Y + q.Z) <= eps)) { Orientation = ImageOrientation.PortraitBottom; } else if (Math.Abs(q.Z - q.X) <= eps && q.Y < 0) { Orientation = ImageOrientation.LandscapeLeft; } else if (Math.Abs(q.Z + q.X) <= eps && q.Y > 0) { Orientation = ImageOrientation.LandscapeRight; } else if (Math.Abs(q.X) <= eps && Math.Abs(q.Y) <= eps) { Orientation = ImageOrientation.Portrait; } else if (q.X < 0 && Math.Abs(q.Z) <= eps && Math.Abs(q.W) <= eps) { Orientation = ImageOrientation.Portrait; } SetOrientationToContext(); }
private void SetImageOrientation() { Image original = null; try { original = Image.FromStream(imageStream); float originalWidth = (float)original.Width; float originalHeight = (float)original.Height; float aspectRatio = originalWidth / originalHeight; if (aspectRatio > 1) { this._ImageOrientation = ImageOrientation.Horizontal; } else if (aspectRatio == 1) { this._ImageOrientation = ImageOrientation.Square; } else { this._ImageOrientation = ImageOrientation.Vertical; } original.Dispose(); } catch (Exception ex) { if (original != null) { original.Dispose(); } } }
public void AutoRotate(string path, string filename, ImageOrientation orientation, byte imageFormat, long quality) { string ext = ""; switch (imageFormat) { case 0: ext = "jpeg"; break; case 1: ext = "png"; break; default: ext = "jpeg"; break; } //-- set output file name --// fileOutputName = filename + "." + ext; string fullpath = path + fileOutputName; Image sampled = RotateImageStream(orientation, imageFormat); //-- save thumbnail --// ImageCodecInfo cinfo = GetEncoderInfo(imageFormat); EncoderParameters eparams = GetEncoderParameters(quality); sampled.Save(fullpath, cinfo, eparams); }
public string getImageURL(ImageURLType imageURLType, ImageOrientation pictureOrientation, ImageType imageType) { if(imageURLs == null || !imageURLs.ContainsKey(imageURLType)) return null; var imageURLTypeDict = imageURLs[imageURLType]; if(imageURLTypeDict == null || !imageURLTypeDict.ContainsKey(pictureOrientation)) return null; var pictureOrientationDict = imageURLTypeDict[pictureOrientation]; if(pictureOrientationDict == null || !pictureOrientationDict.ContainsKey(imageType)) return null; return pictureOrientationDict[imageType]; }
public static IImage Image(ImageOrientation orientation = ImageOrientation.TopLeft) { var image = Substitute.For <IImage>(); image.Orientation.Returns(orientation); return(image); }
public void setImageURL(string url, ImageURLType imageURLType, ImageOrientation pictureOrientation, ImageType imageType) { if(url == null || imageURLs == null || !imageURLs.ContainsKey(imageURLType)) return; var imageURLTypeDict = imageURLs[imageURLType]; if(imageURLTypeDict == null || !imageURLTypeDict.ContainsKey(pictureOrientation)) return; var pictureOrientationDict = imageURLTypeDict[pictureOrientation]; if(pictureOrientationDict == null) return; pictureOrientationDict[imageType] = url; System.Console.WriteLine(pictureOrientationDict[imageType]); }
private void OnImageLoad(string imagePath, Texture2D texture2D, ImageOrientation orientation) { ImageLoadedData loadedData = new ImageLoadedData(); loadedData.imagePath = imagePath; loadedData.imageTexture = texture2D; loadedData.orientation = orientation; this.imageLoadEvent?.CallEvent(loadedData); }
void OnImageLoad(string path, Texture2D tex, ImageOrientation orientation) { //imageTexture.texture = tex; //byte[] bytes = tex.EncodeToPNG(); //tempFile = Application.persistentDataPath + "SavedScreen.png"; //File.WriteAllBytes(tempFile, bytes); //GameObject.Find("Cube").GetComponent<Renderer>().material.mainTexture = tex; //log += "\nImage Saved to gallery, loaded :" + path + ", orientation : " + orientation; }
void initTextureForOrientation(PictureAd ad, ImageOrientation imageOrientation) { blackTex = new Texture2D(1, 1, TextureFormat.ARGB32, false); blackTex.SetPixel(0, 0, new Color(0.0f, 0.0f, 0.0f, 0.7f)); blackTex.Apply(); initTexture(imageOrientation, ImageType.Base, ad); initTexture(imageOrientation, ImageType.Frame, ad); initTexture(imageOrientation, ImageType.Close, ad); }
public CardImage(string name, ImageOrientation orientation) { var bitmap = CreateBitmap(orientation); Bitmap = bitmap; Orientation = orientation; Graphics = Graphics.FromImage(bitmap); Name = name; }
public BaseImageFile(SafeUri uri) { Uri = uri; Orientation = ImageOrientation.TopLeft; using (var metadata_file = Metadata.Parse(uri)) { ExtractMetadata(metadata_file); } }
/// <summary> /// /// </summary> /// <param name="inImgOrientation"></param> public LocationInfo(ImageOrientation inImgOrientation) { _locBckImage = new LocationBackImage(inImgOrientation); Width = _locBckImage.BackImage.Width; Height = _locBckImage.BackImage.Height; _tableList = new List <TableInfo>(); }
/// <summary> /// Gets the exif. /// </summary> /// <param name="bytes">The bytes.</param> /// <param name="format">The format.</param> /// <returns>System.Byte[][].</returns> public byte[] SetOrientation(byte[] bytes, ImageFormat format) { if (format.Equals(ImageFormat.Jpeg)) { var orientation = new ImageOrientation(bytes); bytes = orientation.OrientImage(); } return(bytes); }
public virtual RecognitionResult ProcessImageFile(string image_file, ImageOrientation image_orientation) { RecognitionResult ret = new RecognitionResult(csSmartIdEnginePINVOKE.RecognitionSession_ProcessImageFile__SWIG_2(swigCPtr, image_file, (int)image_orientation), true); if (csSmartIdEnginePINVOKE.SWIGPendingException.Pending) { throw csSmartIdEnginePINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public virtual RecognitionResult ProcessImage(Image image, Rectangle roi, ImageOrientation image_orientation) { RecognitionResult ret = new RecognitionResult(csSmartIdEnginePINVOKE.RecognitionSession_ProcessImage__SWIG_0(swigCPtr, Image.getCPtr(image), Rectangle.getCPtr(roi), (int)image_orientation), true); if (csSmartIdEnginePINVOKE.SWIGPendingException.Pending) { throw csSmartIdEnginePINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public ImageOrientation OrientationGetTest([PexAssumeUnderTest] XmpTag target, ImageOrientation value) { PexAssume.IsNotNull(value); PexAssume.IsTrue((uint)value >= 1U && (uint)value <= 8U); target.Orientation = value; ImageOrientation result = target.Orientation; PexAssert.AreEqual(result, (ImageOrientation)target.GetUIntNode(XmpTag.TIFF_NS, "Orientation")); return(result); // TODO: add assertions to method XmpTagTest.OrientationGetTest(XmpTag) }
private Image RotateImageStream(ImageOrientation orientation, byte imageFormat) { RotateFlipType flipType = RotateFlipType.RotateNoneFlipNone; if (_ImageOrientation != orientation) { flipType = RotateFlipType.Rotate90FlipNone; } return(RotateImageStream(flipType, imageFormat)); }
private Bitmap CreateBitmap(ImageOrientation orientation) { switch (orientation) { case ImageOrientation.Landscape: return(CreateBitmap(CardHeightInPixelsWithBleed, CardWidthInPixelsWithBleed)); case ImageOrientation.Portrait: return(CreateBitmap(CardWidthInPixelsWithBleed, CardHeightInPixelsWithBleed)); } return(null); }
static void Main(string[] args) { Console.Write("Image width: "); int width = Convert.ToInt32(Console.ReadLine()); Console.Write("Image height: "); int height = Convert.ToInt32(Console.ReadLine()); ImageOrientation orientation = width > height ? ImageOrientation.Landscape : ImageOrientation.Portrait; Console.WriteLine("Image orientation is " + orientation); }
public ImageInfo(int pixelWidth, int pixelHeight, ImageOrientation orientation, ImageFormat format) { Guard.GreaterThan(pixelWidth, 0, nameof(pixelWidth)); Guard.GreaterThan(pixelHeight, 0, nameof(pixelHeight)); Format = format; PixelWidth = pixelWidth; PixelHeight = pixelHeight; Orientation = orientation; }
private Bitmap CreateBitmap(ImageOrientation orientation) { switch (orientation) { case ImageOrientation.Landscape: return(GraphicsUtilities.CreateBitmap(CardLongSideInPixelsWithBleed, CardShortSideInPixelsWithBleed)); case ImageOrientation.Portrait: return(GraphicsUtilities.CreateBitmap(CardShortSideInPixelsWithBleed, CardLongSideInPixelsWithBleed)); } return(null); }
public static Rectangle TransformOrientation (int total_width, int total_height, Rectangle args, ImageOrientation orientation) { Rectangle area = args; switch (orientation) { case ImageOrientation.BottomRight: area.X = total_width - args.X - args.Width; area.Y = total_height - args.Y - args.Height; break; case ImageOrientation.TopRight: area.X = total_width - args.X - args.Width; break; case ImageOrientation.BottomLeft: area.Y = total_height - args.Y - args.Height; break; case ImageOrientation.LeftTop: area.X = args.Y; area.Y = args.X; area.Width = args.Height; area.Height = args.Width; break; case ImageOrientation.RightBottom: area.X = total_height - args.Y - args.Height; area.Y = total_width - args.X - args.Width; area.Width = args.Height; area.Height = args.Width; break; case ImageOrientation.RightTop: area.X = total_height - args.Y - args.Height; area.Y = args.X; area.Width = args.Height; area.Height = args.Width; break; case ImageOrientation.LeftBottom: area.X = args.Y; area.Y = total_width - args.X - args.Width; area.Width = args.Height; area.Height = args.Width; break; default: break; } return area; }
public static ImageOrientation ReverseTransformation(ImageOrientation orientation) { switch (orientation) { default: case ImageOrientation.TopLeft: case ImageOrientation.TopRight: case ImageOrientation.BottomRight: case ImageOrientation.BottomLeft: return orientation; case ImageOrientation.LeftTop: return ImageOrientation.RightBottom; case ImageOrientation.RightTop: return ImageOrientation.LeftBottom; case ImageOrientation.RightBottom: return ImageOrientation.LeftTop; case ImageOrientation.LeftBottom: return ImageOrientation.RightTop; } }
public static ImageOrientation Rotate270(ImageOrientation orientation) { if (orientation == ImageOrientation.None) { orientation = ImageOrientation.TopLeft; } ImageOrientation [] rot = new ImageOrientation [] { ImageOrientation.LeftBottom, ImageOrientation.LeftTop, ImageOrientation.RightTop, ImageOrientation.RightBottom, ImageOrientation.BottomLeft, ImageOrientation.TopLeft, ImageOrientation.TopRight, ImageOrientation.BottomRight }; orientation = rot [((int)orientation) -1]; return orientation; }
Rect rectWithPrecentage(int precentageSize, ImageOrientation imageOrientation) { bool isLandscape = (bool)(imageOrientation == ImageOrientation.Landscape); float heightProportion = Screen.width > Screen.height ? (float)9 / (float)16 : (float)16 / (float)9; float widthProportion = (float)1 / (float)heightProportion; int majorSizeValue = (Screen.width > Screen.height ? Screen.width : Screen.height) * precentageSize / 100; float finalTextureHeight = (float)majorSizeValue * (Screen.width > Screen.height ? (float)heightProportion : (float)widthProportion); finalTextureHeight = (finalTextureHeight > ((Screen.width > Screen.height ? Screen.height : Screen.width) * precentageSize / 100) ? ((Screen.width > Screen.height ? Screen.height : Screen.width) * precentageSize / 100) : finalTextureHeight); Rect landscapeRect = new Rect(((Screen.width > Screen.height ? Screen.width : Screen.height) - majorSizeValue) / 2, ((Screen.width > Screen.height ? Screen.height : Screen.width) - finalTextureHeight) / 2, majorSizeValue, finalTextureHeight); Rect portraitRect = new Rect(((Screen.width > Screen.height ? Screen.height : Screen.width) - finalTextureHeight) / 2, ((Screen.width > Screen.height ? Screen.width : Screen.height) - majorSizeValue) / 2, finalTextureHeight, majorSizeValue); return (isLandscape ? landscapeRect : portraitRect); }
void executeRequestForResource(PictureAd ad, ImageOrientation imageOrientation, ImageType imageType) { string filePath = ad.getLocalImageURL(imageOrientation, imageType); if (System.IO.File.Exists(filePath)) { downloadedResourcesCount++; if(downloadedResourcesCount == PictureAd.expectedResourcesCount) { _resourcesAvailable (); _operationCompleteDelegate(); } return; } string url = ad.getRemoteImageURL(imageOrientation, imageType); HTTPRequest pictureURLRequest = new HTTPRequest(url); pictureURLRequest.execute(pictureURLRequestResponse => { downloadedResourcesCount ++; if(pictureURLRequestResponse.dataLength != 0) System.IO.File.WriteAllBytes(ad.getLocalImageURL(imageOrientation, imageType), pictureURLRequestResponse.data); if(downloadedResourcesCount == PictureAd.expectedResourcesCount) { _resourcesAvailable (); _operationCompleteDelegate(); } }); }
public static Pixbuf TransformOrientation(Pixbuf src, ImageOrientation orientation) { Pixbuf dest; switch (orientation) { default: case ImageOrientation.TopLeft: dest = PixbufUtils.ShallowCopy (src); break; case ImageOrientation.TopRight: dest = src.Flip (false); break; case ImageOrientation.BottomRight: dest = src.RotateSimple (PixbufRotation.Upsidedown); break; case ImageOrientation.BottomLeft: dest = src.Flip (true); break; case ImageOrientation.LeftTop: using (var rotated = src.RotateSimple (PixbufRotation.Clockwise)) { dest = rotated.Flip (false); } break; case ImageOrientation.RightTop: dest = src.RotateSimple (PixbufRotation.Clockwise); break; case ImageOrientation.RightBottom: using (var rotated = src.RotateSimple (PixbufRotation.Counterclockwise)) { dest = rotated.Flip (false); } break; case ImageOrientation.LeftBottom: dest = src.RotateSimple (PixbufRotation.Counterclockwise); break; } return dest; }
public static Rectangle TransformOrientation(Pixbuf src, Rectangle args, ImageOrientation orientation) { return TransformOrientation (src.Width, src.Height, args, orientation); }
public static Point TransformOrientation(int total_width, int total_height, Point args, ImageOrientation orientation) { Point p = args; switch (orientation) { default: case ImageOrientation.TopLeft: break; case ImageOrientation.TopRight: p.X = total_width - p.X; break; case ImageOrientation.BottomRight: p.X = total_width - p.X; p.Y = total_height - p.Y; break; case ImageOrientation.BottomLeft: p.Y = total_height - p.Y; break; case ImageOrientation.LeftTop: p.X = args.Y; p.Y = args.X; break; case ImageOrientation.RightTop: p.X = total_height - args.Y; p.Y = args.X; break; case ImageOrientation.RightBottom: p.X = total_height - args.Y; p.Y = total_width - args.X; break; case ImageOrientation.LeftBottom: p.X = args.Y; p.Y = total_width - args.X; break; } return p; }
/// <summary> /// Gets the exif. /// </summary> /// <param name="bytes">The bytes.</param> /// <param name="format">The format.</param> /// <returns>System.Byte[][].</returns> public byte[] SetOrientation(byte[] bytes, ImageFormat format) { if (format.Equals(ImageFormat.Jpeg)) { var orientation = new ImageOrientation(bytes); bytes = orientation.OrientImage(); } return bytes; }
void initRectsForOrientation(PictureAd ad, ImageOrientation imageOrientation) { Rect frameRect = rectWithPrecentage(ad.getImageSpace(ImageType.Frame), imageOrientation); Rect baseRect = rectWithPrecentage(ad.getImageSpace(ImageType.Base), imageOrientation); Rect closeButtonRect = rectWithPrecentage(ad.getImageSpace(ImageType.Close), imageOrientation); float maxV = Math.Max(closeButtonRect.width, closeButtonRect.height); closeButtonRect = new Rect((baseRect.x + baseRect.width) - closeButtonRect.width / 2, baseRect.y - closeButtonRect.height / 2, maxV, maxV); Rect closeActiveAreaRect = new Rect((float)(closeButtonRect.x - closeButtonRect.width * 0.3), (float)(closeButtonRect.y - closeButtonRect.height * 0.3), (float)(closeButtonRect.width + closeButtonRect.width * 0.3), (float)(closeButtonRect.height + closeButtonRect.height * 0.3)); initRect(imageOrientation, ImageType.Base, baseRect); initRect(imageOrientation, ImageType.Frame, frameRect); initRect(imageOrientation, ImageType.Close, closeButtonRect); initRect(imageOrientation, ImageType.CloseActiveArea, closeActiveAreaRect); }
public Pixbuf LoadFromFile(string path) { try { orientation = GetOrientation (new SafeUri (path)); using (FileStream fs = System.IO.File.OpenRead (path)) { return Load (fs, orientation); } } catch (Exception) { Log.ErrorFormat ("Error loading photo {0}", path); return null; } }
public string getRemoteImageURL(ImageOrientation pictureOrientation, ImageType imageType) { return getImageURL(ImageURLType.Remote, pictureOrientation, imageType); }
protected static extern void elm_image_orient_set(IntPtr obj, ImageOrientation orientation);
public Pixbuf Load(System.IO.Stream stream, ImageOrientation orientation) { int count; byte [] data = new byte [8192]; while (((count = stream.Read (data, 0, data.Length)) > 0) && loader.Write (data, (ulong)count)) { ; } loader.Close (); Pixbuf orig = loader.Pixbuf; Gdk.Pixbuf rotated = FSpot.Utils.PixbufUtils.TransformOrientation (orig, orientation); if (orig != rotated) orig.Dispose (); loader.Dispose (); return rotated; }
void initRect(ImageOrientation imageOrientation, ImageType imageType, Rect rect) { texturesRects[imageOrientation][imageType] = rect; }
ImageOrientation getScreenOrientation() { return screenOrientation = Screen.width > Screen.height ? ImageOrientation.Landscape : ImageOrientation.Portrait; }
void executeRequestForResource(PictureAd ad, ImageOrientation imageOrientation, ImageType imageType) { string filePath = ad.getLocalImageURL(imageOrientation, imageType); if (System.IO.File.Exists(filePath)) { downloadedResourcesCount++; if(downloadedResourcesCount == PictureAd.expectedResourcesCount) { _resourcesAvailable (); _operationCompleteDelegate(); } return; } string url = ad.getRemoteImageURL(imageOrientation, imageType); HTTPRequest pictureURLRequest = new HTTPRequest(url); imageTypes[url] = imageType; imageOrientations[url] = imageOrientation; HTTPManager.sendFileRequest(pictureURLRequest, HTTPFileCallback, retryDelays, 20 * 60); }
public void Load(SafeUri uri) { if (is_disposed) return; //First, send a thumbnail if we have one if ((thumb = XdgThumbnailSpec.LoadThumbnail (uri, ThumbnailSize.Large, null)) != null) { pixbuf_orientation = ImageOrientation.TopLeft; EventHandler<AreaPreparedEventArgs> prep = AreaPrepared; if (prep != null) prep (this, new AreaPreparedEventArgs (true)); EventHandler<AreaUpdatedEventArgs> upd = AreaUpdated; if (upd != null) upd (this, new AreaUpdatedEventArgs (new Rectangle (0, 0, thumb.Width, thumb.Height))); } using (var image_file = ImageFile.Create (uri)) { image_stream = image_file.PixbufStream (); pixbuf_orientation = image_file.Orientation; } loading = true; // The ThreadPool.QueueUserWorkItem hack is there cause, as the bytes to read are present in the stream, // the Read is CompletedAsynchronously, blocking the mainloop image_stream.BeginRead (buffer, 0, count, delegate (IAsyncResult r) { ThreadPool.QueueUserWorkItem (delegate {HandleReadDone (r);}); }, null); }
static void setupPathsForAd(PictureAd ad, string localCachePath, string remotePath, ImageOrientation orientation, ImageType imageType) { ad.setImageURL(remotePath, ImageURLType.Remote, orientation, imageType); ad.setImageURL(localPathForResource(localCachePath, remotePath), ImageURLType.Local, orientation, imageType); }
/// <summary> /// Returns the alignment of the label on the button depending on the orientation. /// </summary> /// <param name="imageOrientation">The orientation to use.</param> /// <returns>The alignment to use for the text.</returns> private static TextAlignment GetTextAlignment(ImageOrientation imageOrientation) { TextAlignment returnValue; switch (imageOrientation) { case ImageOrientation.ImageToLeft: returnValue = TextAlignment.Left; break; case ImageOrientation.ImageToRight: returnValue = TextAlignment.Right; break; default: returnValue = TextAlignment.Center; break; } return returnValue; }
public string getLocalImageURL(ImageOrientation pictureOrientation, ImageType imageType) { return getImageURL(ImageURLType.Local, pictureOrientation, imageType); }
public static ImageOrientation GetViewOrientation(ImageOrientation po) { if (timer == 0 && available) SetupAccelerometer (); if (CurrentOrientation == Orient.TiltCounterclockwise) return FSpot.Utils.PixbufUtils.Rotate90 (po); if (CurrentOrientation == Orient.TiltClockwise) return FSpot.Utils.PixbufUtils.Rotate270 (po); return po; }
void initTexture(ImageOrientation imageOrientation, ImageType imageType, PictureAd ad) { textures[imageOrientation][imageType] = textureFromBytes(textureBytesForFrame(ad.getLocalImageURL(imageOrientation, imageType))); }