Example #1
0
        /// <summary>
        /// This method is called when the sprite is told to draw
        /// itself on the window.
        /// </summary>
        public override void Render(
			Drawable dest,
			GC gc)
        {
            // Draw it out
            drawable.Render(dest, gc, state);
        }
Example #2
0
    public Sprite (float dx, float dy, int color, int width, int height,
      Picture.Format pf) {
      
      x = window.width/2;
      y = window.height/2;
      this.dx = dx;
      this.dy = dy;
      this.color = color;
      this.width = width;
      this.height = height;

      pixmap = new Pixmap (display.default_root, width, height, 
        pf.depth ());
      picture = render.create_picture (pixmap, pf,
        Picture.Attributes.EMPTY); 

      if (sprite_gc == null)
        sprite_gc = new GC (pixmap);      
    
      sprite_gc.set_foreground (0);
      pixmap.rectangle (sprite_gc, 0, 0, width, height, true);
      sprite_gc.set_foreground (color);
      pixmap.arc (sprite_gc, 0, 0, width, height, 0, 360*64, true);


      for (int i=0; i<8; i++) {
        sprite_gc.set_foreground (divide_color (color, 1<<(7-i)));
        pixmap.arc (sprite_gc, i, i, width-2*i, height-2*i, 
          0, 360*64, true);
      }
    }
Example #3
0
 // opcode 57 - copy gc
 /**
    * @see <a href="XCopyGC.html">XCopyGC</a>
    */
 public void copy(GC dest, int mask)
 {
     Request request = new Request (display, 57, 4);
     request.write4 (id);
     request.write4 (dest.id);
     request.write4 (mask);
     display.send_request (request);
 }
