File tree 2 files changed +32
-1
lines changed
2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -279,6 +279,13 @@ Example:
279
279
280
280
[combine:16x32:0,0=default_cobble.png:0,16=default_wood.png
281
281
282
+ #### `[resize:<w>x<h>`
283
+ Resizes the texture to the given dimensions.
284
+
285
+ Example:
286
+
287
+ default_sandstone.png^[resize:16x16
288
+
282
289
#### `[brighten`
283
290
Brightens the texture.
284
291
Original file line number Diff line number Diff line change @@ -1352,7 +1352,6 @@ bool TextureSource::generateImagePart(std::string part_of_name,
1352
1352
u32 r1 = stoi (sf.next (" ," ));
1353
1353
u32 g1 = stoi (sf.next (" ," ));
1354
1354
u32 b1 = stoi (sf.next (" " ));
1355
- std::string filename = sf.next (" " );
1356
1355
1357
1356
core::dimension2d<u32> dim = baseimg->getDimension ();
1358
1357
@@ -1711,6 +1710,31 @@ bool TextureSource::generateImagePart(std::string part_of_name,
1711
1710
}
1712
1711
}
1713
1712
}
1713
+ /*
1714
+ [resize:WxH
1715
+ Resizes the base image to the given dimensions
1716
+ */
1717
+ else if (str_starts_with (part_of_name, " [resize" ))
1718
+ {
1719
+ if (baseimg == NULL ) {
1720
+ errorstream << " generateImagePart(): baseimg == NULL "
1721
+ << " for part_of_name=\" " << part_of_name
1722
+ << " \" , cancelling." << std::endl;
1723
+ return false ;
1724
+ }
1725
+
1726
+ Strfnd sf (part_of_name);
1727
+ sf.next (" :" );
1728
+ u32 width = stoi (sf.next (" x" ));
1729
+ u32 height = stoi (sf.next (" " ));
1730
+ core::dimension2d<u32> dim (width, height);
1731
+
1732
+ video::IImage* image = m_device->getVideoDriver ()->
1733
+ createImage (video::ECF_A8R8G8B8, dim);
1734
+ baseimg->copyToScaling (image);
1735
+ baseimg->drop ();
1736
+ baseimg = image;
1737
+ }
1714
1738
else
1715
1739
{
1716
1740
errorstream << " generateImagePart(): Invalid "
You can’t perform that action at this time.
0 commit comments