Solved

Need a HIGH preform graphics

Posted on 1998-12-03
7
192 Views
Last Modified: 2010-04-04
I want to show a TBitmap, that is being modified very often, to an user (20+ frames a second). If possible in a form (600x400). I need delphi 3 example with source.
0
Comment
Question by:God_Ares
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 4

Expert Comment

by:jack_p50
ID: 1349102
See here in VCL section in graphics part - here are many such things as you need :
http://bes.trendline.co.il/torry/
0
 
LVL 3

Expert Comment

by:williams2
ID: 1349103
Hmmm.. Hey Jack! I don't see any source ?

God_Ares: here's a way to deal with it:

You need to drop a TOpenPictureDialog to your form and then add a Form OnCreate event procedure, the n the rest is cut'n'paste:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtDlgs, ExtCtrls;

type
  TForm1 = class(TForm)
    OpenPictureDialog1: TOpenPictureDialog;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    a,b: TBitmap;
    Timer: TTimer;
    Next: Integer;
    Function GetNewImage: TBitmap;
    procedure OnTime(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

Function TForm1.GetNewImage: TBitmap;
begin
  Result:= TBitmap.Create;
  If OpenPictureDialog1.Execute then
    Result.LoadFromFile(OpenPictureDialog1.Filename);
End;

procedure TForm1.FormCreate(Sender: TObject);
begin
  ClientWidth:= 640;
  ClientHeight:= 480;
  a:= GetNewImage;
  b:= GetNewImage;
  Next:= 0;
  Timer:= TTimer.Create(Self);
  Timer.Interval:= 1000;
  Timer.OnTimer:= OnTime;
  Timer.Enabled:= True;
end;

procedure TForm1.OnTime(Sender: TObject);
var
  TempHandle: hWnd;
  dwRop: DWord;
begin
  next:= 1-Next;
  dwRop:= SRCCOPY;
  If next=0 then TempHandle:= a.Canvas.Handle else TempHandle:= b.Canvas.Handle;
  BitBlt(
    Canvas.Handle,      // handle to destination device context
    0,                  // x-coordinate of destination rectangle's upper-left corner
    0,                  // y-coordinate of destination rectangle's upper-left corner
    640,            // width of destination rectangle
    480,            // height of destination rectangle
    TempHandle,            // handle to source device context
    0,                  // x-coordinate of source rectangle's upper-left corner
    0,                  // y-coordinate of source rectangle's upper-left corner
    dwRop             // raster operation code (See below)
   );
{
BLACKNESS      Fills the destination rectangle using the color associated with
            index 0 in the physical palette. (This color is black for the
                default physical palette.)
DSTINVERT      Inverts the destination rectangle.
MERGECOPY      Merges the colors of the source rectangle with the specified
            pattern by using the Boolean AND operator.
MERGEPAINT      Merges the colors of the inverted source rectangle with the
            colors of the destination rectangle by using the Boolean OR
                operator.
NOTSRCCOPY      Copies the inverted source rectangle to the destination.
NOTSRCERASE      Combines the colors of the source and destination rectangles
            by using the Boolean OR operator and then inverts the resultant
                color.
PATCOPY            Copies the specified pattern into the destination bitmap.
PATINVERT      Combines the colors of the specified pattern with the colors of
            the destination rectangle by using the Boolean XOR operator.
PATPAINT      Combines the colors of the pattern with the colors of the
            inverted source rectangle by using the Boolean OR operator. The
                result of this operation is combined with the colors of the
                destination rectangle by using the Boolean OR operator.
SRCAND            Combines the colors of the source and destination rectangles
            by using the Boolean AND operator.
SRCCOPY            Copies the source rectangle directly to the destination
            rectangle.
SRCERASE      Combines the inverted colors of the destination rectangle with
            the colors of the source rectangle by using the Boolean AND operator.
SRCINVERT      Combines the colors of the source and destination rectangles
            by using the Boolean XOR operator.
SRCPAINT      Combines the colors of the source and destination rectangles by
            using the Boolean OR operator.
WHITENESS      Fills the destination rectangle using the color associated with
            index 1 in the physical palette. (This color is white for the
                default physical palette.)
}
End;
end.

0
 
LVL 3

Expert Comment

by:williams2
ID: 1349104
..You should maybe said the timer to 50, and you will see.

Cheers,
Williams
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Author Comment

by:God_Ares
ID: 1349105
Sorry jack_p50,

I agree with williams2. It isn't exactly as i wanted to be...

But Williams2 answer was perfect. So i must be honest and give points to williams2.

Please williams2 answer this question (with a dummy answer)
and recieve those points!.

Thanx to all...
Greetz God_Ares.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1349106
See Graphics examples on   http://www.efg2.com/lab/
0
 

Expert Comment

by:Aleq
ID: 1349107
Try direct-x components.
0
 
LVL 3

Accepted Solution

by:
williams2 earned 100 total points
ID: 1349108
Thanks Aleq!

Jack: I do not hope you to have any hard feelings aboiut this mr, you should maybe try making an example next time. I guess you knew how to deal with it.

Cheers
Williams
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question