تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[سؤال] تغيير كود جافا الى فيجوال بيسك
#1
السلام عليكم
هل هناك من ييرمج بلغة الجافا ويمكنه ان يغير لي هذا الكود الى كود فيجوال بيسك؟؟


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package javaapplication5;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.*;
import java.awt.*;
/**
 *
 * @author home
 */
public class JavaApplication5 {

    /**
     * @param args the command line arguments
     * @throws java.io.IOException
     */
    public static void main(String[] args) throws IOException{
        // TODO code application logic here
     File file = new File("bear.jpg"); // I have bear.jpg in my working directory
        FileInputStream fis = new FileInputStream(file);
        BufferedImage image = ImageIO.read(fis); //reading the image file

        int rows = 4; //You should decide the values for rows and cols variables
        int cols = 4;
        int chunks = rows * cols;

        int chunkWidth = image.getWidth() / cols; // determines the chunk width and height
        int chunkHeight = image.getHeight() / rows;
        int count = 0;
        BufferedImage imgs[] = new BufferedImage[chunks]; //Image array to hold image chunks
        for (int x = 0; x < rows; x++) {
            for (int y = 0; y < cols; y++) {
                //Initialize the image array with image chunks
                imgs[count] = new BufferedImage(chunkWidth, chunkHeight, image.getType());

                // draws the image chunk
                Graphics2D gr = imgs[count++].createGraphics();
                gr.drawImage(image, 0, 0, chunkWidth, chunkHeight, chunkWidth * y, chunkHeight * x, chunkWidth * y + chunkWidth, chunkHeight * x + chunkHeight, null);
                gr.dispose();
            }
        }
        System.out.println("Splitting done");

        //writing mini images into image files
        for (int i = 0; i < imgs.length; i++) {
            ImageIO.write(imgs[i], "jpg", new File("img" + i + ".jpg"));
        }
        System.out.println("Mini images created");
    
    }
    
}
الرد }}}
تم الشكر بواسطة:
#2
إبحث في قوقل عن
java to vb.net

توجد مواقع للتحويل من وإلى 
قم بالتحويل وجرب النتائج 
من الممكن أن تجد أخطاء كثيرة وتحتاج إلى تصحيح بشري
لا تنجح دائماً المحولات
الرد }}}
تم الشكر بواسطة: amna jamal
#3
(22-01-18, 04:52 PM)عبدالله الدوسري كتب : إبحث في قوقل عن
java to vb.net

توجد مواقع للتحويل من وإلى 
قم بالتحويل وجرب النتائج 
من الممكن أن تجد أخطاء كثيرة وتحتاج إلى تصحيح بشري
لا تنجح دائماً المحولات

جزاك الله الف خير
الرد }}}
تم الشكر بواسطة:
#4
اليك موقع متميز يحتوي على تطبيقات تحويل من لغة  الى لغة أخرى مع العكس 
Convert Between VB.NET and Java
Convert Between Java and C#
Convert Between Java and C++
Convert Between VB.NET and C#
Convert Between C++ and C#
Convert Between VB.NET and C++
يمكنك تحميل نسخة مجانية Free Editionاو مدفوعة  Premium Edition 
رابط الموقع
الرد }}}
تم الشكر بواسطة: amna jamal
#5
الواضح من كود الجافا أنك تريد تقسيم الصورة الأصلية الي عدة صور صغيرة
ثم نحفظ تلك الصورة في مصفوفة 
ثم لاحقا تحفظ الصور الصغيرة علي الكمبيوتر

الكود التالي مكتوب بالفيجوال بيك دوت نت وسوف يؤدي المطلوب

PHP كود :
       ' نحدد الصورة المراد تقسيمها
        ' 
هنا أن أضفتها لفهرس المشروع
        
' يمكن تحديد الصورة الأصلية بأساليب كثيرة أخري
        Dim source As Bitmap = My.Resources.silver
        ' 
نعرف متغير يحد عدد الصور 
        Dim count 
As Integer 10
        
' نحدد عرض الصورة الصغيرة
        Dim chunkWidth As Integer = source.Width() / count
        ' 
نحدد طول الصورة الصغيرة
        Dim chunkHeight 
As Integer source.Height() / count
        
' نعرف المصفوفة التي سنملأها بالصور الصغيرة  
        Dim bitmaps As List(Of Bitmap) = New List(Of Bitmap)()

        ' 
نقوم بباء حلقة الدوران لكي نقتطع الصور الصغيرة من الصورة الأصلية
        Dim x 
As Integer 0
        Dim y 
As Integer 0
        While x 
count
            While y 
count
                
' تعريف االصورة الصغيرة
                Dim current As Bitmap = New Bitmap(chunkWidth, chunkHeight, source.PixelFormat)
                ' 
نرسم الصورة الصغيرة
                Using g 