Example #4
0
    public void ComputationEnded(byte[] image)
    {
        GdkWindow gw = image1.GdkWindow;
        GC g = new GC(gw);

        image1.GdkWindow.DrawPoint(g,

        image1.QueueDraw();
    }
Example #5
0
        //throws gnu.x11.extension.NotFoundException {
        public Blend(String [] args)
            : base(args, 255, 255)
        {
            about ("0.1", "test blending in RENDER",
              "Stephen Tse <*****@*****.**>",
              "http://escher.sourceforge.net/");

            if (help_option) return;

            render = new Render (display);
            Picture.Format pf0 = new Picture.Format (), pf1;
            Picture.Format.Direct df = pf0.direct_format ();

            alpha_pixmap = new Pixmap (window, window.width, window.height, 8);
            color_pixmap = new Pixmap (window, 1, 1, 24);
            alpha_gc = new GC (alpha_pixmap);
            color_gc = new GC (color_pixmap);

            // window picture (TODO: find visual)
            pf0.clear ();
            pf0.set_depth (display.default_screen.root_depth ());
            pf1 = render.picture_format (pf0, true);

            window_picture = render.create_picture (window, pf1,
              Picture.Attributes.EMPTY);

            // alpha picture
            pf0.clear ();
            pf0.set_depth (8);
            pf0.set_type (Picture.Format.Direct.TYPE);
            df.set_alpha (0);
            df.set_alpha_mask (0xff);
            pf1 = render.picture_format (pf0, true);

            alpha_picture = render.create_picture (alpha_pixmap, pf1,
              Picture.Attributes.EMPTY);

            // color picture
            pf0.clear ();
            pf0.set_depth (24);
            pf0.set_type (Picture.Format.Direct.TYPE);
            df.set_alpha (0);
            df.set_alpha_mask (0);
            df.set_red (16);
            df.set_red_mask (0xff);
            df.set_green (8);
            df.set_green_mask (0xff);
            df.set_blue (0);
            df.set_blue_mask (0xff);
            pf1 = render.picture_format (pf0, true);

            Picture.Attributes attr = new Picture.Attributes ();
            attr.set_repeat (true);
            color_picture = render.create_picture (color_pixmap, pf1, attr);
        }
Example #6
0
        public PreviewRenderer(Preview preview, Layout layout, Pixmap pixmap, 
            GC gc)
        {
            _pixmap = pixmap;
              _gc = gc;

              _pw = preview.WidthRequest;
              _ph = preview.HeightRequest;

              _zoom = layout.Boundaries(_pw, _ph, out _offx, out _offy);
        }
Example #7
0
    // Use this for initialization
    void Start()
    {
        ScriptPlayer = Player.GetComponent<PlayerBehaviour>();

        var menu = GameObject.Find("Menu");
        MenuScript = menu.GetComponent<MenuBehaviour>();

        StartStage1();

        Instance = this;

    }
Example #8
0
        public Chinese(String [] args)
            : base(args, 100, 50)
        {
            about ("0.1", "test text output with chinese font",
              "Stephen Tse <*****@*****.**>",
              "http://escher.sourceforge.net/");

            if (help_option) return;

            // check if any big5 font is present
            gnu.x11.Enum fonts = display.fonts ("-*-*-*-*-*-*-*-*-*-*-*-*-big5-*", 1);
            if (fonts.count == 0)
              throw new Exception (
            "No Chinese font defined on this X server");

            GC.Values gv = new GC.Values ();
            gv.set_background (display.default_white);
            gv.set_foreground (display.default_black);
            // just pick any of those matching fonts
            gv.set_font ((gnu.x11.Font) fonts.next ());
            gc = new GC (window, gv);
        }
Example #9
0
        //throws gnu.x11.extension.NotFoundException {
        public Shape(String [] args)
            : base(args, 32, 32)
        {
            about ("0.1", "test nonrectangular window extension",
              "Stephen Tse <*****@*****.**>",
              "http://escher.sourceforge.net/");

            if (help_option) return;

            Pixmap mask = new Pixmap (window, 32, 32, 1);
            XBM xbm = new XBM (display, 32, 32, xbm_data);

            GC.Values gv = new GC.Values ();
            gv.set_background (display.default_white);
            gv.set_foreground (display.default_black);
            GC gc = new GC (mask, gv);

            mask.put_image (gc, xbm, 0, 0);

            gnu.x11.extension.Shape shape = new gnu.x11.extension.Shape (display);

            // test extension opcode string in error
            try {
              shape.combine_mask (window, -1, 0, 0, mask, -1);
              display.check_error ();

            } catch (Error e) {
              Console.WriteLine ("Forced error for testing: " + e);
            }

            // force a round trip after an error is generated
            display.input.input_focus ();

            // test extension event mechanism
            shape.select_input (window, true);

            shape.combine_mask (window, gnu.x11.extension.Shape.BOUNDING, 0, 0,
              mask, gnu.x11.extension.Shape.SUBTRACT);
        }
 /// <summary>For a description of this member, see <see cref="M:System.IDisposable.Dispose" />.</summary>
 void IDisposable.Dispose()
 {
     this.Dispose(true);
     GC.SuppressFinalize(this);
 }
Example #11
0
        public static void ConvertImageMagickNet(string fileName, string outputFolder, AppOptions options)
        {
            try
            {
                using (FileStream fi = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read, _bufferSize, FileOptions.None))
                {
                    string baseName = Path.GetFileNameWithoutExtension(fileName);
                    string jpgName  = Path.Combine(outputFolder, baseName + ".jpg");
                    string wmkName  = Path.Combine(outputFolder, baseName + "_watermarked.jpg");
                    string extName  = GetSimpleExtension(fileName).ToLower();

                    Bitmap bitmap = Resources.flower_preview;

                    if (extName == "cr2")
                    {
                        MagickImage img = new MagickImage(fi);
                        bitmap = img.ToBitmap();
                    }
                    else if (options.ProcessJpeg)
                    {
                        //MessageBox.Show("Yee");
                        if (extName == "jpg")
                        {
                            //MessageBox.Show(extName);
                            bitmap = (Bitmap)Image.FromFile(fileName);
                        }
                    }

                    EncoderParameters ep = new EncoderParameters(1);
                    ep.Param[0] = new EncoderParameter(Encoder.Quality, options.Quality);

                    ImageRenderer.WmContext = WmContext;

                    if (WmContext.BetaWatermarkType == WatermarkType.Image)
                    {
                        Bitmap watermark = (Bitmap)Image.FromFile(WmContext.BetaWatermarkInfo.WatermarkPath);
                        Bitmap image     = ImageRenderer.RenderImageWatermark(watermark, bitmap);
                        image.Save(wmkName, JpgImageCodec, ep);

                        if (options.Duplicates)
                        {
                            bitmap.Save(jpgName, JpgImageCodec, ep);
                        }
                    }
                    else if (WmContext.BetaWatermarkType == WatermarkType.Text)
                    {
                        string watermark = WmContext.BetaWatermarkInfo.WatermarkText;
                        Bitmap image     = ImageRenderer.RenderTextWatermark(watermark, bitmap);
                        image.Save(wmkName, JpgImageCodec, ep);

                        if (options.Duplicates)
                        {
                            bitmap.Save(jpgName, JpgImageCodec, ep);
                        }
                    }
                    else if (WmContext.BetaWatermarkType == WatermarkType.None)
                    {
                        bitmap.Save(jpgName, JpgImageCodec, ep);
                    }

                    GC.Collect();
                }
            }
            catch (ThreadAbortException ex)
            {
                //do absolutely nil
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error whilst converting", MessageBoxButtons.OK, MessageBoxIcon.Error);
                if (FrmMain.BwConverter.IsBusy)
                {
                    FrmMain.BwConverter.Abort();
                }
            }
        }
