Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images ratio #302

Open
ghost opened this issue Jul 18, 2021 · 4 comments
Open

Images ratio #302

ghost opened this issue Jul 18, 2021 · 4 comments

Comments

@ghost
Copy link

ghost commented Jul 18, 2021

Hi, sorry I am sure it's my fault the problem, because it's very blunt, but I can't set images to draw with the right ratio, even modifying the css as I can read in many sites it will work. So for the moment and I'm sure that probably it's not of any interest to anyone, I'm modifying in htmlimages.pas the procedure ThtImage.Draw(Canvas: TCanvas; X, Y, W, H: Integer) this way (sorry I don't know how to indent lines in this editor):

`procedure ThtImage.Draw(Canvas: TCanvas; X, Y, W, H: Integer);

var
bm1, bm2: tbitmap;
begin
if Graphic <> nil then
begin
bm1:= tbitmap.Create;
bm2:= tbitmap.Create;
try
bm2.Assign(graphic);
bm1.SetSize(w, h);
setstretchbltmode(bm1.Canvas.Handle, COLORONCOLOR);
stretchblt(bm1.Canvas.Handle, 0, 0, w, h,
bm2.canvas.Handle, 0, 0, bm2.Width, bm2.Height,
srccopy);
Canvas.Draw(X, Y, bm1);
finally
bm1.Free;
bm2.Free;
end;
end;
end;`

@BerndGabriel
Copy link
Owner

If this issue is still of interest, could you please add some screenshots to demonstrate the benefit of your solutions. E.g. one screenshot with an image drawn by the original method and one of the same image drawn by the above method. And please add the html/css text for testing. Thanks.

@pascal1969
Copy link

in these 2 images you can understand the problem
regard's
original method
modifyed method

@ghost
Copy link
Author

ghost commented Feb 23, 2023 via email

@pascal1969
Copy link

The problems concern the scaling of the images, and it is not DPI dependent. In any case, solving with your solution, there are tons of other problems, which, after days of frustration trying to solve them, made me decide to abandon this component. The problems I haven't been able to solve concern the "td width" inside a "table" with a RadioButton inside, using the component on c++. In delphi it works fine, in c++ it doesn't assign the correct width.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants