]> marstr Code Repo - marstr/orthographic.git/commitdiff
Attempt to make the fill of empty space look more realistic, hopefully fixed a contra...
authorMarcus Str. <marcus@marstr.online>
Sun, 22 Dec 2024 11:37:21 +0000 (12:37 +0100)
committerMarcus Str. <marcus@marstr.online>
Sun, 22 Dec 2024 11:37:21 +0000 (12:37 +0100)
photogen.py
resourcegen.py

index 8a6c2fb99685a06b88385bc5b9e47d6d0bd9077e..d5c80358a1c72f7f8e32882e77526a8f72f034ea 100644 (file)
@@ -87,30 +87,15 @@ class mstr_photogen:
             edn = self.find_earthnavdata_number()\r
             edns = self.latlng_folder(edn)\r
 \r
-            cplstr = ""\r
-            for c in range(0, len(cpl)):\r
-                cplstr = cplstr + str(cpl[c])\r
-                if c < len(cpl)-1:\r
-                    cplstr = cplstr + "_"\r
-\r
-            # Find the right color catalogue\r
-            cpl_catalog = 0\r
-            for c in range(len(mstr_completion_colors)):\r
-                if mstr_completion_colors[c][0] == edn:\r
-                    cpl_catalog = c\r
-\r
-            # Put in some pixels\r
-            cmpl_bg = Image.new("RGBA", (self._tile.width, self._tile.height))\r
-            cmpl_pix = cmpl_bg.load()\r
-            for y in range(0, self._tile.height):\r
-                for x in range(0, self._tile.width):\r
-                    idx = randrange(0, len(mstr_completion_colors[cpl_catalog][1]))\r
-                    clr = mstr_completion_colors[cpl_catalog][1][idx]\r
-                    cmpl_pix[x,y] = clr\r
-            cmpl_bg = ImageEnhance.Contrast(cmpl_bg).enhance(0.8)\r
-            cmpl_bg = cmpl_bg.filter(ImageFilter.GaussianBlur(radius=1))\r
-            cmpl_bg.alpha_composite(self._tile)\r
-            self._tile = cmpl_bg\r
+            cmpl_ptc = Image.open(mstr_datafolder + "textures/tile/completion/ptc.png")\r
+            cmpl_brd = Image.open(mstr_datafolder + "textures/tile/completion/brd.png")\r
+\r
+            # Generate the source image\r
+            for p in range(1, 201):\r
+                rx = randrange(0 - int(cmpl_ptc.width / 2), ptc_full.width - int(cmpl_ptc.width / 2))\r
+                ry = randrange(0 - int(cmpl_ptc.height / 2), ptc_full.height - int(cmpl_ptc.height / 2))\r
+                cmpl.alpha_composite(cmpl_ptc, dest=(rx, ry))\r
+            cmpl.alpha_composite(cmpl_brd)\r
 \r
             # Patches to add from other sources. If they don't exist, we also need to make them\r
             masks = glob.glob(mstr_datafolder + "textures/tile/completion/*.png")\r
index 41cd3158240ef8f7929e79ae25e27d0efd3ef023..f5e08986d1395e62f2334aa95aafe853287a3ffa 100644 (file)
@@ -29,12 +29,13 @@ class mstr_resourcegen:
         self._sources = sources
         self._tag = tag
         self._value = value
-        self._contrast = 0
+        self._contrast = 1
 
 
     # Sets the contrast from layergen
     def setLayerContrast(self, contrast):
         self._contrast = contrast
+        if contrast == 0: self._contrast = 1
 
 
     # This generates a resource from the given sources