As Graphics Graphics.FromImage(current)
 
                   Dim dstRect As Rectangle = New Rectangle(00chunkWidthchunkHeight)
 
                   Dim srcRect As Rectangle = New Rectangle(chunkWidth ychunkHeight xchunkWidth chunkWidthchunkHeight chunkHeight)
 
                   ' عملية الرسم تتم باقتطاع الجزء المحدد مكانه علي الصورة الأاصلية
                    g.DrawImage(source, dstRect, srcRect, GraphicsUnit.Pixel)
                End Using
                ' 
نضيف الصورة الصغيرة للمصفوفة
                bitmaps
.Add(current)
 
               y += 1
            End 
While
 
           x += 1
        End 
While

 
       ' حلقة دورام لكي نحفظ الصورة علي فهرس المشروع
        Dim i As Integer = 0
        While i < bitmaps.Count
            Dim bmp As Bitmap = bitmaps(i)
            bmp.Save(".\image" + i.ToString + ".jpg")
            i += 1
        End While 

ملجوظة:
تستطيع حفظ الصورة مباشرة بدلا من اضافتها الي مصفوفة
Retired
الرد }}}
تم الشكر بواسطة: amna jamal , amna jamal
#6
السلام عليكم ورحمة الله وبركاته


تفضلي يا أختي آمنه، تحويل كود الجافا إلى كود فيجوال بيسك

كود :
Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click

   Using OpenFileDialog1 As New OpenFileDialog With {.Filter = "Images|*.png;*.jpg;*.jpeg;*.bmp;*.gif"}
       If OpenFileDialog1.ShowDialog = vbOK Then

           Dim file As String = OpenFileDialog1.FileName ' "bear.jpg"
           Dim image As Image = image.FromFile(file) 'reading the image file

           Dim rows As Integer = 4 'You should decide the values for rows and cols variables
           Dim cols As Integer = 4
           Dim chunks As Integer = rows * cols

           Dim chunkWidth As Integer = image.Width / cols ' determines the chunk width and height
           Dim chunkHeight As Integer = image.Height / rows
           Dim count As Integer = 0
           Dim imgs(chunks - 1) As Image 'Image array to hold image chunks
           For x As Integer = 0 To rows - 1
               For y As Integer = 0 To cols - 1

                   'Initialize the image array with image chunks
                   imgs(count) = New Bitmap(chunkWidth, chunkHeight)

                   ' draws the image chunk
                   Dim gr As Graphics = Graphics.FromImage(imgs(count))
                   gr.DrawImage(image, New Rectangle(0, 0, chunkWidth, chunkHeight), New Rectangle(chunkWidth * y, chunkHeight * x, chunkWidth, chunkHeight), GraphicsUnit.Pixel)
                   count += 1
                   gr.Dispose()

               Next
           Next
           MsgBox("Splitting done")

           'writing mini images into image files
           Dim dir As String = Application.StartupPath & "\Chunks\"
           If Not IO.Directory.Exists(dir) Then IO.Directory.CreateDirectory(dir)
           For i As Integer = 0 To imgs.Length - 1
               imgs(i).Save(dir & "\img" & i & ".jpg")
           Next
           MsgBox("Mini images created")

       End If
   End Using

End Sub
الرد }}}
تم الشكر بواسطة: amna jamal


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
Big Grin [سؤال] مشروع الفيجوال بيسك ستوديو sad89891 4 1,744 10-04-24, 04:37 AM
آخر رد: emadahmed1995
  تغيير المسار الي مسار البرنامج في تقرير ميكروسوفت atefkhalf2004 2 107 02-04-24, 05:05 PM
آخر رد: atefkhalf2004
  تغيير على كود الحفظ محمد خيري 6 232 28-03-24, 04:20 PM
آخر رد: محمد خيري
  هل من الممكن العمل على قاعدة بيانات اكسل على الفيجوال بيسك خالد كامل1 4 145 24-03-24, 02:00 AM
آخر رد: خالد كامل1
  مشكلة عند نقل البرنامج من فيجوال 2013 الى فيجوال 2017 strongriseman 5 156 12-03-24, 10:37 AM
آخر رد: strongriseman
  تغيير اسم حقل او تغيير نوع البيان atefkhalf2004 5 303 31-01-24, 04:09 PM
آخر رد: atefkhalf2004
  الالوان في فيجوال بيسك atefkhalf2004 2 423 05-01-24, 04:38 PM
آخر رد: atefkhalf2004
  تحويل مشروع من c# الى فيجول بيسك Lathe1 4 726 05-01-24, 01:05 AM
آخر رد: HALIM ELEULMA
  [كود] اريد كود إرسال البيانات من الفيجوال بيسك إلىPDF issamsaidd 10 5,866 25-12-23, 06:30 PM
آخر رد: الحزين اليماني
  اضافة ادوات لفيجوال بيسك خالد20 10 1,986 18-12-23, 07:51 PM
آخر رد: ابراهيم عبدالباقى

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم