Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #12451 > unrolled thread

bBrowser Image

Started byFranz Rachbauer <office@rachbauer.org>
First post2019-04-26 11:45 +0200
Last post2019-04-28 09:43 +0200
Articles 5 — 3 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  bBrowser Image Franz Rachbauer <office@rachbauer.org> - 2019-04-26 11:45 +0200
    Re: bBrowser Image D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2019-04-27 18:21 +0200
      Re: bBrowser Image Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2019-04-27 20:12 +0200
        Re: bBrowser Image Franz Rachbauer <office@rachbauer.org> - 2019-04-28 08:46 +0200
          Re: bBrowser Image Franz Rachbauer <office@rachbauer.org> - 2019-04-28 09:43 +0200

#12451 — bBrowser Image

FromFranz Rachbauer <office@rachbauer.org>
Date2019-04-26 11:45 +0200
SubjectbBrowser Image
Message-ID<q9ujvf$qsd$1@gioia.aioe.org>
Hi guys,
how can I read a JPG and convert it to a bBrowser bitmap?

oColumn := bDataColumn{SELF:oDCBrowser, odbsServer, {|Server, Owner| 
Owner:GetImage(Server)}, #Expression, SELF}

METHOD GetImage(oServer) CLASS ...
LOCAL cFile AS STRING
LOCAL ptrFile AS PTR
LOCAL oImage AS bBitmap

cFile := oServer:Fieldget(#PICNAME)
ptrFile := DIBCreateFromFile(String2Psz(cFile)
FabWriteDIB2BMPFile(ptrFile, "C:\TMP\TEST.BMP")	// 14 bytes, not ok

// Version 1
oImage := bBitmap{ptrFile}
// Version 2
oImage := bBitmap{FabDIBToBitmap(ptrFile, NULL_PTR)}
RETURN oImage

Neither version 1 nor 2 creates a bitmap that is shown in bDataColumn. 
What goes wrong?
Franz

[toc] | [next] | [standalone]


#12456

FromD.J.W. van Kooten <vankooten@removethis.ic2.com>
Date2019-04-27 18:21 +0200
Message-ID<n809cepdeh6bmrgi2163sqhsq6i2ulg8uo@4ax.com>
In reply to#12451
Replying on message of Fri, 26 Apr 2019 11:45:11 +0200 from Franz
Rachbauer:


 Hello Franz,

>how can I read a JPG and convert it to a bBrowser bitmap?

Personally I would do it as follows. My VO program incorporates a .Net
DLL which consists of 2 projects: a X# project and a C# project. I add
code to one of them, or both, when something can be done only, or much
easier, in X#/C#.

Converting a JPG to a BMP would be such a thing; this is all it takes
in C#:

public Bitmap ConvertToBitmap(string fileName)
{
    Bitmap bitmap;
    using(Stream bmpStream = System.IO.File.Open(fileName,
System.IO.FileMode.Open ))
    {
         Image image = Image.FromStream(bmpStream);

         bitmap = new Bitmap(image);

    }
    return bitmap;
}

Dick

[toc] | [prev] | [next] | [standalone]


#12457

FromKarl Faller <mail_withoutthat_@_drei-f_andthat_.de>
Date2019-04-27 20:12 +0200
Message-ID<2o69cehi3len561ava9h0qu85gqq6aa825@4ax.com>
In reply to#12456
>Converting a JPG to a BMP would be such a thing; this is all it takes
>in C#:
>
>public Bitmap ConvertToBitmap(string fileName)
>{
>    Bitmap bitmap;
>    using(Stream bmpStream = System.IO.File.Open(fileName,
>System.IO.FileMode.Open ))
>    {
>         Image image = Image.FromStream(bmpStream);
>
>         bitmap = new Bitmap(image);
>
>    }
>    return bitmap;
>}
And this is the X# Version, less braces  ;)

FUNC ConvertToBitmap(fileName AS  STRING ) AS Bitmap
	VAR     bmpStream := System.IO.File.Open(fileName,;
System.IO.FileMode.Open )       
	VAR  myImage := Image.FromStream(bmpStream)
	VAR myBitmap :=Bitmap{myImage}             
 // mybitmap:Save( "C:\Users\Karl\Pictures\Screenshots\test.bmp") 
//  to write it back...
Return myBitmap
Regards

Karl

[toc] | [prev] | [next] | [standalone]


#12459

FromFranz Rachbauer <office@rachbauer.org>
Date2019-04-28 08:46 +0200
Message-ID<qa3i8c$1ivm$1@gioia.aioe.org>
In reply to#12457
Hi Karl, hi Dirk,
do you say with this examples that's not possible to convert an extern 
JPG to bBrowser bBitmap with VO only code? Would it help if the files 
are BMP instead of JPG?

Franz

Am 27.04.2019 um 20:12 schrieb Karl Faller:
>> Converting a JPG to a BMP would be such a thing; this is all it takes
>> in C#:
>>
>> public Bitmap ConvertToBitmap(string fileName)
>> {
>>     Bitmap bitmap;
>>     using(Stream bmpStream = System.IO.File.Open(fileName,
>> System.IO.FileMode.Open ))
>>     {
>>          Image image = Image.FromStream(bmpStream);
>>
>>          bitmap = new Bitmap(image);
>>
>>     }
>>     return bitmap;
>> }
> And this is the X# Version, less braces  ;)
> 
> FUNC ConvertToBitmap(fileName AS  STRING ) AS Bitmap
> 	VAR     bmpStream := System.IO.File.Open(fileName,;
> System.IO.FileMode.Open )
> 	VAR  myImage := Image.FromStream(bmpStream)
> 	VAR myBitmap :=Bitmap{myImage}
>   // mybitmap:Save( "C:\Users\Karl\Pictures\Screenshots\test.bmp")
> //  to write it back...
> Return myBitmap
> Regards
> 
> Karl
> 

[toc] | [prev] | [next] | [standalone]


#12460

FromFranz Rachbauer <office@rachbauer.org>
Date2019-04-28 09:43 +0200
Message-ID<qa3lih$i0$1@gioia.aioe.org>
In reply to#12459
Got it, oImage shows in bBrowser, thanks to all!
Franz

LOCAL oBild AS FabPaintLib
LOCAL cString as STRING
LOCAL oImage as Bitmap

oBild := FabPaintLib { cFileJpg , SELF }
oBild:ResizeBilinear(150, 200)
oBild:AsStringFileFormat := "BMP"
cString := oBild:AsString
oImage := bBitmap{bimgCreateBitmapFromDibString(, cString)}

Am 28.04.2019 um 08:46 schrieb Franz Rachbauer:
> Hi Karl, hi Dirk,
> do you say with this examples that's not possible to convert an extern 
> JPG to bBrowser bBitmap with VO only code? Would it help if the files 
> are BMP instead of JPG?
> 
> Franz
> 
> Am 27.04.2019 um 20:12 schrieb Karl Faller:
>>> Converting a JPG to a BMP would be such a thing; this is all it takes
>>> in C#:
>>>
>>> public Bitmap ConvertToBitmap(string fileName)
>>> {
>>>     Bitmap bitmap;
>>>     using(Stream bmpStream = System.IO.File.Open(fileName,
>>> System.IO.FileMode.Open ))
>>>     {
>>>          Image image = Image.FromStream(bmpStream);
>>>
>>>          bitmap = new Bitmap(image);
>>>
>>>     }
>>>     return bitmap;
>>> }
>> And this is the X# Version, less braces  ;)
>>
>> FUNC ConvertToBitmap(fileName AS  STRING ) AS Bitmap
>>     VAR     bmpStream := System.IO.File.Open(fileName,;
>> System.IO.FileMode.Open )
>>     VAR  myImage := Image.FromStream(bmpStream)
>>     VAR myBitmap :=Bitmap{myImage}
>>   // mybitmap:Save( "C:\Users\Karl\Pictures\Screenshots\test.bmp")
>> //  to write it back...
>> Return myBitmap
>> Regards
>>
>> Karl
>>
> 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web