예제 #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;
        }
예제 #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);
 }
예제 #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);
        }
예제 #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);
 }
예제 #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();
 }
예제 #6
0
 public Font(Context ctx, string name, Stream stream) {
     Init(ctx, name, stream);
 }
예제 #7
0
 public Font(Context ctx, string name, string fileName) {
     using (var fs = File.OpenRead(fileName)) {
         Init(ctx, name, fs);
     }
 }
예제 #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);
        }
예제 #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));
        }
예제 #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;
 }
예제 #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;
 }