Jump to content

DrawImage


MarkusR
 Share

Recommended Posts

need one more command for using bitmap fonts.

 

DrawImage(Texture* texture, int x, int y,int offsetx, int offsety, int width, int height)

 

this function already draw all, think its easy to add.

  • Upvote 1

PC : Win 10 Pro 64 Bit , 4x cores ~2 GHz , 8 GB RAM , AMD R7 265

2D : Photoline , Zooner Photo Studio 13 , Art Rage Studio 3.5.4 , Ashampoo Snap 7 , ...

3D : Shade 15 Basic , Carrara 8.5 & DAZ Studio 4.8 , Cheetah 3D 6.3.2 , Via Cad 8

Music : Samplitude Music Studio , Music Creator 7

IDE : Leadwerks Engine 3.x , Unity 5.x , (Unreal 4.8.x) , AGK v2.x , Construct 2 , (Clickteam Fusion 2.5) , ShiVa 1.9 , Game Maker Studio , MS Visual Studio .Net , Android Studio , Monkey , ...

Link to comment
Share on other sites

What would those be offsets from? Why not just add them to x and y yourself?

 

I think he means offests within a bitmap. If that's the case then we also need bottom left/right offset to have full cropping capabilities. Once the crop is set with offset x/y/x2/y2 then x/y and w/h is used to actually position and size the cropped bitmap.

Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)

Link to comment
Share on other sites

yo, with that pixel copy i can make new smaller textures and put them into a array, thanks.

  • Upvote 1

PC : Win 10 Pro 64 Bit , 4x cores ~2 GHz , 8 GB RAM , AMD R7 265

2D : Photoline , Zooner Photo Studio 13 , Art Rage Studio 3.5.4 , Ashampoo Snap 7 , ...

3D : Shade 15 Basic , Carrara 8.5 & DAZ Studio 4.8 , Cheetah 3D 6.3.2 , Via Cad 8

Music : Samplitude Music Studio , Music Creator 7

IDE : Leadwerks Engine 3.x , Unity 5.x , (Unreal 4.8.x) , AGK v2.x , Construct 2 , (Clickteam Fusion 2.5) , ShiVa 1.9 , Game Maker Studio , MS Visual Studio .Net , Android Studio , Monkey , ...

Link to comment
Share on other sites

What will work in LUA:

 

Edit the drawimage.shader (the Pixel-Shader):

On top add a uniform (don't name it "offset". That one is already used by the vertex-shader):

uniform vec2 off

 

change the line

fragData0 = drawcolor * texture(texture0,vTexCoords0);

to

fragData0 = drawcolor * texture(texture0,vTexCoords0+off);

 

Now in your LUA-Script just before the call to DrawImage set this value:

imgshader = Shader:Load("Shaders/Drawing/drawimage.shader")
if(not(imgshader:SetVec2("off", Vec2(0.1,0.1)))) then
   System:Print("Value could not be set.")
end

 

You will probably want to change the value back to (0,0) after you are done drawing. wink.png

 

Edit: (The offset will be set in percent, I think)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...