public void BoxGradient(Context ctx, float x, float y, float width, float height, float radius, float feather, Color4 innerColor, Color4 outerColor) { Set(nvgBoxGradient(ctx.ctx, x, y, width, height, radius, feather, innerColor, outerColor)); InnerColor = innerColor; OuterColor = outerColor; }
public Image(Context ctx, string filename, ImageFlags flags) { ID = nvgCreateImage(ctx.ctx, filename, (int)flags); int w, h; nvgImageSize(ctx.ctx, ID, out w, out h); Width = w; Height = h; Console.WriteLine("Image Width: {0} Height: {1}", w, h); }
void Init(Context ctx, string name, Stream stream) { int length = (int)stream.Length; stream.Seek(0, SeekOrigin.Begin); byte[] buffer = new byte[length]; stream.Read(buffer, 0, (int)stream.Length); GCHandle handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); IntPtr ptr = handle.AddrOfPinnedObject(); ID = nvgCreateFontMem(ctx.ctx, name, ptr, length, 0); handle.Free(); map.Add(name, this); map2.Add(ID, this); }
void Init(Context ctx, int w, int h, IntPtr data, ImageFlags flags){ Context = ctx; Width = w; Height = h; ID = nvgCreateImageRGBA(ctx.ctx, w, h, (int)flags, data); }
public Image(Context ctx, int w, int h, byte[] data, ImageFlags flags) { GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned); Init(ctx, w, h, handle.AddrOfPinnedObject(), flags); handle.Free(); }
public Font(Context ctx, string name, Stream stream) { Init(ctx, name, stream); }
public Font(Context ctx, string name, string fileName) { using (var fs = File.OpenRead(fileName)) { Init(ctx, name, fs); } }
public void ImagePattern(Context ctx, float x, float y, Image image, float angle, float alpha) { ImagePattern(ctx, x, y, image.Width, image.Height, angle, image.ID, alpha); }
public void ImagePattern(Context ctx, float x, float y, float width, float height, float angle, int imageHandle, float alpha) { Set(nvgImagePattern(ctx.ctx, x, y, width, height, angle, imageHandle, alpha)); }
public void RadialGradient(Context ctx, float x, float y, float innerRadius, float outerRadius, Color4 innerColor, Color4 outerColor) { Set(nvgRadialGradient(ctx.ctx, x, y, innerRadius, outerRadius, innerColor, outerColor)); InnerColor = innerColor; OuterColor = outerColor; }
public void LinearGradient(Context ctx, float startX, float startY, float endX, float endY, Color4 startColor, Color4 endColor) { Set(nvgLinearGradient(ctx.ctx, startX, startY, endX, endY, startColor, endColor)); InnerColor = startColor; OuterColor = endColor; }