TLF and images

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

TLF and images

Miguel Ferreira
Hi all,
I have an tlfXML like this:<TextFlow whiteSpaceCollapse="preserve" version="3.0.0" xmlns="http://ns.adobe.com/textLayout/2008">  <p textAlign="left" fontSize="12" fontFamily="Arial" color="#333333">    <span>      Dear Madam, Sir,    </span>  </p>  <p textAlign="left" fontSize="12" fontFamily="Arial" color="#333333">    <img source="logo.png" width="99" height="48"/>    <span/>  </p></TextFlow>
Then i import to textflow by TextConverter.importToFlow(tlfXML , TextConverter.TEXT_LAYOUT_FORMAT, TextFlow.defaultConfiguration);
But then the image is an empty box. I have the same image in the folder as my converterHelper.Like the image is not loaded when the text flow is set to the RichEditableText.
Someone know how we can resolve this?
Thanks in advance.
Miguel
     
Reply | Threaded
Open this post in threaded view
|

Re: TLF and images

piotrz
Hi Miguel,

Please provide us information which version of Flex SDK are you using?

Thanks,
Piotr
Reply | Threaded
Open this post in threaded view
|

RE: TLF and images

Miguel Ferreira
4.10 and moving for 4.12 (maybe i will wait for the 4.14 then upgrade all the project)

> Date: Thu, 18 Dec 2014 03:08:22 -0800
> From: [hidden email]
> To: [hidden email]
> Subject: Re: TLF and images
>
> Hi Miguel,
>
> Please provide us information which version of Flex SDK are you using?
>
> Thanks,
> Piotr
>
>
>
> -----
> Apache Flex PMC
> [hidden email]
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/TLF-and-images-tp9245p9246.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
     
Reply | Threaded
Open this post in threaded view
|

RE: TLF and images

piotrz
Miguel,

It would be great if you could try with your project our latest release candidate 4.14.
You can download it using installer. Instruction how to do this -> [1]

There were couple of fixes for TLF, so maybe it's already fixed.

[1] http://bit.ly/16vAtGx

Piotr
Reply | Threaded
Open this post in threaded view
|

RE: TLF and images

Miguel Ferreira
I tried the new SDK.
It seems ok but the Font quality is poor all my application look kind of foogy now!
Neverthless the image problem is not fixed i saw that the InlineGraphicElement did not load the image i will search what i need to do to load it.
I installed the SDK by the installer just to inform

> Date: Thu, 18 Dec 2014 05:39:20 -0800
> From: [hidden email]
> To: [hidden email]
> Subject: RE: TLF and images
>
> Miguel,
>
> It would be great if you could try with your project our latest release
> candidate 4.14.
> You can download it using installer. Instruction how to do this -> [1]
>
> There were couple of fixes for TLF, so maybe it's already fixed.
>
> [1] http://bit.ly/16vAtGx
>
> Piotr
>
>
>
> -----
> Apache Flex PMC
> [hidden email]
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/TLF-and-images-tp9245p9250.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
     
Reply | Threaded
Open this post in threaded view
|

Re: TLF and images

Harbs
Can you create a JIRA issue with a sample app which shows the problem?[1]

On Dec 18, 2014, at 5:38 PM, Miguel Ferreira <[hidden email]> wrote:

> Neverthless the image problem is not fixed i saw that the InlineGraphicElement did not load the image i will search what i need to do to load it.
> I installed the SDK by the installer just to inform

[1]https://issues.apache.org/jira/browse/FLEX/
Reply | Threaded
Open this post in threaded view
|

RE: TLF and images

Miguel Ferreira
To overcome the problem after i import the image from XML I read all elements and i reset an embed image.
Because in this case is an logo that the app knows.
Something nice to add would be an inline BASE64 image.
So the basic idea is we have a Xhtml inline image
for example in xml:<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot">
then when we import  to TextFlow


