本文整理汇总了C#中CALayer类的典型用法代码示例。如果您正苦于以下问题:C# CALayer类的具体用法?C# CALayer怎么用?C# CALayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CALayer类属于命名空间,在下文中一共展示了CALayer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
TKChart chart = new TKChart (this.View.Bounds);
chart.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
this.View.AddSubview (chart);
string[] months = new string[]{ "Jan", "Feb", "Mar", "Apr", "May", "Jun" };
int[] values = new int[]{ 95, 40, 55, 30, 76, 34 };
List<TKChartDataPoint> list = new List<TKChartDataPoint> ();
for (int i = 0; i < months.Length; i++) {
list.Add (new TKChartDataPoint(new NSString(months[i]), new NSNumber(values[i])));
}
chart.AddSeries (new TKChartAreaSeries (list.ToArray()));
CALayer layer = new CALayer ();
layer.Bounds = new RectangleF (0, 0, 100, 100);
layer.BackgroundColor = new UIColor(1, 0, 0, 0.6f).CGColor;
layer.ShadowRadius = 10;
layer.ShadowColor = UIColor.Yellow.CGColor;
layer.ShadowOpacity = 1;
layer.CornerRadius = 10;
TKChartLayerAnnotation a = new TKChartLayerAnnotation(layer, new NSString("Mar"), new NSNumber(80), chart.Series[0]);
a.ZPosition = TKChartAnnotationZPosition.AboveSeries;
chart.AddAnnotation(a);
}
开发者ID:tremors,项目名称:ios-sdk,代码行数:29,代码来源:LayerAnnotation.cs
示例2: OuterShadow
public OuterShadow(CALayer targetLayer, SizeF frameSize, float shadowDepth)
{
this.targetLayer = targetLayer;
FrameSize = frameSize;
ShadowDepth = shadowDepth;
shadows[Edge.Top] = shadows[Edge.Right] = shadows[Edge.Bottom] = shadows[Edge.Left] = null;
}
开发者ID:abeiderman,项目名称:FrozenHeadersGrid_MonoTouch,代码行数:7,代码来源:OuterShadow.cs
示例3: Draw
public static void Draw(CALayer target, IViewport viewport, IStyle style, IFeature feature)
{
const string styleKey = "laag";
if(feature[styleKey] == null) feature[styleKey] = ToiOSBitmap(feature.Geometry);
var bitmap = (UIImage)feature [styleKey];
var dest = WorldToScreen(viewport, feature.Geometry.GetBoundingBox());
dest = new BoundingBox(
dest.MinX,
dest.MinY,
dest.MaxX,
dest.MaxY);
var destination = RoundToPixel(dest);
var tile = new CALayer
{
Frame = destination,
Contents = bitmap.CGImage,
};
target.AddSublayer(tile);
}
开发者ID:jdeksup,项目名称:Mapsui.Net4,代码行数:25,代码来源:RasterRenderer.cs
示例4: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
sessionManager = new SessionManager ();
sessionManager.StartRunning ();
previewLayer = new AVCaptureVideoPreviewLayer (sessionManager.CaptureSession) {
Frame = previewView.Bounds,
VideoGravity = AVLayerVideoGravity.ResizeAspectFill
};
if (previewLayer.Connection != null && previewLayer.Connection.SupportsVideoOrientation)
previewLayer.Connection.VideoOrientation = AVCaptureVideoOrientation.LandscapeLeft;
previewView.Layer.AddSublayer (previewLayer);
previewView.Layer.MasksToBounds = true;
barcodeTargetLayer = new CALayer () {
Frame = View.Layer.Bounds
};
View.Layer.AddSublayer (barcodeTargetLayer);
synth = new Synth ();
synth.LoadPreset (this);
// the loop that continuously looks for barcodes to detect
stepTimer = NSTimer.CreateScheduledTimer (0.15, this, new Selector ("step:"), null, true);
}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:28,代码来源:ReceiveViewController.cs
示例5: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
sessionManager = new SessionManager ();
sessionManager.StartRunning ();
previewLayer = new AVCaptureVideoPreviewLayer (sessionManager.CaptureSession) {
Frame = previewView.Bounds,
VideoGravity = AVLayerVideoGravity.ResizeAspectFill
};
if (previewLayer.Connection != null && previewLayer.Connection.SupportsVideoOrientation)
previewLayer.Connection.VideoOrientation = AVCaptureVideoOrientation.LandscapeLeft;
previewView.Layer.AddSublayer (previewLayer);
previewView.Layer.MasksToBounds = true;
barcodeTargetLayer = new CALayer () {
Frame = View.Layer.Bounds
};
View.Layer.AddSublayer (barcodeTargetLayer);
synth = new Synth ();
synth.LoadPreset (this);
}
开发者ID:g7steve,项目名称:monotouch-samples,代码行数:25,代码来源:ReceiveViewController.cs
示例6: PositionMultiPolygon
public static void PositionMultiPolygon(CALayer shape, MultiPolygon multiPolygon, IStyle style, IViewport viewport)
{
var shapeLayer = shape as CAShapeLayer;
var path = multiPolygon.ToUIKit(viewport);
//var frame = ConvertBoundingBox (multiPolygon.GetBoundingBox(), viewport);
shapeLayer.Path = path.CGPath;
//shape.Frame = frame;
/*
if (viewport.Resolution > MinResolution || viewport.Resolution < MaxResolution) {
//recalculate
var newImage = RenderMultiPolygonOnLayer (multiPolygon, style, viewport);
shape.Contents = newImage.Contents;
shape.Frame = newImage.Frame;
var resolution = ZoomHelper.ClipResolutionToExtremes (Resolutions, viewport.Resolution);
MinResolution = ZoomHelper.ZoomOut (Resolutions, resolution);
MaxResolution = ZoomHelper.ZoomIn (Resolutions, resolution);
} else {
//reposition Geometry
var frame = ConvertBoundingBox (multiPolygon.GetBoundingBox(), viewport);
var newFrame = new RectangleF (frame.X, (frame.Y), frame.Width, frame.Height);
shape.Frame = newFrame;
//shape.Frame = frame;
}
*/
}
开发者ID:pauldendulk,项目名称:Mapsui,代码行数:30,代码来源:GeometryRenderer.cs
示例7: OnElementChanged
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{
base.OnElementChanged(e);
if (e.NewElement != null && !isInitialized)
{
var formsEntry = e.NewElement as LoginEntry;
formsEntry.FontFamily = "SegoeUI-Light";
formsEntry.TextColor = Color.FromHex("#778687");
formsEntry.FontSize = 18;
nativeTextField = Control as UITextField;
nativeTextField.BorderStyle = UITextBorderStyle.None;
//Figure out how to reference font from Resources as Embedded Resource
if (!String.IsNullOrEmpty(formsEntry.Placeholder))
nativeTextField.AttributedPlaceholder = new NSAttributedString(formsEntry.Placeholder, UIFont.FromName("SegoeUI-Light", 18), Color.FromHex("#778687").ToUIColor());
bottomBorder = new CALayer();
bottomBorder.BackgroundColor = Color.FromHex("#778687").ToCGColor();
Control.Layer.AddSublayer(bottomBorder);
isInitialized = true;
}
}
开发者ID:xamarin,项目名称:mini-hacks,代码行数:25,代码来源:LoginEntryRenderer.cs
示例8: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
View.BackgroundColor = UIColor.White;
View.UserInteractionEnabled = true;
layer = new CALayer {
Bounds = new CGRect (0, 0, 50, 50),
Position = new CGPoint (50, 50),
Contents = UIImage.FromFile ("monkey2.png").CGImage,
ContentsGravity = CALayer.GravityResize,
BorderWidth = 1.5f,
BorderColor = UIColor.Green.CGColor
};
View.Layer.AddSublayer (layer);
View.AddGestureRecognizer (new UITapGestureRecognizer (() => {
ViewController initalViewController = (ViewController)MainStoryboard.InstantiateViewController("InitalViewController");
initalViewController.ModalTransitionStyle = UIModalTransitionStyle.FlipHorizontal;
PresentViewController(initalViewController, true, null);
}));
}
开发者ID:ctsxamarintraining,项目名称:Xamarin,代码行数:25,代码来源:ExplicitLayerAnimation.cs
示例9: AddBorder
public static void AddBorder(this UIView view, UIRectEdge edge, UIColor color, nfloat thickness) {
var border = new CALayer ();
var f = view.Frame;
switch(edge)
{
case UIRectEdge.Top:
border.Frame = new CGRect(0, 0, f.Width, thickness);
break;
case UIRectEdge.Bottom:
border.Frame = new CGRect (0, f.Height - thickness, f.Width, thickness);
break;
case UIRectEdge.Left:
border.Frame = new CGRect(0, 0, thickness, f.Height);
break;
case UIRectEdge.Right:
border.Frame = new CGRect(f.Width - thickness, 0, thickness, f.Height);
break;
default:
break;
}
border.BackgroundColor = color.CGColor;
view.Layer.AddSublayer (border);
}
开发者ID:ddomengeaux,项目名称:xamarin-amccorma,代码行数:25,代码来源:UIViewExtensions.cs
示例10: ShimmeringMaskLayer
public ShimmeringMaskLayer()
{
FadeLayer = new CALayer();
FadeLayer.BackgroundColor = UIColor.White.CGColor;
AddSublayer(FadeLayer);
RemoveAllAnimations();
}
开发者ID:cyecp,项目名称:XamarinComponents,代码行数:8,代码来源:ShimmeringMaskLayer.cs
示例11: Clone
public override void Clone (CALayer other)
{
CircleLayer o = (CircleLayer) other;
Radius = o.Radius;
Color = o.Color;
Thickness = o.Thickness;
base.Clone (other);
}
开发者ID:robertgreen,项目名称:monotouch-samples,代码行数:8,代码来源:AppDelegate.cs
示例12: AwakeFromNib
public override void AwakeFromNib()
{
base.AwakeFromNib();
View.Layer = new CALayer();
View.WantsLayer = true;
textContainer = new CALayer();
textContainer.AnchorPoint = CGPoint.Empty;
textContainer.Position = new CGPoint(10, 10);
textContainer.ZPosition = 100;
textContainer.BackgroundColor = NSColor.Black.CGColor;
textContainer.BorderColor = NSColor.White.CGColor;
textContainer.BorderWidth = 2;
textContainer.CornerRadius = 15;
textContainer.ShadowOpacity = 0.5f;
View.Layer.AddSublayer(textContainer);
textLayer = new CATextLayer();
textLayer.AnchorPoint = CGPoint.Empty;
textLayer.Position = new CGPoint(10, 6);
textLayer.ZPosition = 100;
textLayer.FontSize = 24;
textLayer.ForegroundColor = NSColor.White.CGColor;
textContainer.AddSublayer(textLayer);
// Rely on setText: to set the above layers' bounds: [self setText:@"Loading..."];
SetText("Loading...", textLayer);
var dirs = NSSearchPath.GetDirectories(NSSearchPathDirectory.LibraryDirectory, NSSearchPathDomain.Local);
foreach (string dir in dirs) {
Console.WriteLine("Dir: {0}", dir);
}
string libDir = dirs[0];
string desktopPicturesDir = Path.Combine(libDir, "Desktop Pictures");
Console.WriteLine("DP Dir: {0}", desktopPicturesDir);
// Launch loading of images on background thread
Task.Run(async () => {
await AddImagesFromFolderUrlAsync(desktopPicturesDir);
});
repositionButton.Layer.ZPosition = 100;
durationTextField.Layer.ZPosition = 100;
lastWindowSize = Window.Frame.Size;
Window.DidResize += (sender, e) => {
if (Math.Abs(lastWindowSize.Width - Window.Frame.Width) > 25 || Math.Abs(lastWindowSize.Height - Window.Frame.Height) > 25) {
windowIsResizing = true;
repositionImages(repositionButton);
lastWindowSize = Window.Frame.Size;
windowIsResizing = false;
}
};
}
开发者ID:yingfangdu,项目名称:BNR,代码行数:57,代码来源:MainWindowController.cs
示例13: Clone
public override void Clone(CALayer other)
{
RoundProgressLayer o = (RoundProgressLayer) other;
Progress = o.Progress;
StartAngle = o.StartAngle;
TintColor = o.TintColor;
TrackColor = o.TrackColor;
base.Clone (other);
}
开发者ID:martinbowling,项目名称:MonoTouchRoundProgress,代码行数:9,代码来源:RoundProgressLayer.cs
示例14: MaskImageWithImage
private void MaskImageWithImage(UIImageView imgView, UIImage maskImage)
{
var aMaskLayer = new CALayer();
aMaskLayer.Frame = new CGRect(0, 0, imgView.Image.Size.Width, imgView.Image.Size.Height);
aMaskLayer.Contents = maskImage.CGImage;
imgView.Layer.Mask = aMaskLayer;
}
开发者ID:Manne990,项目名称:XamTest,代码行数:9,代码来源:CircularProgressViewRenderer.cs
示例15: RenderStackedLabelLayer
public static List<IFeature> RenderStackedLabelLayer(IViewport viewport, BasicLayer layer)
{
lock(_syncRoot)
{
var renderedFeatures = new List<IFeature> ();
var canvas = new CALayer ();
canvas.Opacity = (float)layer.Opacity;
//todo: take into account the priority
var features = layer.GetFeaturesInView (viewport.Extent, viewport.Resolution);
var margin = viewport.Resolution * 15;
var clusters = new List<Cluster> ();
//todo: repeat until there are no more merges
ClusterFeatures (clusters, features, margin, null, viewport, viewport.Resolution);
//CenterClusters (clusters);
//CATransaction.Begin();
//CATransaction.SetValueForKey (MonoTouch.Foundation.NSNumber.FromBoolean(true), CATransaction.DisableActionsKey);
foreach(var cluster in clusters){
var feature = cluster.Features.OrderBy(f => f.Geometry.GetBoundingBox().GetCentroid().Y).FirstOrDefault();
//SetFeatureOutline (feature, layer.LayerName, cluster.Features.Count);
//var bb = RenderBox(cluster.Box, viewport);
//Zorg dat dit ALTIJD decimal zelfde ISet als ViewChanged is
//var feature = cluster.Features.FirstOrDefault ();
var styles = feature.Styles ?? Enumerable.Empty<IStyle>();
foreach (var style in styles)
{
if (feature.Styles != null && style.Enabled)
{
var styleKey = layer.LayerName; //feature.GetHashCode ().ToString ();
var renderedGeometry = (feature[styleKey] != null) ? (CALayer)feature[styleKey] : null;
if (renderedGeometry == null) {
renderedGeometry = GeometryRenderer.RenderPoint (feature.Geometry as Mapsui.Geometries.Point, style, viewport);
feature [styleKey] = renderedGeometry;
feature ["first"] = true;
} else {
feature ["first"] = false;
}
}
}
renderedFeatures.Add (feature);
//renderedFeatures.Add (bb);
}
return renderedFeatures;
}
}
开发者ID:jdeksup,项目名称:Mapsui.Net4,代码行数:56,代码来源:SymbolRenderer.cs
示例16: SetupLayers
private CALayer SetupLayers()
{
backgroundLayer = SetupBackgroundLayer ();
backgroundLayer.AddSublayer (SetupClockFaceLayer ());
backgroundLayer.AddSublayer (SetupBorderLayer ());
backgroundLayer.AddSublayer (SetupGlossyLayer ());
return backgroundLayer;
}
开发者ID:RangoLee,项目名称:mac-samples,代码行数:10,代码来源:ClockView.cs
示例17: SourceView
public SourceView (CGRect r) : base (r)
{
// Set the background color of the view to Red
var layer = new CALayer {
BackgroundColor = new CGColor (1f, 0f, 0f)
};
WantsLayer = true;
Layer = layer;
}
开发者ID:RangoLee,项目名称:mac-samples,代码行数:10,代码来源:SourceView.cs
示例18: ConfigLayerHighRes
internal static void ConfigLayerHighRes(CALayer layer)
{
if (!HighRes)
return;
if (sscale == null)
sscale = new Selector ("setContentsScale:");
Messaging.void_objc_msgSend_float (layer.Handle, sscale.Handle, 2.0f);
}
开发者ID:Clancey,项目名称:WcfTestSuite,代码行数:10,代码来源:Graphics.cs
示例19: DestView
public DestView (CGRect r) : base (r)
{
// Set the background color of this view to Green
var layer = new CALayer {
BackgroundColor = new CGColor (0f, 1f, 0f)
};
WantsLayer = true;
Layer = layer;
}
开发者ID:RangoLee,项目名称:mac-samples,代码行数:11,代码来源:DestView.cs
示例20: DrawBorder
void DrawBorder (MyEntry view)
{
var borderLayer = new CALayer ();
borderLayer.MasksToBounds = true;
borderLayer.Frame = new CoreGraphics.CGRect (0f, Frame.Height / 2, Frame.Width, 1f);
borderLayer.BorderColor = view.BorderColor.ToCGColor ();
borderLayer.BorderWidth = 1.0f;
Control.Layer.AddSublayer (borderLayer);
Control.BorderStyle = UITextBorderStyle.None;
}
开发者ID:kabsila,项目名称:HomezigXaml,代码行数:11,代码来源:MyEntryRenderer.cs
注:本文中的CALayer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论