Problemas con DrawImage - Forum

Forum Navigation
You need to log in to create posts and topics.

Problemas con DrawImage

Buenas tardes.

Tengo el siguiente código que no termina de funcionar y no entiendo el motivo:

Loop 0 31 [x]
SetVar [posicionFila] [x]*32
If [mapaFila1([x])] === 0
DrawImage "Fila01" "" "N:\NeoDarkWeb\Imagenes\casillaVacia.png" "[posicionFila]" "0" "32" "32"
EndIf
EndLoop

Haciendo log, he comprobado que solo entra en el condicional cuando se cumple que mapaFila1(x) vale 0. mapaFila1 es un array con 32 elementos, solo hay 0 en alguno de los elementos.

Fila01 es un objeto contenedor de 32px por 1024px.

El primer cuadro de 32x32 me lo dibuja siempre, pero el resto no. La variable posicionFija compruebo en el Log que se incrementa correctamente... es decir, primero vale 0, luego 32, luego 64, etc...

¿Por qué no imprime el resto?

@manugarciaeu

Row01 is a 32px by 1024px container object.

Is that 32px wide and 1024px high ?

The first 32x32 frame always draws it to me, but the rest does not

This would be the result if the container was indeed 32px wide.

Try and(temporarily) add (just before the DrawImage command), either an AlertBox or a ConsoleLog command that shows the value of variable [positionFila]; tell us if it is showing expected values for the X co-ordinate.

Also, check the Console Log to see if there are other (unexpected error) messages.

@gaev, thanks.

Yes, [posicionFila] shows the correct value. First is 0, then 32, then 64...

Fila01 has 32px high and 1024 width.

 

@manugarciaeu

I tried this code ...

SetVar [pictureFile] "file://C:/Users/Gaev Keeka/Pictures/crab.png"

Loop 0 31 [x]

   SetVar [posicionFila] [x]*32
   ...If [mapaFila1([x])] === 0
         DrawImage "Fila01" "" "[pictureFile]" "[posicionFila]" "0" "32" "32"
   ...EndIf

EndLoop

 

... and it drew 32 images (even going past the right edge of Fila01).

Note that ...

a) I commented out the If/Endif commands because I was not sure how you created [mapaFila1([x])]; in order to see if this variable is the root cause, do the same in your App

b) I can not tell what kind of object Fila01 is; I spent a lot of time when I used a Container object (error messages in Inspect >> Console that I could not decipher), but when I changed it to a Rectangle object, it worked like a charm.

 

@gaev @manugarciaeu please note that Drawing commands are drawn using SVG. You need a previous SVG to draw in: a Rectangle or another inline SVG (svg code with an ID inside a Container). I hope it helps.

Regards.

Thanks.

I'll try it this afternoon. Another question ... I am creating my own SVG graphics, how can I make those graphics appear in the available graphics dropdown when I insert an SVG icon in my App?

Thanks again.

@luishp:

please note that Drawing commands are drawn using SVG. You need a previous SVG to draw in: a Rectangle or another inline SVG (svg code with an ID inside a Container).

I was able to use DrawImage with a .png file; also, the Help file here ... https://webhelp.visualneo.com/Drawing.html ... says ...

DrawImage
Purpose: Draw an image from an external source file (.svg .jpg or .png)

I was able to use DrawImage with a .png file;

Yes @gaev, you are right, but I mean the destination object not the source file.

And what about this?

I am creating my own SVG graphics, how can I make those graphics appear in the available graphics dropdown when I insert an SVG icon in my App?

Another question:

I have an svg icon on top of another svg icon. Is there a way to "work" with the events of the icon below, the icon behind at the bottom?

Thanks.

I am creating my own SVG graphics, how can I make those graphics appear in the available graphics dropdown when I insert an SVG icon in my App?

@manugarciaeu sorry, that's not currently possible.

I have an svg icon on top of another svg icon. Is there a way to "work" with the events of the icon below, the icon behind at the bottom?

I don't understand your question. Why not?
Perhaps you can find usefull this Video Tutorial about working with SVG graphics within VisualNEO Web: