ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Clock Flip process

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
ickkm Posted - Oct 12 2022 : 21:10:10
// Prepare
 ImageTrackBar.Position := 0;
 SourceImage.Bitmap.Assign(SecondImage2.Bitmap);
 SourceImage.Update;
 SecondImage2.IO.LoadFromFileAuto(DataDir[Ord(ETC) - $30]+ InttoStr(PicNum1)+'.png');
 SecondImage2.lockPaint;
 Inc(PicNum1);
 if PicNum1 = 10 then PicNum1 := 0;
 TargetImage.Bitmap.Assign(SecondImage2.Bitmap);
 TargetImage.Update;
 SecondImage2.UnlockPaint;
 CurrentImage.Bitmap.Assign(SourceImage.Bitmap);

  THeight := 103;
  Twidth  := 60;

  if fCurrentViewLines <> nil then
    freemem(fCurrentViewLines);
  getmem(fCurrentViewLines, sizeof(pointer) * THeight);
  for q := 0 to THeight - 1 do
  begin
   fCurrentViewLines[q] := CurrentImage.Bitmap.Scanline[q];
  end;
//================


procedure TfmMain.ClockFlipeffect(Step:Integer);
var
  W, H, Y: Integer;
begin
  W := CurrentImage.Width;
  H := CurrentImage.Height;

  if (Step = 0) then
    StretchBlt(CurrentImage.Bitmap.Canvas.Handle, 0, 0, W, H,
               SourceImage.Bitmap.Canvas.Handle, 0, 0, W, H,
               SRCCOPY);

  if Step = 0 then
    exit;


  SetStretchBltMode(CurrentImage.bitmap.Canvas.Handle, HALFTONE);

  CurrentImage.bitmap.Canvas.Pen.Color := clBlack;
  CurrentImage.bitmap.Canvas.Pen.Width := 1;
  CurrentImage.bitmap.Canvas.Pen.Style := psSolid;

    StretchBlt(CurrentImage.bitmap.Canvas.Handle, 0, 0, W, H div 2,
               TargetImage.Bitmap.Canvas.Handle, 0, 0, W, H div 2,
               SRCCOPY);
    if Step <= 512 then
    begin
      Y := MulDiv(H, Step, 1024);
      if IEGlobalSettings().TransitionsDrawAlternative = False then
      StretchBlt(CurrentImage.bitmap.Canvas.Handle, 0, H div 2, W ,H,
                 SourceImage.Bitmap.Canvas.Handle, 0, H div 2, W, H,
                 SRCCOPY);
      StretchBlt(CurrentImage.bitmap.Canvas.Handle, 0, Y, W , H div 2 - Y,
                 SourceImage.Bitmap.Canvas.Handle, 0, 0, W, H div 2,
                 SRCCOPY);

      if IEGlobalSettings().TransitionsDrawAlternative = False then
        PageFlipDarkenEdges(Y, Step);
    end
    else
    begin
      Y := MulDiv(H, Step - 512, 512) div 2;

      if IEGlobalSettings().TransitionsDrawAlternative = False then
        StretchBlt(CurrentImage.bitmap.Canvas.Handle, 0, H div 2, W, H div 2,
                   SourceImage.Bitmap.Canvas.Handle, 0, h div 2, W, H Div 2,
                   SRCCOPY);
      StretchBlt(CurrentImage.bitmap.Canvas.Handle, 0, H div 2, W, Y,
                 TargetImage.Bitmap.Canvas.Handle, 0, H Div 2, W, H div 2,
                 SRCCOPY);

      if IEGlobalSettings().TransitionsDrawAlternative = False then
        PageFlipDarkenEdges(H div 2 + Y, Step);
    end;
 CurrentImage.Update;
end;

procedure TfmMain.PageFlipDarkenEdges(iCurrentPosition, Step : Integer);
const
  Initial_Darken_Level = 0.23;
  Darkness_Reduction = 0.68;
var
  iX, iY: integer;
  ppx: pRGB;
  rr, gg, bb: integer;
  iFadeStep1 , iFadeStep2 : integer;
  bDoDarken: Boolean;
begin
  // Upper Flip
  iFadeStep1 :=  Round(Step + Round(1024 * 0.9) / 5.0);
  if iFadeStep1 > 1024 then iFadeStep1 := 1024;
  // Down Flip
  iFadeStep2 :=  Round(1024 - Step + Round(1024 * 0.9) / 5.0);
  if iFadeStep2 > 1024 then iFadeStep2 := 1024;

  for  iY := 0 to THeight - 1 do
  begin
     ppx := fCurrentViewLines[iY];
    for iX := 0 to TWidth - 1 do
    begin
      bDoDarken := iY > iCurrentPosition;
      if bDoDarken then
      begin
       // Upper Flip
       if iY < ((THeight-1) Div 2) then
       begin
        with ppx^ do
        begin
          r := (ppx^.r * (1024-iFadeStep1) ) shr 10;
          g := (ppx^.g * (1024-iFadeStep1) ) shr 10;
          b := (ppx^.b * (1024-iFadeStep1) ) shr 10;
        end;
       end
       // Down Flip
       else
       begin
        with ppx^ do
        begin
          r := (ppx^.r * iFadeStep2 ) shr 10;
          g := (ppx^.g * iFadeStep2 ) shr 10;
          b := (ppx^.b * iFadeStep2 ) shr 10;
        end;
       end;
       inc(ppx);
      end;
    end;
  end;
  CurrentImage.bitmap.Canvas.MoveTo(0, iCurrentPosition);
  CurrentImage.bitmap.Canvas.LineTo(TWidth, iCurrentPosition);
end;





I tried changing the page flip as Nigel said.
seems to be working fine
Please see the source to see if there is a better way.
Thanks to Nigel for the advice.
5   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Oct 18 2022 : 17:37:17
Nice work. It looks very realistic.



Nigel
Xequte Software
www.imageen.com
ickkm Posted - Oct 18 2022 : 02:47:31


attach/ickkm/2022101823135_filpTimer.zip
7881.25 KB

I tried to link it with the watch.
Please take a look at this and let me know if you have any better ideas.
xequte Posted - Oct 16 2022 : 20:48:10
Wow, that effect looks really good. Nice work.

Nigel
Xequte Software
www.imageen.com
ickkm Posted - Oct 14 2022 : 03:45:08


attach/ickkm/2022101434135_FilpTest.zip
7955.83 KB

Dear Nigel,
Compress the sample program and upload it.
This is the code I worked on in XE10.
Please understand even if the inside of the code is messy.
Please understand that the capacity is a bit large for uploading as shown in the sample picture.
I think it would be better if it was included in the transition effect in the future.
xequte Posted - Oct 13 2022 : 00:24:04
Nice work. You should upload a demo so I can play with it.

Nigel
Xequte Software
www.imageen.com