Example #1
0
        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;
        }
Example #2
0
 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);
 }
Example #3
0
        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);
        }
Example #4
0
 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);
 }
Example #5
0
 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();
 }
Example #6
0
 public Font(Context ctx, string name, Stream stream) {
     Init(ctx, name, stream);
 }
Example #7
0
 public Font(Context ctx, string name, string fileName) {
     using (var fs = File.OpenRead(fileName)) {
         Init(ctx, name, fs);
     }
 }
Example #8
0
        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);
        }
Example #9
0
        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));
        }
Example #10
0
 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;
 }
Example #11
0
 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;
 }