public FrameContext(OverlayContext ctx, OverlayInfo info) { this.ctx = ctx; Info = info; Source = ctx.Source; Overlay = ctx.Overlay; SourceSize = ctx.SourceInfo.Size; OverlaySize = ctx.OverlayInfo.Size; Info = Info.Resize(SourceSize, OverlaySize); if (ctx.Render.Mode == FramingMode.Fit && SourceSize != ctx.TargetInfo.Size) { Info = Info.Resize(ctx.TargetInfo.Size, OverlaySize); Source = Source.Invoke(SourceSize.GetArea() < ctx.TargetInfo.Size.GetArea() ? ctx.Render.Upsize : ctx.Render.Downsize, ctx.TargetInfo.Width, ctx.TargetInfo.Height); SourceSize = ctx.TargetInfo.Size; } if (ctx.Render.Mode == FramingMode.Fit) { Info = Info.Shrink(SourceSize, OverlaySize); } var resizeFunc = Info.Width > OverlaySize.Width ? ctx.Render.Upsize : ctx.Render.Downsize; var crop = Info.GetCrop(); Overlay = ctx.Render.ResizeRotate(Overlay, resizeFunc, null, Info.Width, Info.Height, 0, crop, Info.Warp); OverlayMask = ctx.Render.ResizeRotate(ctx.OverlayMask, "BicubicResize", null, Info.Width, Info.Height, 0, crop, Info.Warp); InitColorAdjust(); }
public Sprite(string filename, Frame frame, SpriteSourceSize spriteSourceSize, SourceSize sourceSize) { this.filename = filename; this.frame = frame; this.rotated = false; this.trimmed = false; this.spriteSourceSize = spriteSourceSize; this.sourceSize = sourceSize; if (this.spriteSourceSize.w != this.sourceSize.w && this.spriteSourceSize.h != this.sourceSize.h) { this.trimmed = true; } }