public void Rotate_degreesFloat_RotateProcessorWithAnglesSetrue(RotateType angle, FlipType flip, float expectedAngle) { this.operations.RotateFlip(angle, flip); RotateProcessor <Rgba32> rotateProcessor = this.Verify <RotateProcessor <Rgba32> >(0); FlipProcessor <Rgba32> flipProcessor = this.Verify <FlipProcessor <Rgba32> >(1); Assert.Equal(expectedAngle, rotateProcessor.Degrees); Assert.Equal(flip, flipProcessor.FlipType); }
public void RotateFlip <TPixel>(TestImageProvider <TPixel> provider, RotateType rotateType, FlipType flipType) where TPixel : struct, IPixel <TPixel> { using (Image <TPixel> image = provider.GetImage()) { image.Mutate(x => x.RotateFlip(rotateType, flipType)); image.DebugSave(provider, string.Join("_", rotateType, flipType)); } }
/// <summary> /// 旋转 /// </summary> /// <typeparam name="TComponent">组件类型</typeparam> /// <param name="component">组件实例</param> /// <param name="type">旋转类型</param> public static TComponent Rotate <TComponent>(this TComponent component, RotateType type) where TComponent : IIcon { var option = component as IOptionConfig; option?.Config <Config>(config => { config.SetAttribute(UiConst.Rotate, type); }); return(component); }
// Изменение типа вращения public void SetRotateType(RotateType type) { if (type == this.rotateType) { return; } this.rotateType = type; }
public void Rotate_degreesFloat_RotateProcessorWithAnglesSetAndExpandTrue(RotateType angle, FlipType flip, float expectedAngle) { this.operations.RotateFlip(angle, flip); var rotateProcessor = this.Verify <RotateProcessor <Rgba32> >(0); var flipProcessor = this.Verify <FlipProcessor <Rgba32> >(1); Assert.Equal(expectedAngle, rotateProcessor.Angle); Assert.False(rotateProcessor.Expand); Assert.Equal(flip, flipProcessor.FlipType); }
public override void OnInspectorGUI() { // DrawDefaultInspector(); GUILayout.Space(8); serializedObject.Update(); EditorGUILayout.PropertyField(serializedObject.FindProperty("type")); EditorGUILayout.LabelField("Spawning Control", EditorStyles.boldLabel); EditorGUILayout.PropertyField(serializedObject.FindProperty("spawnLimit")); EditorGUILayout.PropertyField(serializedObject.FindProperty("spawnType")); GUILayout.Space(5); spawnPos.DoLayoutList(); if (GUILayout.Button("Scan")) { Undo.RecordObject(weapon, ""); Transform[] children = new Transform[weapon.transform.childCount]; for (int i = 0; i < weapon.transform.childCount; i++) { children[i] = weapon.transform.GetChild(i); } weapon.spawningPos = children; } GUILayout.Space(5); EditorGUILayout.PropertyField(serializedObject.FindProperty("spawnWeaponeType")); EditorGUILayout.PropertyField(serializedObject.FindProperty("spawningTime")); EditorGUILayout.PropertyField(serializedObject.FindProperty("spawningIntervalTime")); EditorGUILayout.PropertyField(serializedObject.FindProperty("vecMultiplier")); EditorGUILayout.LabelField("Rotation", EditorStyles.boldLabel); EditorGUILayout.PropertyField(rotateType); RotateType _rotateType = (RotateType)rotateType.enumValueIndex; switch (_rotateType) { case RotateType.Auto: IntMinMaxSlider("Allow Rotation Angle", serializedObject.FindProperty("angleMin"), serializedObject.FindProperty("angleMax"), -360, 360); EditorGUILayout.PropertyField(serializedObject.FindProperty("rotateSpeed")); EditorGUILayout.PropertyField(serializedObject.FindProperty("rotateDirection"), new GUIContent("Initial Rotation Direction")); break; case RotateType.Manual: IntMinMaxSlider("Allow Rotation Angle", serializedObject.FindProperty("angleMin"), serializedObject.FindProperty("angleMax"), -360, 360); EditorGUILayout.PropertyField(serializedObject.FindProperty("rotateSpeed")); EditorGUILayout.PropertyField(serializedObject.FindProperty("revertRotate")); break; } serializedObject.ApplyModifiedProperties(); }
public static unsafe Bitmap Rotate(Bitmap originalBitmap, RotateType rotateType) { if (originalBitmap.PixelFormat != PixelFormat.Format32bppArgb) { throw new ArgumentException("Only Format32bppArgb is supported."); } var originalWidth = originalBitmap.Width; var originalHeight = originalBitmap.Height; var newWidth = originalHeight; var newHeight = originalWidth; var rotatedBitmap = new Bitmap(newWidth, newHeight, PixelFormat.Format32bppArgb); var originalData = originalBitmap .LockBits(new Rectangle(0, 0, originalWidth, originalHeight), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); var rotatedData = rotatedBitmap .LockBits(new Rectangle(0, 0, newWidth, newHeight), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); var originalPointer = (int *)originalData.Scan0.ToPointer(); var ratatedPointer = (int *)rotatedData.Scan0.ToPointer(); try { switch (rotateType) { case RotateType.Rotate90: Rotate90(originalWidth, originalHeight, originalPointer, ratatedPointer); break; case RotateType.Rotate270: Rotate270(originalWidth, originalHeight, originalPointer, ratatedPointer); break; } } finally { originalBitmap.UnlockBits(originalData); rotatedBitmap.UnlockBits(rotatedData); } return(rotatedBitmap); }
public Render(int height, int width) { canvasHeight = height; canvasWidth = width; proecType = ProecType.Parallel; rotateType = RotateType.Global; viewType = ViewType.Faces; light = new Vector3D(0, 0, 100); color = Color.DarkOrchid; // Инициализируем камеру camera = new Camera(new Point3D(300, 100, -300), new Point3D(), 5, 5000, 90, width, height); }
public void Hurt(int damage) { if (HasProperty(EntityProperty.CanBeHurt)) { health -= damage; SetProperty(EntityProperty.CanBeHurt, false); // TODO: Replace this with a stat moveType = MoveType.None; rotateType = RotateType.None; PlayVFX(health <= 0 ? deathVFX : hurtVFX); } }
public void ImageShouldRotateFlip(RotateType rotateType, FlipType flipType) { string path = this.CreateOutputDirectory("RotateFlip"); foreach (TestFile file in Files) { string filename = file.GetFileName(rotateType + "-" + flipType); using (Image <Rgba32> image = file.CreateImage()) using (FileStream output = File.OpenWrite($"{path}/{filename}")) { image.RotateFlip(rotateType, flipType).Save(output); } } }
public void ImageShouldApplyRotateSampler(RotateType value) { string path = this.CreateOutputDirectory("Rotate"); foreach (TestFile file in Files) { string filename = file.GetFileName(value); using (Image <Rgba32> image = file.CreateImage()) using (FileStream output = File.OpenWrite($"{path}/{filename}")) { image.Rotate(value).Save(output); } } }
void Mode_Changed(object sender, SelectionChangedEventArgs e) { RotateType selected = (RotateType)RotateMode.SelectedIndex; if (_rotate.Mode != selected) { Program.Project.Undo.AddAndExecute(new Rotate.ModeUndoEntry( _rotate, _rotate.Mode, selected, RotateMode.Items )); } }
private BitmapLayer RotateLayer(BitmapLayer layer, RotateType rotationType, int width, int height, double startProgress, double endProgress) { Surface surface = new Surface(width, height); if (rotationType == RotateType.Clockwise180 || rotationType == RotateType.CounterClockwise180) { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { surface[x, y] = layer.Surface[width - x - 1, height - y - 1]; } OnProgress(((double)y / (double)height) * (endProgress - startProgress) + startProgress); } } else if (rotationType == RotateType.Clockwise270 || rotationType == RotateType.CounterClockwise90) { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { surface[x, y] = layer.Surface[height - y - 1, x]; } OnProgress(((double)y / (double)height) * (endProgress - startProgress) + startProgress); } } else if (rotationType == RotateType.Clockwise90 || rotationType == RotateType.CounterClockwise270) { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { surface[x, y] = layer.Surface[y, width - 1 - x]; } OnProgress(((double)y / (double)height) * (endProgress - startProgress) + startProgress); } } BitmapLayer returnMe = new BitmapLayer(surface, true); returnMe.LoadProperties(layer.SaveProperties()); return(returnMe); }
public void parabola(Vector3 velocity) { type = RotateType.Parabola; var xz = new Vector3 { x = velocity.x, z = velocity.z }; var xzMagnitude = xz.magnitude; var yMagnitude = Mathf.Abs(velocity.y); if (xzMagnitude == 0 || yMagnitude == 0) { angularVelocity = 0; return; } angularVelocity = -Mathf.Min(xzMagnitude / yMagnitude, yMagnitude / xzMagnitude) * parabolaK * Mathf.Rad2Deg; rotateAxis = Vector3.Cross(xz, Vector3.up); }
public void Rotate(Transform cube, Vector3 direction, RotateType rotateType) { isCubeRotating = true; if (rotateType == RotateType.Player) { moves.Add(new MoveData(cube.name, getOppositeDirection(direction))); } if (direction.x != 0) { foreach (GameObject c in cubes) { if (cube.transform.position.y == c.transform.position.y) { c.transform.SetParent(rotationContainer.transform); } } rotationContainer.transform.DORotate(Vector3.up * rotateAmount * direction.x, rotateTime).OnComplete(() => rotateComplete(rotateType)); } else if (direction.y != 0) { foreach (GameObject c in cubes) { if (cube.transform.position.z == c.transform.position.z) { c.transform.SetParent(rotationContainer.transform); } } rotationContainer.transform.DORotate(Vector3.forward * rotateAmount * direction.y, rotateTime).OnComplete(() => rotateComplete(rotateType)); } else if (direction.z != 0) { foreach (GameObject c in cubes) { if (cube.transform.position.x == c.transform.position.x) { c.transform.SetParent(rotationContainer.transform); } } rotationContainer.transform.DORotate(Vector3.right * rotateAmount * direction.z, rotateTime).OnComplete(() => rotateComplete(rotateType)); } }
//frompath (import) has two varieties: they will take // - a raw png with a prefix (or suffix??) // - a raw png with a number of frames as suffix //fromstream (load) will take the png and the two dimension arguments, and the dir structure from stream //save will save as .dir public static new DirSheet Import(string path) { string fileName = Path.GetFileNameWithoutExtension(path); string[] components = fileName.Split('.'); int frames = 0; if (Int32.TryParse(components[components.Length - 1], out frames)) { using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read)) { Texture2D tex = Texture2D.FromStream(device, fileStream); return(new DirSheet(tex, tex.Width / frames, tex.Height, RotateType.None)); } } else { RotateType dirs = (RotateType)Enum.Parse(typeof(RotateType), components[components.Length - 1]); int div = 0; switch (dirs) { case RotateType.Dir2: div = 2; break; case RotateType.Dir5: div = 5; break; case RotateType.Dir8: div = 8; break; default: div = 1; break; } using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read)) { Texture2D tex = Texture2D.FromStream(device, fileStream); int tileWidth = tex.Height / div; return(new DirSheet(tex, tileWidth, tileWidth, dirs)); } } }
public static new DirSheet Load(BinaryReader reader) { long length = reader.ReadInt64(); Texture2D tex = null; using (MemoryStream ms = new MemoryStream()) { ms.Write(reader.ReadBytes((int)length), 0, (int)length); ms.Position = 0; tex = Texture2D.FromStream(device, ms); } int tileWidth = reader.ReadInt32(); int tileHeight = reader.ReadInt32(); RotateType dirs = (RotateType)reader.ReadInt32(); return(new DirSheet(tex, tileWidth, tileHeight, dirs)); }
public void ImageShouldFlip(RotateType rotateType, FlipType flipType, ushort orientation) { string path = this.CreateOutputDirectory("AutoOrient"); TestFile file = TestFile.Create(TestImages.Bmp.F); using (Image image = file.CreateImage()) { image.MetaData.ExifProfile = new ExifProfile(); image.MetaData.ExifProfile.SetValue(ExifTag.Orientation, orientation); using (FileStream before = File.OpenWrite($"{path}/before-{file.FileName}")) using (FileStream after = File.OpenWrite($"{path}/after-{file.FileName}")) { image.RotateFlip(rotateType, flipType).Save(before).AutoOrient().Save(after); } } }
private void RotateWoodLog() { float tmpDurStart = tmpTime / durationStart; float tmpDurStop = tmpTime / durationStop; tmpTime += Time.deltaTime; if (tmpTime < durationStart & RotType == RotateType.startRotate) { transform.Rotate(Vector3.forward * Time.deltaTime * speedRotation * Mathf.SmoothStep(0, 1, tmpDurStart)); } else if (RotType == RotateType.startRotate) { RotType = RotateType.constRotate; tmpTime = 0; } if (tmpTime < durationRotate & RotType == RotateType.constRotate) { transform.Rotate(Vector3.forward * Time.deltaTime * speedRotation); } else if (RotType == RotateType.constRotate) { RotType = RotateType.stopRotate; tmpTime = 0; } if (tmpTime < durationStop & RotType == RotateType.stopRotate) { transform.Rotate(Vector3.forward * Time.deltaTime * speedRotation * Mathf.SmoothStep(1, 0, tmpDurStop)); } else if (RotType == RotateType.stopRotate) { RotType = RotateType.startRotate; tmpTime = 0; float random = Random.value; if (chanceChangeDirRot / 100 >= random) { speedRotation *= -1; } } }
void Mode_Changed(object sender, SelectionChangedEventArgs e) { RotateType selected = (RotateType)RotateMode.SelectedIndex; if (_rotate.Mode != selected) { RotateType u = _rotate.Mode; RotateType r = selected; List <int> path = Track.GetPath(_rotate); Program.Project.Undo.Add($"Rotate Angle Changed to {((ComboBoxItem)RotateMode.ItemContainerGenerator.ContainerFromIndex((int)r)).Content}", () => { ((Rotate)Track.TraversePath(path)).Mode = u; }, () => { ((Rotate)Track.TraversePath(path)).Mode = r; }); _rotate.Mode = selected; } }
public void StartRotate(int type) { RotateType rotateType = RotateType.None; try { rotateType = (RotateType)type; mRotateType = rotateType; Set(rotateType); } catch (Exception) { Debug.LogError("Error int type : " + type); del_playRotate = null; } }
virtual public void OnEnter(PlayerState lastState) { m_rotateTo = RotateTo.eNone; m_rotateType = RotateType.eDirect; m_speed = IM.Vector3.zero; m_accelerate = IM.Vector3.zero; m_turningSpeed = IM.Number.zero; m_bMoveForward = true; m_playbackSpeed = IM.Number.one; m_curExecSkill = m_player.m_toSkillInstance; if (m_curExecSkill != null) { m_player.m_stamina.ConsumeStamina(new IM.Number((int)m_curExecSkill.skill.levels[m_curExecSkill.level].stama)); } m_time = IM.Number.zero; }
void rotateComplete(RotateType rotateType) { rotationContainer.transform.DetachChildren(); rotationContainer.transform.localEulerAngles = Vector3.zero; roundCubePositions(); if (rotateType == RotateType.Shuffle) { shuffle(); } else { if (hasWon()) { startGameWonAnimation(); } SaveGameState(); } isCubeRotating = false; }
public void rotate(RotateType type) { RotateFlipType rotateFlipType = RotateFlipType.RotateNoneFlipNone; switch (type) { case RotateType.Clockwise: rotateFlipType = RotateFlipType.Rotate90FlipNone; break; case RotateType.Counter_Clockwise: rotateFlipType = RotateFlipType.Rotate270FlipNone; break; } int tmp = width; width = height; height = tmp; img.RotateFlip(rotateFlipType); }
IEnumerator Cor() { yield return(new WaitForEndOfFrame()); RotType = RotateType.startRotate; posOnWood = new List <Vector3>(); CreateSpawnPoints(); if (Random.value < chanceSpawnApple / 100) { SpawnObjOnWood(applePrefab, numApple); } if (Random.value < chanceSpawnKnife / 100) { SpawnObjOnWood(knifePrefab, numKnife); } }
void RotateEnemy(RotateType rotateType, float dRotate, float velocityX) { float dirX = 0; switch (rotateType) { case RotateType.Player: { dirX = GameManager.player.transform.position.x - transform.position.x; } break; case RotateType.MoveDir: { dirX = velocityX; } break; case RotateType.Mouse: { Vector2 difference = GameInput.GetDirToMouse(transform.position); float rotZ = difference == Vector2.zero ? 0 : Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg; transform.localRotation = Quaternion.Euler(0f, 0f, (difference.x >= 0 ? rotZ : 180f - rotZ) * transform.up.y); } break; case RotateType.MouseX: { dirX = GameInput.GetDirToMouse(transform.position).x; } break; case RotateType.Linear: { transform.Rotate(0, 0, dRotate * Time.deltaTime); } break; } if (dirX != 0 && Mathf.Sign(dirX) != Mathf.Sign(transform.right.x)) { transform.Rotate(0, 180, 0); } }
private BitmapLayer RotateLayer(BitmapLayer layer, RotateType rotationType, int width, int height) { Surface surface = RetryManager.RunMemorySensitiveOperation <Surface>(() => new Surface(width, height)); if (rotationType == RotateType.Rotate180) { Parallel.For(0, height, delegate(int y) { for (int j = 0; j < width; j++) { surface[j, y] = layer.Surface[(width - j) - 1, (height - y) - 1]; } }); } else if (rotationType == RotateType.CounterClockwise90) { Parallel.For(0, height, delegate(int y) { for (int k = 0; k < width; k++) { surface[k, y] = layer.Surface[(height - y) - 1, k]; } }); } else if (rotationType == RotateType.Clockwise90) { Parallel.For(0, height, delegate(int y) { for (int m = 0; m < width; m++) { surface[m, y] = layer.Surface[y, (width - 1) - m]; } }); } BitmapLayer layer2 = new BitmapLayer(surface, true); layer2.LoadProperties(layer.SaveProperties()); return(layer2); }
/// <summary> /// Rotates and flips an image by the given instructions. /// </summary> /// <typeparam name="TColor">The pixel format.</typeparam> /// <param name="source">The image to rotate, flip, or both.</param> /// <param name="rotateType">The <see cref="RotateType"/> to perform the rotation.</param> /// <param name="flipType">The <see cref="FlipType"/> to perform the flip.</param> /// <returns>The <see cref="Image"/></returns> public static Image <TColor> RotateFlip <TColor>(this Image <TColor> source, RotateType rotateType, FlipType flipType) where TColor : struct, IPixel <TColor> { return(source.Rotate(rotateType).Flip(flipType)); }
public FluentImage Right(RotateType rotateType) { return this.Right((int)rotateType); }
public FluentImage Left(RotateType rotateType) { return this.Left((int)rotateType); }
/// <summary> /// Rotates and flips an image by the given instructions. /// </summary> /// <param name="source">The image to resize.</param> /// <param name="rotateType">The <see cref="RotateType"/> to perform the rotation.</param> /// <param name="flipType">The <see cref="FlipType"/> to perform the flip.</param> /// <param name="progressHandler">A delegate which is called as progress is made processing the image.</param> /// <returns>The <see cref="Image"/></returns> public static Image RotateFlip(this Image source, RotateType rotateType, FlipType flipType, ProgressEventHandler progressHandler = null) { RotateFlip processor = new RotateFlip(rotateType, flipType); processor.OnProgress += progressHandler; try { return source.Process(source.Width, source.Height, source.Bounds, source.Bounds, processor); } finally { processor.OnProgress -= progressHandler; } }
public FocusImg Flip(RotateType type) { FocusImg rotateImg = new FocusImg(m_width, m_height); for (int y = 0; y < m_height; y++) { for (int x = 0; x < m_width; x++) { switch (type) { case RotateType.FlipX: rotateImg[x, y] = this[m_width-x-1, y]; break; case RotateType.FlipY: rotateImg[x, y] = this[x, m_height-y-1]; break; case RotateType.FlipXY: rotateImg[x, y] = this[m_width-x-1, m_height-y-1]; break; default: break; } } } return rotateImg; }
private Rectangle Rotate(Rectangle r, RotateType type) { if (type == RotateType.None || type == RotateType.Half) return r; var offset = r.Size.Height / 2 - r.Size.Width / 2; return new Rectangle( r.Location.X - offset, r.Location.Y + offset, r.Size.Height, r.Size.Width ); }
/// <summary> /// Rotates and flips an image by the given instructions. /// </summary> /// <typeparam name="TColor">The pixel format.</typeparam> /// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam> /// <param name="source">The image to rotate, flip, or both.</param> /// <param name="rotateType">The <see cref="RotateType"/> to perform the rotation.</param> /// <param name="flipType">The <see cref="FlipType"/> to perform the flip.</param> /// <returns>The <see cref="Image"/></returns> public static Image <TColor, TPacked> RotateFlip <TColor, TPacked>(this Image <TColor, TPacked> source, RotateType rotateType, FlipType flipType) where TColor : struct, IPackedPixel <TPacked> where TPacked : struct, IEquatable <TPacked> { return(source.Rotate(rotateType).Flip(flipType)); }
private BitmapLayer RotateLayer(BitmapLayer layer, RotateType rotationType, int width, int height, double startProgress, double endProgress) { Surface surface = new Surface(width, height); if (rotationType == RotateType.Clockwise180 || rotationType == RotateType.CounterClockwise180) { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { surface[x, y] = layer.Surface[width - x - 1, height - y - 1]; } OnProgress(((double)y / (double)height) * (endProgress - startProgress) + startProgress); } } else if (rotationType == RotateType.Clockwise270 || rotationType == RotateType.CounterClockwise90) { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { surface[x, y] = layer.Surface[height - y - 1, x]; } OnProgress(((double)y / (double)height) * (endProgress - startProgress) + startProgress); } } else if (rotationType == RotateType.Clockwise90 || rotationType == RotateType.CounterClockwise270) { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { surface[x, y] = layer.Surface[y, width - 1 - x]; } OnProgress(((double)y / (double)height) * (endProgress - startProgress) + startProgress); } } BitmapLayer returnMe = new BitmapLayer(surface, true); returnMe.LoadProperties(layer.SaveProperties()); return returnMe; }
private void RotateCamera(RotateType rotateType) { if (isRotating) { return; } Vector3 nextEulerAngles = new Vector3(); switch (rotateType) { case RotateType.Left: nextEulerAngles.y = transform.eulerAngles.y + (-90); break; case RotateType.Right: nextEulerAngles.y = transform.eulerAngles.y + 90; break; } SoundManager.instance.PlaySound(3); isRotating = true; Hashtable args = new Hashtable(); args["rotation"] = nextEulerAngles; args["time"] = rotateTime; args["oncomplete"] = "OnCompleteRotateCamera"; iTween.RotateTo(gameObject, args); }
public TfRotate(RotateType type) { Name = "Rotate"; _rotate = type; }
private void DefineLocations(PlayerHand hand) { int yLoc = Location.Y + Size.Height - Card.DEFAULTCARDSIZE.Height; int xSpacing = (Size.Width - Card.DEFAULTCARDSIZE.Width * 4) / 3 + Card.DEFAULTCARDSIZE.Width; hand.Membership.Location = new Point(Location.X, yLoc); hand.Role.Location = new Point(Location.X + xSpacing, yLoc); hand.Yes.Location = new Point(Location.X + xSpacing * 2, yLoc); hand.No.Location = new Point(Location.X + xSpacing * 3, yLoc); CurrentPlacardLoc = new Point(Location.X, Location.Y); PreviousPlacardLoc = new Point(Location.X + Size.Width - Placard.DEFAULTSIZE.Width, Location.Y); if (ID <= 3) rotateType = RotateType.None; else if (ID <= 7) rotateType = RotateType.Half; else if (ID == 8) rotateType = RotateType.Left; else //9 rotateType = RotateType.Right; }
private int Angle(RotateType type, bool reverse = false) => rotateType == RotateType.None ? 0 : (rotateType == RotateType.Left ? (reverse ? 270 : 90) : (rotateType == RotateType.Half ? 180 : (reverse ? 90 : 270)));
// TODO: because of ProgressDialog's incorrect code, ActionFlags.Cancellable doesn't work right // fix this post-3.0. it is not a priority right now because this is the only action that // uses this flag right now. public RotateDocumentFunction(RotateType rotation) : base(ActionFlags.ReportsProgress /*| ActionFlags.Cancellable*/) { this.rotation = rotation; }
public FocusImg GetImgByRect(Rectangle rect, RotateType rotateType = RotateType.FlipNone) { Rectangle srcRect = new Rectangle(0, 0, m_width, m_height); if (srcRect.Contains(rect)) { FocusImg dstImg = new FocusImg(rect.Width, rect.Height); int index = 0; for (int j=rect.Top; j<rect.Bottom; j++) { for (int i=rect.Left; i<rect.Right; i++) { dstImg.ImgData[index++] = m_imgData[j * m_stride + i]; //this[,] } index += dstImg.m_stride-dstImg.m_width; } return dstImg; } else { throw new Exception("FocusImg访问越界"); } }
/// <summary> /// Rotates and flips an image by the given instructions. /// </summary> /// <typeparam name="TColor">The pixel format.</typeparam> /// <param name="source">The image to rotate.</param> /// <param name="rotateType">The <see cref="RotateType"/> to perform the rotation.</param> /// <returns>The <see cref="Image"/></returns> public static Image <TColor> Rotate <TColor>(this Image <TColor> source, RotateType rotateType) where TColor : struct, IPixel <TColor> { return(Rotate(source, (float)rotateType, false)); }
/// <summary> /// Rotates the source image prior to processing (only 90 degree intervals) /// </summary> /// <param name="rotateType">The type of rotation to perform</param> public TransformExpression Rotate(RotateType rotateType) { builder.SetParameter(TransformCommands.RotateInterval, ((int)rotateType).ToString()); return this; }