we should load it to something like this:
private function load(base64:String):void { base64 = "iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="; var dec:Base64Decoder = new Base64Decoder(); dec.decode(imgString); var newByteArr:ByteArray=dec.toByteArray();         loader = new Loader(); loader.loadBytes(newByteArr); // In the loadBytes we write the Base64 String of the image. loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete); } private function loadComplete(e:Event):void { var bmp:BitmapData=new BitmapData(loader.width,loader.height,true,0x0); bmp.draw(loader); img = new Bitmap(bmp); }
That will help a lot.
I think maybe that even with a url or path the load process is never finished.

> Subject: Re: TLF and images
> From: [hidden email]
> Date: Thu, 18 Dec 2014 18:13:32 +0200
> CC: [hidden email]
> To: [hidden email]
>
> Can you create a JIRA issue with a sample app which shows the problem?[1]
>
> On Dec 18, 2014, at 5:38 PM, Miguel Ferreira <[hidden email]> wrote:
>
> > Neverthless the image problem is not fixed i saw that the InlineGraphicElement did not load the image i will search what i need to do to load it.
> > I installed the SDK by the installer just to inform
>
> [1]https://issues.apache.org/jira/browse/FLEX/
     
Reply | Threaded
Open this post in threaded view
|

Re: TLF and images

Alex Harui


On 12/18/14, 8:37 AM, "Miguel Ferreira" <[hidden email]>
wrote:

>To overcome the problem after i import the image from XML I read all
>elements and i reset an embed image.

I’m not quite sure what you meant by this.  What does it mean to “import
an image from XML” and “reset an embed” and are you saying that allows TLF
to load and display a .png file?

-Alex

Reply | Threaded
Open this post in threaded view
|

RE: TLF and images

piotrz
In reply to this post by Miguel Ferreira
Hi Miguel,

Maybe your problem is related to this one [1]

[1] http://bit.ly/1Azcn6K

Piotr
Reply | Threaded
Open this post in threaded view
|

RE: TLF and images

Miguel Ferreira
Hi Piotr,
I am not using Air is a Web application and this blurry Font i already had on some past projects.Mainly in a Web to print project last year where i add compiled embedded Fonts and I manage to improve with the help of Alex but now i don't remember but even so if the user had a clinic eye they could see the blurry.
I think this "effect" is in the SDK after TLF that by principle should be better but in my opinion is not the case still...
@Alexso after i do this:--------------------------------------------------------------TextConverter.importToFlow(tlfXML , TextConverter.TEXT_LAYOUT_FORMAT, TextFlow.defaultConfiguration);--------------------------------------------------------------I cycle the elements--------------------------------------------------------------private function loadImage():void{ if (textFlow!=null && textFlow.mxmlChildren!=null && textFlow.mxmlChildren.length>0) checkLogo(textFlow.mxmlChildren);} private function checkLogo(children:Array):void { for each (var element:Object in children) { if (element is InlineGraphicElement) { (element as InlineGraphicElement).source = img; } if (element.hasOwnProperty("mxmlChildren") && element["mxmlChildren"]!=null) checkLogo(element["mxmlChildren"]); } }
--------------------------------------------------------------
I think maybe in the import is missing something like:-------------------------------------------------------------- // event sent when graphic is done loading_textFlow.addEventListener(StatusChangeEvent.INLINE_GRAPHIC_STATUS_CHANGE,graphicStatusChangeEvent);--------------------------------------------------------------and then
--------------------------------------------------------------private function graphicStatusChangeEvent(e:StatusChangeEvent):void { // if the graphic has loaded update the display // actualWidth and actualHeight are computed from the graphic's height if (e.status == InlineGraphicElementStatus.READY || e.status == InlineGraphicElementStatus.SIZE_PENDING) { _textFlow.flowComposer.updateAllControllers(); } }--------------------------------------------------------------
should not this be the default behavior when we add images?

> Date: Fri, 19 Dec 2014 01:36:47 -0800
> From: [hidden email]
> To: [hidden email]
> Subject: RE: TLF and images
>
> Hi Miguel,
>
> Maybe your problem is related to this one [1]
>
> [1] http://bit.ly/1Azcn6K
>
> Piotr
>
>
>
> -----
> Apache Flex PMC
> [hidden email]
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/TLF-and-images-tp9245p9264.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
     
Reply | Threaded
Open this post in threaded view
|

RE: TLF and images

piotrz
Miguel,

If I could suggest something - Could you please paste your code on some service, because these mailing list messing up your code and it's almost unreadable.

Thanks,
Piotr
Reply | Threaded
Open this post in threaded view
|

Re: TLF and images

flex capacitor
GitHub just came out with this, https://gist.github.com/. Or the always
classic, http://pastebin.com/.

On Fri, Dec 19, 2014 at 2:06 AM, piotrz <[hidden email]> wrote:

> Miguel,
>
> If I could suggest something - Could you please paste your code on some
> service, because these mailing list messing up your code and it's almost
> unreadable.
>
> Thanks,
> Piotr
>
>
>
> -----
> Apache Flex PMC
> [hidden email]
> --
> View this message in context:
> http://apache-flex-users.2333346.n4.nabble.com/TLF-and-images-tp9245p9268.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: TLF and images

jmclean
Administrator
Hi,

Or https://paste.apache.org (for committers) or http://apaste.info (for everyone).

Justin
Reply | Threaded
Open this post in threaded view
|

Re: TLF and images

hugo
Hello,

Sorry for dig up this topic but I started to develop a text editor using
TLF.
It's a lot of features and everything going straightforward except the
images.

I can load an image (uploaded by the user), convert the image data to
bytearray and then draw on a sprite.
If I inser this sprite using insertInlineGraphic it works on the screen (I
can't load a spark Image object - draw an empty square and I still don't
know why).

If I try to save (export), the exporter exports [Sprite object] string.

Support insertInlineGraphic and export directly as base 64 string would be
the perfect solution (this could also increase the html export quality).

Since this is a blocker to my development, I'm digging on the TLF Flex
source code to try to support this.

If anyone could share some code (helper utils), will help a lot !

When I finish, I will share the results so someone could patch the original
Flex TLF if you whish.



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: TLF and images

Alex Harui-2
This isn't my area of expertise at all, but a quick look at InlineGraphic
implies that you can set the "source" property to a DisplayObject.  I
would not use Spark Image.  Spark and MX controls expect their parent to
be another UIComponent which is unlikely in a TLF rendering.  Maybe create
a flash.display.Bitmap instead.

If the exporter doesn't do what you want, you can probably copy it and
modify it to do what you need.

Good luck,
-Alex

On 12/12/17, 2:03 AM, "hugo" <[hidden email]> wrote:

>Hello,
>
>Sorry for dig up this topic but I started to develop a text editor using
>TLF.
>It's a lot of features and everything going straightforward except the
>images.
>
>I can load an image (uploaded by the user), convert the image data to
>bytearray and then draw on a sprite.
>If I inser this sprite using insertInlineGraphic it works on the screen (I
>can't load a spark Image object - draw an empty square and I still don't
>know why).
>
>If I try to save (export), the exporter exports [Sprite object] string.
>
>Support insertInlineGraphic and export directly as base 64 string would be
>the perfect solution (this could also increase the html export quality).
>
>Since this is a blocker to my development, I'm digging on the TLF Flex
>source code to try to support this.
>
>If anyone could share some code (helper utils), will help a lot !
>
>When I finish, I will share the results so someone could patch the
>original
>Flex TLF if you whish.
>
>
>
>--
>Sent from:
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-fle
>x-users.2333346.n4.nabble.com%2F&data=02%7C01%7Caharui%40adobe.com%7Cdb1a3
>391264b441303be08d5414798d2%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6
>36486698114819558&sdata=J0GVEsmsiQ3dQr9tsY%2FJ4ohQgwWcaLJIEKMXMWPWDcQ%3D&r
>eserved=0

Reply | Threaded
Open this post in threaded view
|

Re: TLF and images

hugo
I already implemented the import and export feature to base64 image (fully
compatible with HTML standard), so the final developer can set a Sprite on
the initial insert, export and import automatically as base64 image.

I'm finalizing this task fixing a bug when I reload on my TLF editor.

How can I share this with Flex community (donate my "patch") ?
PS: I needed to rely on a external third party PNGEncoder for the import
feature because I needed to be synchronous but perhaps there is a better
way, so I don't know if this is compatible with Apache.



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: TLF and images

Alex Harui-2
You can create a JIRA with your patch.  Or file a Pull Request agains the
flex-sdk mirror on GitHub.

Did you mean to say you needed an asynchronous PNGEncoder?  The one in
Flex appears to be synchronous but I don't know for sure.

Third-party dependencies have to be licensed in an Apache-compatible way.
If it is, and is available on-line, then the third-party code can be
downloaded as part of the build process.  It can also be part of the patch
and marked as 3rd-party code.  Post a link to which PNGEncoder you used if
in fact you can't use the one in Flex.

Thanks,
-Alex

On 12/13/17, 1:41 AM, "hugo" <[hidden email]> wrote:

>I already implemented the import and export feature to base64 image (fully
>compatible with HTML standard), so the final developer can set a Sprite on
>the initial insert, export and import automatically as base64 image.
>
>I'm finalizing this task fixing a bug when I reload on my TLF editor.
>
>How can I share this with Flex community (donate my "patch") ?
>PS: I needed to rely on a external third party PNGEncoder for the import
>feature because I needed to be synchronous but perhaps there is a better
>way, so I don't know if this is compatible with Apache.
>
>
>
>--
>Sent from:
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-fle
>x-users.2333346.n4.nabble.com%2F&data=02%7C01%7Caharui%40adobe.com%7C1ee31
>21059b54362603d08d5420db73e%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6
>36487549039070398&sdata=%2BDR0IVr8Qyt7yxi%2BBMZYz0WnOHsWT5IqZZsKPbyrWko%3D
>&reserved=0

Reply | Threaded
Open this post in threaded view
|

Re: TLF and images

hugo
Done: https://issues.apache.org/jira/browse/FLEX-35370

I'm continue to work on TLF until I finish my TLF editor and I have other
patchs that I will create other JIRA patchs.



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/