Solved

Need a HIGH preform graphics

Posted on 1998-12-03
7
186 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now