Hi
How i cant to rotate my image which placed in memory dc on
90 degrees????
Thank.
1. Mirror / rotate image ( System.Drawing.Graphics / System.Drawing.Drawing2D.Matrix) - CSharp/C#
2. how to flip/rotate image in c# ppc2002
The .net cf is missing those transformations. How might I be able to flip or rotate an image easily? thanks. Robert Huie
4. rotate an image in a C# .NET CF app
Hello, Is there a way for me to programatically rotate an image in a C# .NET CF application. I am trying to display an image in landscape mode when a user clicks on a button to view a larger version of an image. thank you, @rjun
5. How can I rotate an image by certain degree - CSharp/C#
Hi...
Does anybody have a clue how to solve this problem?
the task is to change the following method in that manner that it
draws the (calculated) image form left to right instead of from top
to bottom. The image is actually a waterfall model of sound data.
I tried desperatly, but I don't see how to swap the x and y
coordinates.
Anybody got a hint?
Here is the method:
unsafe private void DrawWaterfall(ref Graphics g, int W, int
H)
{
bool MOX = false;
float[] data = new float[W]; // array of points to
display
double slope = 0.0; // samples to process per pixel
int num_samples = 0; // number of samples to process
int start_sample_index = 0; // index to begin looking at samples
int low = 0;
int high = 0;
display_max_y = Int32.MinValue;
if(!MOX)
{
low = DttSP.RXDisplayLow;
high = DttSP.RXDisplayHigh;
}
else
{
low = DttSP.TXDisplayLow;
high = DttSP.TXDisplayHigh;
}
int yRange = spectrum_grid_max - spectrum_grid_min;
float[] a = new float[32768];
my_con.dsp_display_mutex.WaitOne();
fixed(float* ptr =
&a[0])DttSP.GetSpectrum(ptr);
my_con.dsp_display_mutex.ReleaseMutex();
if(average_display)
{
if(average_buffer[0] == CLEAR_FLAG)
{
for(int i=0; i<32768; i++)
average_buffer[i] = a[i];
}
else
{
for(int i=0; i<32768; i++)
average_buffer[i] = a[i] =
(float)(a[i]*average_mult_samp
+average_buffer[i]*average_mult_avg);
}
}
num_samples = (high - low);
start_sample_index = (32768>>1)
+(int)((low * 32768) / DttSP.SampleRate);
num_samples = (int)((high - low) * 32768 /
DttSP.SampleRate);
if (start_sample_index < 0)
start_sample_index = 0;
if ((num_samples - start_sample_index) >
(32768+1))
num_samples = 32768-start_sample_index;
slope = (double)num_samples/(double)W;
for(int i=0; i<H; i++)
{
float max = float.MinValue;
int start =
start_sample_index+(int)Math.Floor(i*slope);
int finish =
start_sample_index+(int)Math.Floor((i+1)*slope);
if (start == finish)
{
max = a[start];
}
else
for(int j=start; j<finish; j++)
max = Math.Max(max, a[j]);
max = max + display_cal[20] + gain_correction +
att_correction;
if(max > display_max_y)
{
display_max_y = max;
display_max_x = i;
}
//data[i] =
-(int)(Math.Floor(max*H/yRange));
data[i] =max;
}
/**************************************************************************/
BitmapData bitmapData = waterfall_bmp.LockBits(
new Rectangle(0, 0, waterfall_bmp.Width,
waterfall_bmp.Height),
ImageLockMode.ReadWrite,
waterfall_bmp.PixelFormat);
int pixel_size = 3;
byte* column = null;
// first scroll image
int total_size = bitmapData.Stride * bitmapData.Height; // find
buffer size
byte[] buffer = new byte[total_size]; // create
buffer
Marshal.Copy(bitmapData.Scan0, buffer, 0, total_size); //
copy bitmap to buffer
Marshal.Copy( buffer, 0,
new
IntPtr((int)bitmapData.Scan0+bitmapData.Stride), //
slide memory and copy back
total_size - bitmapData.Stride);
buffer = null;
row = (byte *)bitmapData.Scan0;
/***********************************************************************************/
// draw new data
for(int i=0; i<W; i++) // for each pixel in the new line
{
int R, G, B;
if(data[i] <= waterfall_low_threshold) // if
less than low threshold use low color
{
R = waterfall_low_color.R;
G = waterfall_low_color.G;
B = waterfall_low_color.B;
}
else if(data[i] >= waterfall_high_threshold) //
if more than high threshold use high color
{
R = waterfall_high_color.R;
G = waterfall_high_color.G;
B = waterfall_high_color.B;
}
else // use a color between high and low
{
float percent = (data[i] -
waterfall_low_threshold)/(waterfall_high_threshold -
waterfall_low_threshold);
if(percent <= 0.5) // use a gradient between low and
mid colors
{
percent *= 2;
R = (int)((1-percent)*waterfall_low_color.R +
percent*waterfall_mid_color.R);
G = (int)((1-percent)*waterfall_low_color.G +
percent*waterfall_mid_color.G);
B = (int)((1-percent)*waterfall_low_color.B +
percent*waterfall_mid_color.B);
}
else // use a gradient between mid and high colors
{
percent = (float)(percent-0.5)*2;
R = (int)((1-percent)*waterfall_mid_color.R +
percent*waterfall_high_color.R);
G = (int)((1-percent)*waterfall_mid_color.G +
percent*waterfall_high_color.G);
B = (int)((1-percent)*waterfall_mid_color.B +
percent*waterfall_high_color.B);
}
}
// set pixel color
row[i*pixel_size + 0] = (byte)B; // set color in
memory
row[i*pixel_size + 1] = (byte)G;
row[i*pixel_size + 2] = (byte)R;
}
waterfall_bmp.UnlockBits(bitmapData);
g.DrawImageUnscaled(waterfall_bmp, 0, 16); // draw the image
on the background
waterfall_counter++;
// draw long cursor
if(long_crosshair)
{
g.DrawLine(new Pen(grid_text_color), display_cursor_x,
0, display_cursor_x, H);
g.DrawLine(new Pen(grid_text_color), 0,
display_cursor_y, W, display_cursor_y);
}
if(display_high_swr)
g.DrawString( "High SWR", new
Font("Arial", 14, FontStyle.Bold),
new SolidBrush(Color.Red), 245, 20);
}
*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
8. How to rotate and resize images
First , I apologize for my pool English. I had loaded images(include jpg, bitmap, png, gif) to hbitmap by Imaging API. Now, I have to zoom inzoom out or rotate the image. Does windows ce 5.0 have API to do this? Thanks all !