Hi, I'm creating a "mini paint" application something very simple with hand drawing straight line curve line and an ereaser.
I have some problem with my "straight line" and "curve line". If you ever played with MsPaint(I guess you did) you know how the straight line work. Trying to reproduce the effect of a "growing" line is quite easy.
1. Backup the original image
2. Load this image every time there is a mousemove event giving the impression the line is slowly growing as you move your mouse.
this is the code I'm currently using to do so :
'============================================
If tmpbitmap Is Nothing Then
tmpbitmap = New Bitmap(m_bitmap.Width, m_bitmap.Height)
graphics = graphics.FromImage(tmpbitmap)
graphics.DrawImage(m_bitmap, New Rectangle(0, 0, _
tmpbitmap.Width, tmpbitmap.Height), 0, 0, m_bitmap.Width, _
m_bitmap.Height, GraphicsUnit.Pixel)
graphics = graphics.FromImage(m_bitmap)
Else
graphics.DrawImage(tmpbitmap, New Rectangle(0, 0, _
m_bitmap.Width, m_bitmap.Height), 0, 0, tmpbitmap.Width, _
tmpbitmap.Height, GraphicsUnit.Pixel)
graphics = graphics.FromImage(m_bitmap)
End If
'======================================================
my main problem right now is when my image is too big DrawImage is way to slow to do the job and theres a little "lag" everytime I move the mouse,
So here is my question is there a better way to create a copy of a bitmap?
Ps: Excuse my poor english
I have some problem with my "straight line" and "curve line". If you ever played with MsPaint(I guess you did) you know how the straight line work. Trying to reproduce the effect of a "growing" line is quite easy.
1. Backup the original image
2. Load this image every time there is a mousemove event giving the impression the line is slowly growing as you move your mouse.
this is the code I'm currently using to do so :
'============================================
If tmpbitmap Is Nothing Then
tmpbitmap = New Bitmap(m_bitmap.Width, m_bitmap.Height)
graphics = graphics.FromImage(tmpbitmap)
graphics.DrawImage(m_bitmap, New Rectangle(0, 0, _
tmpbitmap.Width, tmpbitmap.Height), 0, 0, m_bitmap.Width, _
m_bitmap.Height, GraphicsUnit.Pixel)
graphics = graphics.FromImage(m_bitmap)
Else
graphics.DrawImage(tmpbitmap, New Rectangle(0, 0, _
m_bitmap.Width, m_bitmap.Height), 0, 0, tmpbitmap.Width, _
tmpbitmap.Height, GraphicsUnit.Pixel)
graphics = graphics.FromImage(m_bitmap)
End If
'======================================================
my main problem right now is when my image is too big DrawImage is way to slow to do the job and theres a little "lag" everytime I move the mouse,
So here is my question is there a better way to create a copy of a bitmap?
Ps: Excuse my poor english