473,385 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Scaling Graphics (Fractal)

Hi all,

This is the following code i have,

Public Class Form1
Inherits System.Windows.Forms.Form

Dim A, B, c, U, x, y As Double
Dim Red, Green, Blue As Integer

'Bitmap holds picture of the form
Private b1 As Bitmap

'Graphics object (printing buffer)
Private g1 As Graphics
#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Timer1 As System.Windows.Forms.Timer
Friend WithEvents tmrColor As System.Windows.Forms.Timer
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.components = New System.ComponentModel.Container
Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
Me.tmrColor = New System.Windows.Forms.Timer(Me.components)
'
'Timer1
'
Me.Timer1.Enabled = True
Me.Timer1.Interval = 1
'
'tmrColor
'
Me.tmrColor.Enabled = True
Me.tmrColor.Interval = 1000
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.Color.Black
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Name = "Form1"
Me.Text = "Form1"

End Sub

#End Region

Private Sub Form1_Activated(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Activated

Static done As Boolean = False

If Not done Then
'Size and describe the form
Me.Size = New Size(1000, 1000)
Me.Text = "Mira Dust Fractal"
'Create the initial bitmap from Form
b1 = New Bitmap(Width, Height, Me.CreateGraphics())
'Create the Graphics Object buffer
' which ties the bitmap to it so that
' when you draw something on the object
' the bitmap is updated
g1 = Graphics.FromImage(b1)

'Prevent reentry to initialization
done = True

A = 0.9
B = 0.9998
c = -0.234
x = 950 : y = 950 'Starting Point

Red = Green = Blue = 1

End If
End Sub

Private Sub Form1_Paint(ByVal sender As Object, _
ByVal e As System.Windows.Forms.PaintEventArgs) _
Handles MyBase.Paint

'Copy the bitmap to the form
e.Graphics.DrawImage(b1, 0, 0)
End Sub

Private Sub rnd_dots()
Dim C, Z, W As Double
W = (System.Math.Cos(((A * x * x) + (C + (x * x))) / ((100 +
(x)))))
Z = x

U = (x * x)
x = ((B * y + W))

W = (System.Math.Sin((A * x) + ((C * U)) / (1 + U)))
y = (W - Z)
Dim p As Pen
If (Red > 257) Then
Red = 1
Else
Red = Red + 1
End If
Dim cl As Color =
System.Drawing.ColorTranslator.FromOle(RGB(Red, Blue, Green))
p = New Pen(cl)
g1.ScaleTransform(-1, 1)
Dim r As Rectangle = New Rectangle(x, y, 1, 1)
g1.DrawEllipse(p, r)
'Copy the bitmap to the form
Me.CreateGraphics.DrawImage(b1, 0, 0)


End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
rnd_dots()
End Sub

End Class
when i run this the fractal generated is too big, i.e it goes out the
boundary of the Form.

I remember with VB6 there was Form1.Scale(x1,y1)-(x2,y2) but so far i
have found no equivalent to this in VB.NET.

Could any one please help me with this problem. i want to be able to
scale a part of the fractal so that the other parts are not generated!

Please keep in mind im new to VB.NET!
thanks in advance

Feb 14 '06 #1
1 3594
"placid" <Bu****@gmail.com> schrieb
I remember with VB6 there was Form1.Scale(x1,y1)-(x2,y2) but so far
i have found no equivalent to this in VB.NET.

http://msdn.microsoft.com/library/en...ions_about.asp
Armin

Feb 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Pekka Karjalainen | last post by:
How can I create image files and animations with Python? I will clarify a bit. This is a question of recreational programming. I have already made some animated gifs from Julia sets using Python...
4
by: Eric Eggermann | last post by:
Hello all, I'm building an app that lays out and prints flash cards. Now the card might be any size, but when the user is working on the card, I draw the preview isotropically, as large as...
1
by: James Dean | last post by:
I have tried a few different methods for scaling an image down but all seem a bit on the slow side. Is there any way i can make this scaling faster....... Here is how i do it now. To display my...
3
by: pratush | last post by:
hi. I am a bit new to graphics programing. I am trying in vb.net to make a 3 walled structure which'll give the look of 3d. for that purpose, I am using same rectangle filled with textured brush...
0
by: SamSpade | last post by:
I have a usercontrol that contains a picturebox. The user can obtain (creategraphics) a picturebox graphics object and draw on the picturebox. She could do gr.GraphincInit.Millimeter and then draw...
3
by: Larry Serflaten | last post by:
I am taking a 256 color bitmap from a file and scaling it up X 16 to a 32bppPARGB bitmap in memory. I copy that image to the screen. After scaling, the edges of all the lines and colors are...
2
by: mookid8000 | last post by:
Hi group! I want to make a program with options similar to those in Microsoft Publisher - i.e. the ability to create different types of rectangle objects in which pictures/text/whatever may be...
12
by: Xah Lee | last post by:
Of Interest: Introduction to 3D Graphics Programing http://xahlee.org/3d/index.html Currently, this introduction introduces you to the graphics format of Mathematica, and two Java Applet...
2
by: Peter Oliphant | last post by:
I'm using the Bitmap class which has built in scaling for images been drawn not at their original size. And it works amazing well, and I'm VERY impressed! However. Is there perchance more than...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.