Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
Resolution in OSR Browser
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Resolution in OSR Browser
How to set high resolution (for example, 2560x2048 px) and display it on small (for example, 320x240) paintbox32?
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Resolution in OSR Browser
You would need to use a hidden Tbitmap in the Tchromium.onpaint event instead of using the paintbox32 directly.
Then draw the tbitmap into the paintbox32.
Then draw the tbitmap into the paintbox32.
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Re: Resolution in OSR Browser
I do not understand. Do you have an example code?
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Resolution in OSR Browser
I'm sorry but I don't have an example.
In fact, we repleaced the paintbox32 component long ago due to some resizing issues and now CEF4Delphi and OldCEF4Delphi use a custom made component.
In fact, we repleaced the paintbox32 component long ago due to some resizing issues and now CEF4Delphi and OldCEF4Delphi use a custom made component.
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Re: Resolution in OSR Browser
I still do not understand.
I need 2 things:
1. Resizing with scaling down (for example twice low).
2. Drawing cursor on browser.
I need 2 things:
1. Resizing with scaling down (for example twice low).
2. Drawing cursor on browser.
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Re: Resolution in OSR Browser
How can I send buffer of TChromium into TBitmap?salvadordf wrote: Wed Aug 05, 2020 8:49 pm You would need to use a hidden Tbitmap in the Tchromium.onpaint event instead of using the paintbox32 directly.
Then draw the tbitmap into the paintbox32.
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Resolution in OSR Browser
In OSR browser you have the bitmap with the browser contents in the TBufferPanel.Buffer property.
Don't forget to call TBufferPanel.BeginBufferDraw and TBufferPanel.EndBufferDraw before and after you read the bitmap.
https://github.com/salvadordf/OldCEF4De ... l.pas#L254
Don't forget to call TBufferPanel.BeginBufferDraw and TBufferPanel.EndBufferDraw before and after you read the bitmap.
https://github.com/salvadordf/OldCEF4De ... l.pas#L254
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Re: Resolution in OSR Browser
I found the solution. To decrease screen size twice you should make 2 cycles.
1st from 0 to screen height (maybe screen height minus 1, does not matter) with skipping every 2nd line
2nd from 0 to screen width with moving 4 bytes (one pixel) from Chromium's buffer into PaintBox32's buffer and skipping next 4 bytes.
I have decreased my screen 4x. The code is (but it will not work in yours projects)
But the next strings of code is
I really do not know what are dirtyrects and how to repaint only rects that was changed.
1st from 0 to screen height (maybe screen height minus 1, does not matter) with skipping every 2nd line
2nd from 0 to screen width with moving 4 bytes (one pixel) from Chromium's buffer into PaintBox32's buffer and skipping next 4 bytes.
I have decreased my screen 4x. The code is (but it will not work in yours projects)
Code: Select all
for j := 0 to height - 1 do //построчный проход
begin
for i := 0 to (width) do //каждый байт строки
begin
src := @PByte(buffer)[(width*j*4+i)*16];
dst := @PByte(Bits)[(width*j+i)*4];
Move(src^, dst^, 4);
end;
end;
Code: Select all
PaintBox.Flush(Rect(dirtyRects[j].x, dirtyRects[j].y,
dirtyRects[j].x + dirtyRects[j].width, dirtyRects[j].y + dirtyRects[j].height));
finally
Unlock;
PaintBox.Canvas.Unlock;
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Resolution in OSR Browser
The dirtyrects are the bitmap areas that need to be repainted.
The SimpleOSRBrowser uses that information to update the bitmap :
https://github.com/salvadordf/OldCEF4De ... r.pas#L456
The SimpleOSRBrowser uses that information to update the bitmap :
https://github.com/salvadordf/OldCEF4De ... r.pas#L456