Click here to Skip to main content
15,904,024 members
Home / Discussions / C#
   

C#

 
GeneralRe: Sharpening the Saw Pin
SledgeHammer011-Jun-11 11:21
SledgeHammer011-Jun-11 11:21 
GeneralRe: Sharpening the Saw Pin
Pete O'Hanlon1-Jun-11 21:47
mvePete O'Hanlon1-Jun-11 21:47 
AnswerRe: Sharpening the Saw [modified] Pin
RobCroll1-Jun-11 14:11
RobCroll1-Jun-11 14:11 
QuestionI do not understand why the error ! :S Pin
ismail201-Jun-11 2:31
ismail201-Jun-11 2:31 
AnswerRe: I do not understand why the error ! :S Pin
PIEBALDconsult1-Jun-11 2:50
mvePIEBALDconsult1-Jun-11 2:50 
AnswerRe: I do not understand why the error ! :S Pin
Eddy Vluggen1-Jun-11 2:59
professionalEddy Vluggen1-Jun-11 2:59 
AnswerRe: I do not understand why the error ! :S Pin
Not Active1-Jun-11 2:59
mentorNot Active1-Jun-11 2:59 
GeneralRe: I do not understand why the error ! :S Pin
ismail201-Jun-11 3:05
ismail201-Jun-11 3:05 
GeneralRe: I do not understand why the error ! :S Pin
Not Active1-Jun-11 3:21
mentorNot Active1-Jun-11 3:21 
GeneralRe: I do not understand why the error ! :S Pin
ismail201-Jun-11 3:29
ismail201-Jun-11 3:29 
GeneralRe: I do not understand why the error ! :S Pin
Not Active1-Jun-11 3:32
mentorNot Active1-Jun-11 3:32 
GeneralRe: I do not understand why the error ! :S Pin
ismail201-Jun-11 3:34
ismail201-Jun-11 3:34 
GeneralRe: I do not understand why the error ! :S Pin
Not Active1-Jun-11 3:38
mentorNot Active1-Jun-11 3:38 
GeneralRe: I do not understand why the error ! :S Pin
BobJanova1-Jun-11 4:12
BobJanova1-Jun-11 4:12 
AnswerRe: I do not understand why the error ! :S Pin
Pete O'Hanlon1-Jun-11 3:25
mvePete O'Hanlon1-Jun-11 3:25 
GeneralRe: I do not understand why the error ! :S Pin
ismail201-Jun-11 3:33
ismail201-Jun-11 3:33 
GeneralRe: I do not understand why the error ! :S Pin
Not Active1-Jun-11 3:37
mentorNot Active1-Jun-11 3:37 
GeneralRe: I do not understand why the error ! :S Pin
ismail201-Jun-11 3:44
ismail201-Jun-11 3:44 
GeneralRe: I do not understand why the error ! :S PinPopular
Pete O'Hanlon1-Jun-11 3:54
mvePete O'Hanlon1-Jun-11 3:54 
QuestionLogical issue with a recursive function call Pin
John-ph1-Jun-11 2:23
John-ph1-Jun-11 2:23 
AnswerRe: Logical issue with a recursive function call Pin
dasblinkenlight1-Jun-11 5:37
dasblinkenlight1-Jun-11 5:37 
QuestionMemory expensive rubber band selection? Pin
Chesnokov Yuriy31-May-11 23:10
professionalChesnokov Yuriy31-May-11 23:10 
What is the reason of memory consumption in the DrawRoi function leading to hundreds of Mb?

There is a Frame bitmap and its FrameWithRoi copy to assign to PictureBox.
On the mouse move event new ROI coords are estimated and DrawRoi() is called.

DrawRoi()
{
RectangleF roi = Roi;                               

RectangleF rect = new RectangleF()
{
        X = (float)Frame.Width * roi.X,
        Y = (float)Frame.Height * roi.Y,
        Width = (float)Frame.Width * roi.Width,
        Height = (float)Frame.Height * roi.Height
};

// draw roi if it is smaller than the whole image
if (rect.Left > 0 || rect.Right < (float)FrameWithRoi.Width ||
    rect.Top > 0 || rect.Bottom < (float)FrameWithRoi.Height)
{
        Graphics g = Graphics.FromImage(FrameWithRoi);
        g.DrawImage(Frame, 0, 0);
        using (Bitmap region = new Bitmap(FrameWithRoi.Width, FrameWithRoi.Height, FrameWithRoi.PixelFormat))
        {
                Graphics roi_g = Graphics.FromImage(region);
                roi_g.FillRectangle(new SolidBrush(Color.FromArgb(64, 0, 0, 0)), new Rectangle(0, 0, FrameWithRoi.Width, FrameWithRoi.Height));
                roi_g.FillRectangle(new SolidBrush(Color.Red), rect);
                region.MakeTransparent(Color.Red);
                g.DrawImage(region, 0, 0);
        }
}                

this.framePictureBox.Image = FrameWithRoi;
}

Чесноков

AnswerRe: Memory expensive rubber band selection? Pin
BobJanova31-May-11 23:36
BobJanova31-May-11 23:36 
AnswerRe: Memory expensive rubber band selection? Pin
Chesnokov Yuriy1-Jun-11 0:42
professionalChesnokov Yuriy1-Jun-11 0:42 
AnswerRe: Memory expensive rubber band selection? Pin
Luc Pattyn1-Jun-11 0:42
sitebuilderLuc Pattyn1-Jun-11 0:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.