예제 #1
0
        public void drawImageScale(
            javax.microedition.lcdui.Image img,
            float x, float y,
            System.Drawing.RotateFlipType transform,
            float scale)
        {
            if (img.killed)
            {
                return;
            }

            if (scale == 1)
            {
                _drawImage(img.dimg,
                           x, y, img.getWidth(), img.getHeight(),
                           0, 0, img.getWidth(), img.getHeight(),
                           transform);
            }
            else
            {
                _drawImage(img.dimg,
                           x, y, img.getWidth() * scale, img.getHeight() * scale,
                           0, 0, img.getWidth(), img.getHeight(),
                           transform);
            }
        }
예제 #2
0
        public static javax.microedition.lcdui.Image createImage(javax.microedition.lcdui.Image image,
                                                                 int x, int y, int width, int height)
        {
            Image ret = Image.createImage(width, height);

            ret.getGraphics().drawImageRegion(image, 0, 0, x, y, width, height, 0);


            return(ret);
        }
예제 #3
0
 public void drawImage(javax.microedition.lcdui.Image img, float x, float y)
 {
     if (img.killed)
     {
         return;
     }
     _drawImage(
         img.dimg,
         x, y, img.getWidth(), img.getHeight(),
         0, 0, img.getWidth(), img.getHeight(),
         0);
 }
예제 #4
0
        public void rebuff(int blockx, int blocky, javax.microedition.lcdui.Image img)
        {
            Graphics g = Graphics.FromImage(pictureBox1.Image);

            if (img != null)
            {
                g.FillRectangle(img.getColorKeyBrush(), blockx, blocky, 1, 1);
            }

            pictureBox1.Refresh();

            //Console.WriteLine("rebuff");
        }
예제 #5
0
        public void drawImageRegion(
            javax.microedition.lcdui.Image img,
            float x, float y, float sx, float sy, float sw, float sh,
            System.Drawing.RotateFlipType transform)
        {
            if (img.killed)
            {
                return;
            }

            _drawImage(img.dimg,
                       x, y, sw, sh,
                       sx, sy, sw, sh,
                       transform);
        }
예제 #6
0
        private Hashtable genEventTemplates(String subfile)
        {
            Hashtable ret  = new Hashtable();
            String    path = Application.StartupPath + "\\events\\" + subfile;

            try
            {
                if (System.IO.File.Exists(path))
                {
                    string[] lines = File.ReadAllLines(path);
                    for (int j = 0; j < lines.Length; j++)
                    {
                        string line = lines[j].Trim();
                        if (!lines[j].StartsWith("#"))
                        {
                            string[]      columns = line.Split(new char[] { '|' });
                            EventTemplate et      = new EventTemplate(subfile, columns);
                            javax.microedition.lcdui.Image icon = (javax.microedition.lcdui.Image)Images[et.imageKey];
                            if (icon == null && et.imageKey.Length > 0)
                            {
                                try
                                {
                                    icon = new javax.microedition.lcdui.Image(
                                        Image.FromFile(Application.StartupPath + "\\events\\" + et.imageKey)
                                        );
                                    imageList1.Images.Add(et.imageKey, icon.dimg);
                                }
                                catch (Exception err)
                                {
                                }
                            }
                            et.icon      = icon;
                            ret[et.name] = et;
                        }
                        else
                        {
                            // this line is comment
                        }
                    }
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message + "\n" + path);
            }
            return(ret);
        }
예제 #7
0
        public void drawImageTrans(javax.microedition.lcdui.Image src, float x, float y, ImageTrans transform)
        {
            switch (transform)
            {
            case ImageTrans.NONE:
                drawImageRegion(src, x, y, 0, 0, src.getWidth(), src.getHeight(),
                                System.Drawing.RotateFlipType.RotateNoneFlipNone);
                break;

            case ImageTrans.R_90:
                drawImageRegion(src, x, y, 0, 0, src.getWidth(), src.getHeight(),
                                System.Drawing.RotateFlipType.Rotate90FlipNone);
                break;

            case ImageTrans.R_180:
                drawImageRegion(src, x, y, 0, 0, src.getWidth(), src.getHeight(),
                                System.Drawing.RotateFlipType.Rotate180FlipNone);
                break;

            case ImageTrans.R_270:
                drawImageRegion(src, x, y, 0, 0, src.getWidth(), src.getHeight(),
                                System.Drawing.RotateFlipType.Rotate270FlipNone);
                break;

            case ImageTrans.MIRROR:
                drawImageRegion(src, x, y, 0, 0, src.getWidth(), src.getHeight(),
                                System.Drawing.RotateFlipType.RotateNoneFlipX);
                break;

            case ImageTrans.MR_90:
                drawImageRegion(src, x, y, 0, 0, src.getWidth(), src.getHeight(),
                                System.Drawing.RotateFlipType.Rotate90FlipX);
                break;

            case ImageTrans.MR_180:
                drawImageRegion(src, x, y, 0, 0, src.getWidth(), src.getHeight(),
                                System.Drawing.RotateFlipType.Rotate180FlipX);
                break;

            case ImageTrans.MR_270:
                drawImageRegion(src, x, y, 0, 0, src.getWidth(), src.getHeight(),
                                System.Drawing.RotateFlipType.Rotate270FlipX);
                break;
            }
        }
