Solved

Need a HIGH preform graphics

Posted on 1998-12-03
7
190 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
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
Independent Software Vendors: 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Show Listview image from database (String field) 5 143
tidtcpserver connection lost handle 2 109
Performance of SQL statement 37 137
firemonkey Android Listview Sort items 7 70
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

685 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