LazEdit: lazedit_picslib.pp: uses TFileStreamUtf8 for better UTF8 support on Windows.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2756 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
b36311669c
commit
eb63b9a138
@ -4,7 +4,7 @@ unit LazEdit_PicsLib;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses SysUtils, Classes, Math;
|
uses SysUtils, Classes, Math, LazUtf8Classes;
|
||||||
|
|
||||||
type
|
type
|
||||||
TImageFormat = (ifUnknown, ifBmp, ifPng, ifGif, ifJpg);
|
TImageFormat = (ifUnknown, ifBmp, ifPng, ifGif, ifJpg);
|
||||||
@ -325,13 +325,13 @@ end;
|
|||||||
|
|
||||||
function GetImageSizeAndFormat(const Fn: String; out Width, Height: dword): TImageFormat;
|
function GetImageSizeAndFormat(const Fn: String; out Width, Height: dword): TImageFormat;
|
||||||
var
|
var
|
||||||
ImgStream: TFileStream;
|
ImgStream: TFileStreamUtf8;
|
||||||
ImgFormat: TImageFormat;
|
ImgFormat: TImageFormat;
|
||||||
begin
|
begin
|
||||||
Width := 0;
|
Width := 0;
|
||||||
Height := 0;
|
Height := 0;
|
||||||
try
|
try
|
||||||
ImgStream := TFileStream.Create(Fn,fmOpenRead or fmShareDenyNone);
|
ImgStream := TFileStreamUtf8.Create(Fn,fmOpenRead or fmShareDenyNone);
|
||||||
try
|
try
|
||||||
ImgStream.Position := 0;
|
ImgStream.Position := 0;
|
||||||
ImgFormat := GetImageFormatAndDimensions(ImgStream, ExtToImageFormat(ExtractFileExt(Fn)), Width, Height);
|
ImgFormat := GetImageFormatAndDimensions(ImgStream, ExtToImageFormat(ExtractFileExt(Fn)), Width, Height);
|
||||||
|
@ -87,7 +87,7 @@ begin
|
|||||||
FInitialDir := ExtractFileDir(Fn);
|
FInitialDir := ExtractFileDir(Fn);
|
||||||
SrcEdit.Text := ExtractFileName(Fn);
|
SrcEdit.Text := ExtractFileName(Fn);
|
||||||
//GetImageSize uses system encoding
|
//GetImageSize uses system encoding
|
||||||
if GetImageSize(Utf8ToSys(Fn), W, H) then
|
if GetImageSize(Fn, W, H) then
|
||||||
begin
|
begin
|
||||||
WidthEdit.Text := IntToStr(W);
|
WidthEdit.Text := IntToStr(W);
|
||||||
HeightEdit.Text := IntToStr(H);
|
HeightEdit.Text := IntToStr(H);
|
||||||
|
Loading…
Reference in New Issue
Block a user