예제 #8
0
        public ImageProcessDialog(ImagesForm src, ArrayList dstImages, bool all)
        {
            InitializeComponent();

            this.srcForm = src;

            foreach (Object io in dstImages)
            {
                javax.microedition.lcdui.Image img = (javax.microedition.lcdui.Image)io;
                if (all || (img != null && img.selected))
                {
                    selected_images.Add(img);
                }
            }

            this.labelSelectedCount.Text = "已选择(" + selected_images.Count + ")个图片";
            long color = src.getCurrentClickColor().ToArgb() & 0x00ffffffff;

            this.textColor.Text = color.ToString("x");
        }
예제 #9
0
 public void drawImageTrans(javax.microedition.lcdui.Image src, float x, float y, int transform)
 {
     drawImageRegion(src, x, y, 0, 0, src.getWidth(), src.getHeight(), FlipTable[transform]);
 }
 public J2MEImage(Image image)
 {
     this.image = image;
     intImage = new int[image.Width * image.Height];
     image.getRGB(this.intImage, 0, image.Width, 0, 0, image.Width, image.Height);
 }
 public virtual void drawPolygon(Point[] points, int color)
 {
     Image bufImage = Image.createImage(image.getWidth(), image.getHeight());
     Graphics g = bufImage.getGraphics();
     g.drawImage(image, 0, 0, 0);
     g.setColor(color);
     int i = 0;
     for (; i < points.length - 1; i++)
     {
         g.drawLine(points[i].getX(), points[i].getY(), points[i + 1].getX(), points[i + 1].getY());
     }
     g.drawLine(points[i].getX(), points[i].getY(), points[0].getX(), points[0].getY());
     image = bufImage;
     repaint();
 }
 public virtual void drawMatrix(bool[][] matrix)
 {
     Image bufImage = Image.createImage(image.getWidth(), image.getHeight());
     Graphics g = bufImage.getGraphics();
     g.setColor(0xCCCCCC);
     for (int y = 0; y < matrix[0].Length; y++)
     {
         for (int x = 0; x < matrix.Length; x++)
         {
             if (matrix[x][y] == true)
                 g.drawLine(x, y, x + 1, y);
         }
     }
     image = bufImage;
     repaint();
 }
    public virtual void drawLines(Line[] lines, int color)
    {
        Image bufImage = Image.createImage(image.getWidth(), image.getHeight());
        Graphics g = bufImage.getGraphics();
        g.drawImage(image, 0, 0, 0);
        g.setColor(color);

        for (int i = 0; i < lines.length - 1; i++)
        {
            g.drawLine(lines[i].getP1().getX(), lines[i].getP1().getY(), lines[i].getP2().getX(), lines[i].getP2().getY());
        }
        image = bufImage;
        repaint();
    }
 public virtual void drawLine(Line line, int color)
 {
     Image bufImage = Image.createImage(image.getWidth(), image.getHeight());
     Graphics g = bufImage.getGraphics();
     g.drawImage(image, 0, 0, 0);
     g.setColor(color);
     g.drawLine(line.getP1().getX(), line.getP1().getY(), line.getP2().getX(), line.getP2().getY());
     image = bufImage;
     repaint();
 }
 public virtual void drawCross(Point point, int color)
 {
     Image bufImage = Image.createImage(image.getWidth(), image.getHeight());
     Graphics g = bufImage.getGraphics();
     g.drawImage(image, 0, 0, 0);
     g.setColor(color);
     g.drawLine(point.getX() - 5, point.getY(), point.getX() + 5, point.getY());
     g.drawLine(point.getX(), point.getY() - 5, point.getX(), point.getY() + 5);
     image = bufImage;
     repaint();
 }