Example #12
0
        /// <summary>
        /// This method is called when the sprite is told to draw
        /// itself on the window.
        /// </summary>
        public virtual void Render(
			Drawable dest,
			GC gc)
        {
            sprite.Render(dest, gc);
        }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        #region validation
        if (this.Tippani.TippaniText.Text.Trim() == "")
        {
            this.lblStatusMessage.Text = "कृपया टिप्पणीको बिषय राख्नुहोस्।";
            this.programmaticModalPopup.Show();
            return;
        }

        if (this.Tippani.FileNo.Text.Trim() == "")
        {
            this.lblStatusMessage.Text = "कृपया टिप्पणीको फाइल नं राख्नुहोस्।";
            this.programmaticModalPopup.Show();
            return;
        }

        if (this.Tippani.TippaniPriority.SelectedIndex <= 0)
        {
            this.lblStatusMessage.Text = "कृपया टिप्पणीको प्राथमिक्ता छन्नुहोस।";
            this.programmaticModalPopup.Show();
            return;
        }
        #endregion

        /* tippani created */
        this.Tippani.ActionMode = this.hdnMode.Value;
        ATTGeneralTippani tippani = this.Tippani.GetTippani(this.User.UserName, this.hdnMsgIDs.Value, this.hdnDarIDs.Value);  

        /* tippani detail created */
        this.PunishmentEntry.ActionMode = this.hdnMode.Value;
        tippani.LstTippaniDetail = this.PunishmentEntry.GetPunishmentList();

        /* tippani attachment created */
        this.TippaniAttachment.ActionMode = this.hdnMode.Value;
        tippani.LstTippaniAttachment = this.TippaniAttachment.GetAttachment(tippani.OrgID, tippani.TippaniID, this.User.UserName);

        /* tippani process created for self actor */
        ATTGeneralTippaniProcess selfProcess = new ATTGeneralTippaniProcess();
        if (hdnMode.Value == "A")
        {
            selfProcess.OrgID = tippani.OrgID;
            selfProcess.TippaniID = tippani.TippaniID;
            selfProcess.TippaniProcessID = 0;
        }
        else if (hdnMode.Value == "E")
        {
            char[] token ={ '/' };
            selfProcess.OrgID = int.Parse(this.hdnIDs.Value.Split(token)[0]);
            selfProcess.TippaniID = int.Parse(this.hdnIDs.Value.Split(token)[1]);
            selfProcess.TippaniProcessID = 1;
        }
        selfProcess.SenderOrgID = null;
        selfProcess.SenderUnitID = null;
        selfProcess.SendBy = null;
        selfProcess.SendOn = "";
        selfProcess.ReceiverOrgID = this.User.OrgID;
        selfProcess.ReceiverUnitID = this.User.UnitID;
        selfProcess.SendTo = (int)this.User.PID;
        selfProcess.Note = this.PunishmentEntry.GetPunishmentNote();
        selfProcess.Status = int.Parse(this.PunishmentEntry.Status.SelectedValue);
        selfProcess.SendType = "F";
        selfProcess.IsChannelPerson = "Y";
        selfProcess.EntryBy = this.User.UserName;
        selfProcess.Action = this.hdnMode.Value;

        /* created list of process for tippani movement */
        //if (this.hdnMode.Value == "A")
        {
            tippani.LstTippaniProcess = this.chnlPerson.GetTippaniProcessList(tippani.OrgID, tippani.TippaniID, this.User.UserName);
        }

        /* add self process object at the begining of the process list */
        tippani.LstTippaniProcess.Insert(0, selfProcess);

        #region Validation
        bool hasDetail = tippani.LstTippaniDetail.Exists
                                                    (
                                                        delegate(ATTGeneralTippaniDetail d)
                                                        {
                                                            return d.Action != "D";
                                                        }
                                                    );
        if (hasDetail == false)
        {
            this.lblStatusMessage.Text = "कृपया टिप्पणीको लागी कर्मचारी राख्नुहोस्।";
            this.programmaticModalPopup.Show();
            return;
        }
        #endregion

        try
        {
            BLLGeneralTippani.AddGeneralTippani(tippani);

            foreach (ATTGeneralTippaniAttachment attach in tippani.LstTippaniAttachment)
            {
                if (attach.RawContent != null)
                {
                    GC.Collect();
                    GC.SuppressFinalize(attach.RawContent);
                    attach.RawContent = null;
                }
            }

            this.ClearME();

            this.lblStatusMessage.Text = "Punishment Tippani has been saved successfully.";
            this.programmaticModalPopup.Show();
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }
Example #14
0
 protected ActorPrototype(Type actor)
 {
     gc = new GC(actor);
     reentrant = new Reentrant(actor);
     dispatcher = new Dispatcher(actor);
 }
