trichview.com

trichview.support




Problem changing JPEG Quality Picture


Return to index


Author

Message

Jean Jacques Serpoul

Posted: 11/09/2004 22:36:09


Hello,


I have a routine

---------------------------------------------------------------------------------------------------------------

function SetQualityJPEG(RVData: TCustomRVData; iquality: integer): Integer;

var i, r, c: Integer;

  table: TRVTableItemInfo;

  gr: TGraphic;

  Stream: TmemoryStream;

  VAlign: TRVVAlign;

  Tag: Integer;

  s: string;

  w, h: Integer;

begin

  Stream := TmemoryStream.create;

  Result := 0;

  for i := 0 to RVData.ItemCount - 1 do

    case RVData.GetItemStyle(i) of

      rvsPicture, rvsHotPicture:

        begin

          RVData.GetPictureInfo(i, s, gr, VAlign, Tag);

          if not (gr is TJPEGImage) then continue;

          TJPEGImage(gr).CompressionQuality := iquality;

          TJPEGImage(gr).Compress;

          Stream.clear;

          TJPEGImage(gr).SaveToStream(Stream);

          Stream.position := 0;

          TJPEGImage(gr).LoadFromStream(Stream);

          RVData.SetPictureInfo(i, s, gr, VAlign, Tag);

          inc(Result);

        end;

      rvsTable:

        begin

          table := TRVTableItemInfo(RVData.GetItem(i));

          for r := 0 to table.Rows.Count - 1 do

            for c := 0 to table.Rows[r].Count - 1 do

              if table.Cells[r, c] <> nil then

                inc(Result, StretchJPEG(table.Cells[r, c].GetRVData,

iquality));

        end;

    end;

  stream.free;

end;


i call the function :

SetQualityJPEG(RichView.RvData, iquality);

---------------------------------------------------------------------

RichView is a TrichViewEdit control.

All work fine for visible (JPEG) pictures in the editor.

My problem occurs when there are pictures not visible without scrolling

editor ==> It remains only the picture area.


I try Richiew.Update, refresh, format but the problem is alwys here.


Any Idea ?

Thanks in advance

Jean Jacques Serpoul





Powered by ABC Amber Outlook Express Converter