Example #15
0
        /// <summary>
        /// This method is called when the sprite is told to draw
        /// itself on the window.
        /// </summary>
        public abstract void Render(
			Drawable dest,
			GC gc);
Example #16
0
 /**
    * @see #line(GC, int, int, int, int)
    */
 public void vertical(GC gc, int x, int y1, int y2)
 {
     line (gc, x, y1, x, y2);
 }
Example #17
0
 /**
    * @see #text(GC, int, int, String, int, Font)
    */
 public void text(GC gc, int x, int y, String s)
 {
     poly_text (gc, x, y, new Text [] {new Text (s, 0, null)});
 }
Example #18
0
 /**
    * @see #poly_text(GC, int, int, Text[])
    */
 public void text(GC gc, int x, int y, String s, int delta, Font font)
 {
     poly_text (gc, x, y, new Text [] {new Text (s, delta, font)});
 }
Example #19
0
 public virtual void Dispose()
 {
     GC.SuppressFinalize(this);
 }
Example #20
0
 public void Dispose()
 {
     db.Dispose();
     GC.SuppressFinalize(this);
 }
Example #21
0
 public void Dispose()
 {
     Dispose(true);
     GC.SuppressFinalize(this);
 }
Example #22
0
 public void Dispose()
 {
   this.Dispose(true);
   GC.SuppressFinalize((object) this);
 }
Example #23
0
        public void init_defaults()
        {
            default_screen = screens [default_screen_no];
            default_root = default_screen.root (); // before init default_gc
            default_depth = default_screen.root_depth ();
            default_colormap = default_screen.default_colormap ();
            default_gc = default_screen.default_gc ();
            default_black = new Color (default_screen.black_pixel ());
            default_white = new Color (default_screen.white_pixel ());

            for (int i=pixmap_formats.Length-1; i>=0; i--)
              if (pixmap_formats [i].depth () == default_depth) {
            default_pixmap_format = pixmap_formats [i];
            break;
              }
        }
Example #24
0
 /**
    * @see #poly_arc(GC, Arc[], bool)
    */
 public void arc(GC gc, Arc arc, bool fill)
 {
     poly_arc (gc, new Arc [] {arc}, fill);
 }
Example #25
0
        /** Shared, read-only resource in general. */
        public GC default_gc()
        {
            if (default_gc_cache == null) {
              GC.Values gv = new GC.Values ();
              gv.set_foreground (black_pixel ());
              gv.set_background (white_pixel ());

              default_gc_cache = new GC (display, gv);
            }

            return default_gc_cache;
        }
Example #26
0
     /**
        * @see #arc(GC, Arc, bool)
        */
     public void arc(GC gc, int x, int y, int width, int height, 
 int angle1, int angle2, bool fill)
     {
         arc (gc, new Arc (x, y, width, height, angle1, angle2), fill);
     }
Example #27
0
   public Poly (int opcode, Drawable drawable, GC gc,
     Object [] items, int item_unit_count) {
 
     this.opcode = opcode;
     this.drawable = drawable;
     this.gc = gc;
     items_sets.Add (items);
     items_sets_unit_count = items.Length * item_unit_count;
   }
Example #28
0
   public Arc (Drawable drawable, GC gc, gnu.x11.Arc [] arcs, 
     bool fill) 
 
     :base (fill ? 71 : 68, drawable, gc, arcs, 3){
   }
Example #29
0
 ActorPrototype(ActorType type)
 {
     gc = new GC(type.Implementation);
     dispatcher = new Dispatcher(type.Implementation);
     this.type = type;
 }
Example #30
0
   public Rectangle (Drawable drawable, GC gc,
     gnu.x11.Rectangle [] rectangles, bool fill)
 	:base (fill ? 70 : 67, drawable, gc, rectangles, 2){
   }
Example #31
0
 ActorPrototype(Type actor)
 {
     gc = new GC(actor);
     dispatcher = new Dispatcher(actor);
 }
Example #32
0
        public static void ConvertImageNative(string fileName, string outputFolder, AppOptions options)
        {
            try
            {
                using (FileStream fi = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read, _bufferSize, FileOptions.None))
                {
                    // Start address is at offset 0x62, file size at 0x7A, orientation at 0x6E
                    fi.Seek(0x62, SeekOrigin.Begin);
                    BinaryReader br = new BinaryReader(fi);
                    UInt32       jpgStartPosition = br.ReadUInt32();   // 62
                    br.ReadUInt32();                                   // 66
                    br.ReadUInt32();                                   // 6A
                    UInt32 orientation = br.ReadUInt32() & 0x000000FF; // 6E
                    br.ReadUInt32();                                   // 72
                    br.ReadUInt32();                                   // 76
                    Int32 fileSize = br.ReadInt32();                   // 7A

                    fi.Seek(jpgStartPosition, SeekOrigin.Begin);

                    string baseName = Path.GetFileNameWithoutExtension(fileName);
                    string jpgName  = Path.Combine(outputFolder, baseName + ".jpg");
                    string wmkName  = Path.Combine(outputFolder, baseName + "_watermarked.jpg");
                    string extName  = GetSimpleExtension(fileName).ToLower();

                    Bitmap bitmap = Resources.flower_preview;

                    if (extName == "cr2")
                    {
                        bitmap = new Bitmap(new PartialStream(fi, jpgStartPosition, fileSize));
                    }
                    else if (options.ProcessJpeg)
                    {
                        //MessageBox.Show("Yee");
                        if (extName == "jpg")
                        {
                            //MessageBox.Show(extName);
                            bitmap = (Bitmap)Image.FromFile(fileName);
                        }
                    }

                    try
                    {
                        if (JpgImageCodec != null && (orientation == 8 || orientation == 6))
                        {
                            if (orientation == 8)
                            {
                                bitmap.RotateFlip(RotateFlipType.Rotate270FlipNone);
                            }
                            else
                            {
                                bitmap.RotateFlip(RotateFlipType.Rotate90FlipNone);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        // Image Skipped
                    }
                    EncoderParameters ep = new EncoderParameters(1);
                    ep.Param[0] = new EncoderParameter(Encoder.Quality, options.Quality);

                    ImageRenderer.WmContext = WmContext;

                    if (WmContext.BetaWatermarkType == WatermarkType.Image)
                    {
                        Bitmap watermark = (Bitmap)Image.FromFile(WmContext.BetaWatermarkInfo.WatermarkPath);
                        Bitmap image     = ImageRenderer.RenderImageWatermark(watermark, bitmap);
                        image.Save(wmkName, JpgImageCodec, ep);

                        if (options.Duplicates)
                        {
                            bitmap.Save(jpgName, JpgImageCodec, ep);
                        }
                    }
                    else if (WmContext.BetaWatermarkType == WatermarkType.Text)
                    {
                        string watermark = WmContext.BetaWatermarkInfo.WatermarkText;
                        Bitmap image     = ImageRenderer.RenderTextWatermark(watermark, bitmap);
                        image.Save(wmkName, JpgImageCodec, ep);

                        if (options.Duplicates)
                        {
                            bitmap.Save(jpgName, JpgImageCodec, ep);
                        }
                    }
                    else if (WmContext.BetaWatermarkType == WatermarkType.None)
                    {
                        bitmap.Save(jpgName, JpgImageCodec, ep);
                    }

                    GC.Collect();
                }
            }
            catch (ThreadAbortException ex)
            {
                //do absolutely nil
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error whilst converting", MessageBoxButtons.OK, MessageBoxIcon.Error);
                if (FrmMain.BwConverter.IsBusy)
                {
                    FrmMain.BwConverter.Abort();
                }
            }
        }
Example #33
0
     // opcode 62 - copy area
     /**
        * @see <a href="XCopyArea.html">XCopyArea</a>
        */
     public void copy_area(Drawable src, GC gc, int src_x, int src_y, 
 int width, int height, int dst_x, int dst_y)
     {
         Request request = new Request (display, 62, 7);
         request.write4 (src.id);
         request.write4 (id);
         request.write4 (gc.id);
         request.write2 (src_x);
         request.write2 (src_y);
         request.write2 (dst_x);
         request.write2 (dst_y);
         request.write2 (width);
         request.write2 (height);
         display.send_request (request);
     }
Example #34
0
 public void Dispose()
 {
     _connection.Fechar();
     GC.SuppressFinalize(this);
 }
Example #35
0
   public Fill (Drawable drawable, GC gc, 
     Point [] points, int shape, int coordinate_mode) 
 
     :base (69, drawable, gc, points, 1) {
     this.shape = shape;
     this.coordinate_mode = coordinate_mode;
   }
Example #36
0
 public GC(GC src, int mask)
     : base(src.display)
 {
     src.copy (this, mask);
 }
Example #37
0
   public Dot (Drawable drawable, GC gc, 
     gnu.x11.Point [] points, int coordinate_mode, bool join) 
 
     :base (join ? 65 : 64, drawable, gc, points, 1){
     this.coordinate_mode = coordinate_mode;
   }
Example #38
0
 public GC(GC src)
     : this(src, Values.ALL)
 {
 }
Example #39
0
 public Segment (Drawable drawable, GC gc, 
   gnu.x11.Segment [] segments) :
   base (66, drawable, gc, segments, 2) {
 }
 public void Dispose()
 {
     CollectorPattern.DecrementCount();
     GC.SuppressFinalize(this);
     //free unmanaged resource
 }